Skip to content

Commit 6de58f8

Browse files
committed
ui: add frame-stepping with left Ctrl
1 parent f808b9b commit 6de58f8

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

ui/src/main.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ fn main() -> Result<(), String> {
5757
let mut emu = emu::Emulator::init(data, true);
5858

5959
let mut run = true;
60+
let mut step = false;
6061
event_loop.run(move |event, _, control_flow| {
6162
// Draw the current frame
6263
match event {
@@ -86,6 +87,11 @@ fn main() -> Result<(), String> {
8687
run = !run;
8788
}
8889
}
90+
Some(VirtualKeyCode::LControl) => {
91+
if input.state == ElementState::Pressed {
92+
step = true;
93+
}
94+
}
8995
_ => handle_key(&mut emu, input),
9096
},
9197
WindowEvent::Resized(size) => {
@@ -100,12 +106,13 @@ fn main() -> Result<(), String> {
100106
handle_joystick_event(&mut emu, event);
101107
}
102108

103-
if run {
109+
if run || step {
104110
loop {
105111
if emu.step(pixels.get_frame()) {
106112
break;
107113
}
108114
}
115+
step = false;
109116
}
110117
window.request_redraw();
111118
}

0 commit comments

Comments
 (0)