Simplify working with controls (#27)

This commit is contained in:
GitGhillie
2025-04-13 21:07:11 +04:00
committed by GitHub
parent 615c55e9ca
commit ca9211d0d1
5 changed files with 45 additions and 88 deletions

View File

@@ -31,9 +31,9 @@ pub struct ControlState {
}
#[derive(Resource, Debug, Default)]
pub struct Controls {
pub keyboard_state: ControlState,
pub gamepad_state: Option<ControlState>,
struct Controls {
keyboard_state: ControlState,
gamepad_state: Option<ControlState>,
}
#[derive(Event)]
@@ -44,6 +44,7 @@ pub struct SelectedController(ControllerSet);
pub fn plugin(app: &mut App) {
app.init_resource::<SelectedController>();
app.init_resource::<ControlState>();
app.add_plugins(controls::plugin);
app.add_plugins(controller_common::plugin);