File tree Expand file tree Collapse file tree
crates/processing_pyo3/src Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -55,7 +55,7 @@ impl Default for LoopState {
5555 fn default ( ) -> Self {
5656 Self {
5757 looping : true ,
58- redraw_requested : true ,
58+ redraw_requested : false ,
5959 }
6060 }
6161}
@@ -920,6 +920,7 @@ mod mewnala {
920920 return Ok ( ( ) ) ;
921921 }
922922 let draw_fn_ref = draw_fn. as_mut ( ) . expect ( "checked above" ) ;
923+ let mut first_frame = true ;
923924
924925 loop {
925926 {
@@ -944,6 +945,7 @@ mod mewnala {
944945 * draw_fn_ref = locals. get_item ( "draw" ) . unwrap ( ) . unwrap ( ) ;
945946 globals = draw_fn_ref. getattr ( "__globals__" ) ?;
946947 reset_tracked_globals ( ) ;
948+ first_frame = true ;
947949
948950 dbg ! ( locals) ;
949951 }
@@ -955,15 +957,17 @@ mod mewnala {
955957
956958 dispatch_event_callbacks ( & locals) ?;
957959
958- let should_draw = LOOP_STATE . with ( |s| {
959- let state = s. get ( ) ;
960- state. looping || state. redraw_requested
961- } ) ;
960+ let should_draw = first_frame
961+ || LOOP_STATE . with ( |s| {
962+ let state = s. get ( ) ;
963+ state. looping || state. redraw_requested
964+ } ) ;
962965
963966 if !should_draw {
964967 std:: thread:: sleep ( std:: time:: Duration :: from_millis ( 16 ) ) ;
965968 continue ;
966969 }
970+ first_frame = false ;
967971
968972 get_graphics_mut ( module) ?
969973 . ok_or_else ( || PyRuntimeError :: new_err ( "call size() first" ) ) ?
You can’t perform that action at this time.
0 commit comments