diff --git a/crate/bevy_controls/example/basic/Cargo.lock b/crate/bevy_controls/example/basic/Cargo.lock index d13559f..6d86d1a 100644 --- a/crate/bevy_controls/example/basic/Cargo.lock +++ b/crate/bevy_controls/example/basic/Cargo.lock @@ -308,6 +308,7 @@ version = "0.1.0" dependencies = [ "bevy", "bevy_controls", + "bevy_controls_derive", "strum", "strum_macros", ] @@ -318,6 +319,7 @@ version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e4bc7e09282a82a48d70ade0c4c1154b0fd7882a735a39c66766a5d0f4718ea9" dependencies = [ + "bevy_dylib", "bevy_internal", ] @@ -407,6 +409,13 @@ dependencies = [ "strum_macros", ] +[[package]] +name = "bevy_controls_derive" +version = "0.1.0" +dependencies = [ + "bevy_controls", +] + [[package]] name = "bevy_core" version = "0.12.1" @@ -470,6 +479,15 @@ dependencies = [ "sysinfo", ] +[[package]] +name = "bevy_dylib" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45b99001eb4837c78d9c63cc8b32fda61ea96b194a2cda54b569aeee69a9853c" +dependencies = [ + "bevy_internal", +] + [[package]] name = "bevy_ecs" version = "0.12.1" diff --git a/crate/bevy_controls/example/basic/Cargo.toml b/crate/bevy_controls/example/basic/Cargo.toml index 9e925c8..a7c00d5 100644 --- a/crate/bevy_controls/example/basic/Cargo.toml +++ b/crate/bevy_controls/example/basic/Cargo.toml @@ -13,8 +13,10 @@ bevy = { version = "0.12.1", default-features = false, features = [ "bevy_asset", "bevy_text", "bevy_ui", + "dynamic_linking", "default_font", ]} bevy_controls = { path = "./../../" } +bevy_controls_derive = { path = "./../../../bevy_controls_derive" } strum = "0.25.0" strum_macros = "0.25.3" diff --git a/crate/bevy_controls/example/basic/src/main.rs b/crate/bevy_controls/example/basic/src/main.rs index e3f23b0..e2ea92c 100644 --- a/crate/bevy_controls/example/basic/src/main.rs +++ b/crate/bevy_controls/example/basic/src/main.rs @@ -13,12 +13,11 @@ use bevy_controls::{ Action, ActionInner, GameState, GameStateInner, InputsContainer, InputsContainerInner, }, plugin::ControlsPlugin, - resource::{Binding, ButtonCombination, Controls, InputType, InputValue, Inputs, PlayerInputs}, + resource::{Binding, ButtonCombination, Controls, InputType, InputValue, PlayerInputs}, }; use strum_macros::EnumIter; -const FIRA_CODE_PATH: &str = "font/FiraCode/FiraCode-VariableFont_wght.ttf"; -#[derive(PartialEq, Eq, Hash, EnumIter, Clone, Copy, Debug)] +#[derive(PartialEq, Eq, Hash, EnumIter, Clone, Copy, Debug, bevy_controls_derive::Action)] enum MyAction { Forward, Back, diff --git a/crate/bevy_controls_derive/Cargo.toml b/crate/bevy_controls_derive/Cargo.toml new file mode 100644 index 0000000..b65b5ea --- /dev/null +++ b/crate/bevy_controls_derive/Cargo.toml @@ -0,0 +1,30 @@ +[package] +name = "bevy_controls_derive" +version = "0.1.0" +edition = "2021" + +[lib] +proc-macro = true + +# [features] +# default = [] +# serialize = ["bevy_input/serialize", "serde"] +# reflect = ["dep:bevy_reflect"] +# inspector-egui = ["reflect", "dep:bevy-inspector-egui"] + +[dependencies] +# bevy-inspector-egui = { version = "0.22.1", optional = true } +# bevy_app = "0.12.1" +# bevy_derive = "0.12.1" +# bevy_ecs = "0.12.1" +# bevy_input = "0.12.1" +# bevy_reflect = { version = "0.12.1", optional = true } +# bevy_utils = "0.12.1" +# log = "0.4.20" +# serde = { version = "1.0.194", optional = true } +# strum = "0.25.0" +# strum_macros = "0.25.3" +bevy_controls = { path = "./../bevy_controls" } + +[dev-dependencies] +env_logger = "0.10.1" diff --git a/crate/bevy_controls_derive/src/lib.rs b/crate/bevy_controls_derive/src/lib.rs new file mode 100644 index 0000000..4d8b25a --- /dev/null +++ b/crate/bevy_controls_derive/src/lib.rs @@ -0,0 +1,7 @@ +extern crate proc_macro; +use proc_macro::TokenStream; + +#[proc_macro_derive(Action)] +pub fn action(_input: TokenStream) -> TokenStream { + todo!("urmom") +}