@@ -230,7 +230,7 @@ struct WinitPersistentState {
230
230
impl Default for WinitPersistentState {
231
231
fn default ( ) -> Self {
232
232
Self {
233
- active : true ,
233
+ active : false ,
234
234
low_power_event : false ,
235
235
redraw_request_sent : false ,
236
236
timeout_reached : false ,
@@ -289,7 +289,7 @@ pub fn winit_runner(mut app: App) {
289
289
}
290
290
}
291
291
292
- {
292
+ if winit_state . active {
293
293
#[ cfg( not( target_arch = "wasm32" ) ) ]
294
294
let ( commands, mut new_windows, created_window_writer, winit_windows) =
295
295
create_window_system_state. get_mut ( & mut app. world ) ;
@@ -474,14 +474,7 @@ pub fn winit_runner(mut app: App) {
474
474
}
475
475
} ,
476
476
WindowEvent :: Touch ( touch) => {
477
- let mut location =
478
- touch. location . to_logical ( window. resolution . scale_factor ( ) ) ;
479
-
480
- // On a mobile window, the start is from the top while on PC/Linux/OSX from
481
- // bottom
482
- if cfg ! ( target_os = "android" ) || cfg ! ( target_os = "ios" ) {
483
- location. y = window. height ( ) as f64 - location. y ;
484
- }
477
+ let location = touch. location . to_logical ( window. resolution . scale_factor ( ) ) ;
485
478
486
479
// Event
487
480
input_events
@@ -615,6 +608,13 @@ pub fn winit_runner(mut app: App) {
615
608
}
616
609
event:: Event :: Suspended => {
617
610
winit_state. active = false ;
611
+ #[ cfg( target_os = "android" ) ]
612
+ {
613
+ // Bevy doesn't support suspend/resume so we just exit
614
+ // and Android will restart the application on resume
615
+ // TODO: Save save some state and load on resume
616
+ * control_flow = ControlFlow :: Exit ;
617
+ }
618
618
}
619
619
event:: Event :: Resumed => {
620
620
winit_state. active = true ;
0 commit comments