File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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 }
You can’t perform that action at this time.
0 commit comments