Skip to content

Commit

Permalink
Formatting tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
17cupsofcoffee committed Dec 4, 2024
1 parent 8a22573 commit 8ebc47e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 7 additions & 1 deletion src/input/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,16 @@ pub enum Event {
KeyUp(Key),
MouseButtonDown(MouseButton),
MouseButtonUp(MouseButton),

MouseMotion {
new_position: Vec2,
},

ControllerDeviceAdded {
joystick: JoystickID,
gamepad: Gamepad,
},

ControllerDeviceRemoved {
joystick: JoystickID,
},
Expand All @@ -26,6 +29,7 @@ pub enum Event {
joystick: JoystickID,
button: GamepadButton,
},

ControllerButtonUp {
joystick: JoystickID,
button: GamepadButton,
Expand All @@ -36,6 +40,7 @@ pub enum Event {
axis: GamepadAxis,
value: f32,
},

WindowResized {
width: u32,
height: u32,
Expand All @@ -47,7 +52,7 @@ pub enum Event {
}

impl Event {
pub fn try_from_sdl_event(event: &SDL_Event) -> Option<Self> {
pub fn from_raw(event: &SDL_Event) -> Option<Event> {
unsafe {
match SDL_EventType(event.r#type) {
SDL_EVENT_QUIT => {
Expand Down Expand Up @@ -168,6 +173,7 @@ impl Event {
_ => {}
}
}

None
}
}
2 changes: 1 addition & 1 deletion src/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ impl Window {
if SDL_PollEvent(raw_event.as_mut_ptr()) {
let raw_event = raw_event.assume_init();

Event::try_from_sdl_event(&raw_event)
Event::from_raw(&raw_event)
} else {
None
}
Expand Down

0 comments on commit 8ebc47e

Please sign in to comment.