Gemma:
- Adding SCHIP instructions SDL2: - Sorting out Joystick/Gamepad/Whatever Util: - Disassembler in progress
This commit is contained in:
@@ -17,7 +17,6 @@ async fn run() -> anyhow::Result<String> {
|
||||
let sdl = sdl2::init().map_err(|e| anyhow::anyhow!("Failed to create SDL context: {}", e))?;
|
||||
let mut video = sdl.video().map_err(|e| anyhow::anyhow!("Failed to initialize SDL video subsystem: {}", e))?;
|
||||
|
||||
|
||||
// Create SDL2 window and OpenGL context
|
||||
let window = video.window("Window", SCREEN_WIDTH, SCREEN_HEIGHT)
|
||||
.opengl()
|
||||
@@ -114,6 +113,12 @@ async fn run() -> anyhow::Result<String> {
|
||||
Event::ControllerButtonDown { button, .. } => {
|
||||
println!("BUTTON {:?}", button);
|
||||
}
|
||||
Event::JoyButtonDown {button_idx, .. } => {
|
||||
println!("JoyButtonDown {}", button_idx);
|
||||
}
|
||||
Event::JoyAxisMotion { which, axis_idx, .. } => {
|
||||
println!("JoyAxismotion {which} {axis_idx}");
|
||||
}
|
||||
_ => platform.handle_event(&event, &sdl, &video),
|
||||
}
|
||||
}
|
||||
@@ -122,6 +127,9 @@ async fn run() -> anyhow::Result<String> {
|
||||
if let Some(fps) = timestep.frame_rate() {
|
||||
println!("{:?} fps", fps);
|
||||
}
|
||||
|
||||
let num_js = sdl.joystick().unwrap().num_joysticks().unwrap();
|
||||
println!("NUM JS = {num_js}");
|
||||
}
|
||||
|
||||
Ok(("").parse()?)
|
||||
|
||||
Reference in New Issue
Block a user