diff options
author | tcmal <me@aria.rip> | 2024-08-25 17:44:22 +0100 |
---|---|---|
committer | tcmal <me@aria.rip> | 2024-08-25 17:44:22 +0100 |
commit | 7be602f38f9ba5067de8fa8f3a004ce4e5200ade (patch) | |
tree | bccf3cf8acd0043e9292824660b776f69366256e /stockton-input-codegen/src | |
parent | 8004132c918a52af3b2e7b32b4fc72c65fde9e3c (diff) |
feat(input): add type of inputs to inputmanager trait
Diffstat (limited to 'stockton-input-codegen/src')
-rw-r--r-- | stockton-input-codegen/src/lib.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/stockton-input-codegen/src/lib.rs b/stockton-input-codegen/src/lib.rs index a6e8215..d3ee525 100644 --- a/stockton-input-codegen/src/lib.rs +++ b/stockton-input-codegen/src/lib.rs @@ -51,6 +51,7 @@ pub fn derive_inputmanager(input: TokenStream) -> TokenStream { ); let trait_impl = gen_trait_impl( &manager_ident, + &struct_ident, &fields_enum_ident, &buttons, &axes, @@ -234,6 +235,7 @@ fn gen_manager_struct( /// ``` fn gen_trait_impl( manager: &Ident, + struct_ident: &Ident, fields_enum: &Ident, buttons: &[Ident], axes: &[Ident], @@ -246,6 +248,8 @@ fn gen_trait_impl( quote!( impl InputManager for #manager { + type Inputs = #struct_ident; + fn handle_frame<'a, X: IntoIterator<Item = &'a ::stockton_input::Action>>(&mut self, actions: X) -> () { #(#just_hot_resets)* @@ -267,6 +271,10 @@ fn gen_trait_impl( } } } + + fn get_inputs(&self) -> &Self::Inputs { + &self.inputs + } } ) } |