sdl2: Allow toggling frame limiter with right stick
Former-commit-id: 1207b84dbd6162986e5ce790e13e1e2c0b125ebf Former-commit-id: c7fe6ef3e5ec66fc63e5193e294bfb9d7f469afe
This commit is contained in:
parent
0ae9ef14c3
commit
13c3e74973
|
@ -2,6 +2,7 @@ use sdl2;
|
||||||
use sdl2::event::{Event, WindowEvent};
|
use sdl2::event::{Event, WindowEvent};
|
||||||
use sdl2::image::{InitFlag, LoadTexture};
|
use sdl2::image::{InitFlag, LoadTexture};
|
||||||
use sdl2::keyboard::Scancode;
|
use sdl2::keyboard::Scancode;
|
||||||
|
use sdl2::controller::Button;
|
||||||
use sdl2::messagebox::*;
|
use sdl2::messagebox::*;
|
||||||
use sdl2::pixels::Color;
|
use sdl2::pixels::Color;
|
||||||
use sdl2::rect::Rect;
|
use sdl2::rect::Rect;
|
||||||
|
@ -330,9 +331,10 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||||
Scancode::Space => frame_limiter = true,
|
Scancode::Space => frame_limiter = true,
|
||||||
k => input.borrow_mut().on_keyboard_key_up(k),
|
k => input.borrow_mut().on_keyboard_key_up(k),
|
||||||
},
|
},
|
||||||
Event::ControllerButtonDown { button, .. } => {
|
Event::ControllerButtonDown { button, .. } => match button {
|
||||||
input.borrow_mut().on_controller_button_down(button);
|
Button::RightStick => frame_limiter = !frame_limiter,
|
||||||
}
|
b => input.borrow_mut().on_controller_button_down(b),
|
||||||
|
},
|
||||||
Event::ControllerButtonUp { button, .. } => {
|
Event::ControllerButtonUp { button, .. } => {
|
||||||
input.borrow_mut().on_controller_button_up(button);
|
input.borrow_mut().on_controller_button_up(button);
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue