use bevy::prelude::*; use serde::{Deserialize, Serialize}; #[derive(Debug, Serialize, Deserialize, Copy, Clone, PartialEq, Default)] pub enum InputActionState { JustPressed, Pressed, JustReleased, #[default] Released, } #[derive(Debug)] pub enum InputMapAction { MovementXDir(i32), MovementYDir(i32), Jump, Shield, Attack, } #[derive(Debug)] pub enum MenuInputMapAction { MovementXDir(i32), MovementYDir(i32), Accept, Back, Start, } #[derive(Debug)] pub struct KeyboardInputMapElement { pub key: KeyCode, pub action: InputMapAction, } #[derive(Debug)] pub enum GamepadBinding { Button(GamepadButton), Axis(GamepadAxis, i32), } #[derive(Debug)] pub struct GamepadInputMapElement { pub binding: GamepadBinding, pub action: InputMapAction, } #[derive(Debug)] pub struct MenuKeyboardInputMapElement { pub key: KeyCode, pub action: MenuInputMapAction, } #[derive(Debug)] pub struct MenuGamepadInputMapElement { pub binding: GamepadBinding, pub action: MenuInputMapAction, } #[derive(Resource)] pub struct BaseInputMap { pub keyboard: Vec, pub gamepad: Vec, } #[derive(Resource)] pub struct MenuInputMap { pub keyboard: Vec, pub gamepad: Vec, }