-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 79ad89a
Showing
11 changed files
with
1,029 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
pull_request: | ||
workflow_dispatch: | ||
|
||
permissions: | ||
contents: read | ||
|
||
env: | ||
RUSTFLAGS: -Dwarnings | ||
|
||
jobs: | ||
check: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: dtolnay/rust-toolchain@stable | ||
- name: No features | ||
run: cargo check --no-default-features | ||
- name: All features | ||
run: cargo check --features 2d,3d | ||
- name: Examples | ||
run: cargo check --examples | ||
|
||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: dtolnay/rust-toolchain@stable | ||
- run: cargo test --all-features | ||
|
||
fmt: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: dtolnay/rust-toolchain@stable | ||
- run: cargo fmt --all -- --check | ||
|
||
clippy: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: dtolnay/rust-toolchain@stable | ||
- run: cargo clippy --all-features -- -D warnings | ||
|
||
doc: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: dtolnay/rust-toolchain@stable | ||
- run: cargo doc --all-features --no-deps --document-private-items |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
/target | ||
/Cargo.lock | ||
.vscode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
[package] | ||
name = "bevy_cursor" | ||
version = "0.1.0" | ||
edition = "2021" | ||
authors = ["Tristan Guichaoua <[email protected]>"] | ||
description = "A bevy plugin to track informations about the cursor" | ||
repository = "github.com/tguichaoua/bevy_cursor" | ||
license = "MIT OR Apache-2.0" | ||
keywords = ["bevy", "cursor", "window", "camera"] | ||
categories = ["game-engines"] | ||
|
||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[features] | ||
default = ["2d"] | ||
2d = [] | ||
3d = [] | ||
|
||
|
||
[dependencies] | ||
bevy = { version = "0.11.0", default-features = false, features = [ | ||
"bevy_render", | ||
] } | ||
smallvec = { version = "1.11.0", features = ["union"] } | ||
|
||
[dev-dependencies] | ||
bevy = { version = "0.11.0", default-features = false, features = [ | ||
"bevy_ui", | ||
"bevy_winit", | ||
"default_font", | ||
"png", | ||
] } | ||
# bevy_ecs_tilemap = "0.11.0" | ||
bevy_ecs_tilemap = { git = "https://github.com/StarArawn/bevy_ecs_tilemap.git", rev = "fbda80c735bf7faaa2cc4d79524cfbf016044a0f" } | ||
bevy_pancam = "0.9.0" | ||
|
||
[package.metadata.docs.rs] | ||
# To build locally: | ||
# RUSTDOCFLAGS="--cfg docsrs" cargo +nightly doc --all-features --no-deps --open | ||
all-features = true | ||
# enable unstable features in the documentation | ||
rustdoc-args = ["--cfg", "docsrs"] | ||
|
||
[[example]] | ||
name = "basic" | ||
required-features = ["2d"] | ||
|
||
[[example]] | ||
name = "multiple_windows" | ||
required-features = ["2d"] | ||
|
||
[[example]] | ||
name = "tilemap" | ||
required-features = ["2d"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# Bevy Cursor | ||
|
||
[![Latest Version]][crates.io] [![Bevy Tracking]][bevy tracking doc] [![Doc Status]][docs] [![Build Status]][actions] | ||
|
||
[Latest Version]: https://img.shields.io/crates/v/bevy_cursor.svg | ||
[crates.io]: https://crates.io/crates/bevy_cursor | ||
[Bevy Tracking]: https://img.shields.io/badge/Bevy%20tracking-released%20version-lightblue?labelColor=555555&logo=bevy | ||
[bevy tracking doc]: https://github.com/bevyengine/bevy/blob/main/docs/plugins_guidelines.md#main-branch-tracking | ||
[Doc Status]: https://docs.rs/bevy_cursor/badge.svg | ||
[docs]: https://docs.rs/bevy_cursor | ||
[Build Status]: https://github.com/tguichaoua/bevy-cursor/actions/workflows/ci.yml/badge.svg?branch=main | ||
[actions]: https://github.com/tguichaoua/bevy-cursor/actions/workflows/ci.yml | ||
|
||
**Bevy Cursor is a [`bevy`](https://github.com/bevyengine/bevy) plugin to track informations about the cursor.** | ||
|
||
--- | ||
|
||
## Example | ||
|
||
```rust | ||
use bevy::prelude::*; | ||
use bevy_cursor::prelude::*; | ||
|
||
|
||
fn main() { | ||
App::new() | ||
// | ||
.add_plugins(DefaultPlugins) | ||
.add_plugins(CursorInfoPlugin) // Add the plugin | ||
// | ||
.add_systems(Update, print_cursor_info) | ||
.run(); | ||
} | ||
|
||
fn print_cursor_info(cursor: Res<CursorInfo>) { | ||
if let Some(position) = cursor.position() { | ||
info!("Cursor position: {position:?}"); | ||
} else { | ||
info!("The cursor is not in any window"); | ||
} | ||
} | ||
|
||
``` | ||
|
||
## Bevy compatible version | ||
|
||
| bevy | bevy_cursor | | ||
| ---- | ----------- | | ||
| 0.11 | 0.1 | |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
use bevy::prelude::*; | ||
use bevy_cursor::prelude::*; | ||
|
||
fn main() { | ||
App::new() | ||
.add_plugins((DefaultPlugins, CursorInfoPlugin)) | ||
.add_systems(Update, print_cursor_position) | ||
.run(); | ||
} | ||
|
||
fn print_cursor_position(cursor: Res<CursorInfo>) { | ||
if let Some(position) = cursor.position() { | ||
info!("Cursor position: {position:?}"); | ||
} else { | ||
info!("The cursor is not in any window"); | ||
} | ||
} |
Oops, something went wrong.