From fca4e4f02f42efcfe88104ca221e32302b4f4878 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tomas=20Wenstr=C3=B6m?= Date: Sun, 10 Jan 2021 15:04:11 +0100 Subject: [PATCH] Minor refactor --- src/core/app.rs | 10 +++++----- src/core/controller.rs | 12 ++++++------ 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/core/app.rs b/src/core/app.rs index 7e91c94..b495edb 100644 --- a/src/core/app.rs +++ b/src/core/app.rs @@ -127,11 +127,11 @@ impl AppBuilder { } pub struct App { - pub canvas: Canvas, - pub event_pump: EventPump, - pub sprites: SpriteManager, - pub state: Box, - pub ctrl_man: ControllerManager, + canvas: Canvas, + event_pump: EventPump, + sprites: SpriteManager, + state: Box, + ctrl_man: ControllerManager, } impl App { diff --git a/src/core/controller.rs b/src/core/controller.rs index 7037d81..b3f6201 100644 --- a/src/core/controller.rs +++ b/src/core/controller.rs @@ -31,12 +31,12 @@ impl ControllerManager { pub fn handle_event(&mut self, event: &Event) { match event { - Event::ControllerDeviceAdded { which: id, .. } => { self.add_device(*id) } - Event::ControllerDeviceRemoved { which: id, .. } => { self.remove_device(*id) } - Event::ControllerDeviceRemapped { which: id, .. } => { println!("device remapped ({})!", *id) } - Event::ControllerButtonDown { button: btn, .. } => { println!("button {} down!", btn.string()) } - Event::ControllerButtonUp { button: btn, .. } => { println!("button {} up!", btn.string()) } - Event::ControllerAxisMotion { axis: ax, .. } => { println!("axis motion {}!", ax.string()) } + Event::ControllerDeviceAdded { which, .. } => { self.add_device(*which) } + Event::ControllerDeviceRemoved { which, .. } => { self.remove_device(*which) } + Event::ControllerDeviceRemapped { which, .. } => { println!("device remapped ({})!", *which) } + Event::ControllerButtonDown { button, .. } => { println!("button {} down!", button.string()) } + Event::ControllerButtonUp { button, .. } => { println!("button {} up!", button.string()) } + Event::ControllerAxisMotion { axis, .. } => { println!("axis motion {}!", axis.string()) } _ => {} } } -- 2.11.0