handle pause on android (#958)

This commit is contained in:
Logan McNaughton 2026-05-27 10:11:48 +02:00 committed by GitHub
parent a447bc8104
commit f80f0f5f02
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 2 deletions

View File

@ -266,6 +266,12 @@ bool sdl_event_filter(void *userdata, SDL_Event *event) {
joystick_event->joystick_id = event->jdevice.which;
joystick_event->connected = false;
SDL_RunOnMainThread(add_joystick_event, joystick_event, false);
} else if (event->type == SDL_EVENT_WILL_ENTER_BACKGROUND) {
wsi->end_frame();
wsi->deinit_surface_and_swapchain();
} else if (event->type == SDL_EVENT_RENDER_DEVICE_RESET) {
wsi->init_surface_swapchain();
wsi->begin_frame();
}
return 0;

View File

@ -145,6 +145,8 @@ pub fn vertical_interrupt_event(device: &mut device::Device) {
speed_limiter(device, speed_limiter_toggled);
}
unsafe { sdl3_sys::events::SDL_PumpEvents() };
ui::video::update_screen();
device.vi.vi_counter += 1;
device.vi.elapsed_time += device.vi.frame_time;
@ -160,8 +162,6 @@ pub fn vertical_interrupt_event(device: &mut device::Device) {
}
}
unsafe { sdl3_sys::events::SDL_PumpEvents() };
/* toggle vi field if in interlaced mode */
device.vi.field ^= (device.vi.regs[VI_STATUS_REG] >> 6) & 0x1;