update-on-event
This commit is contained in:
parent
2e40285244
commit
e3a07c3309
@ -88,6 +88,7 @@ static SDL_bool event_loop(void) {
|
||||
switch (event.window.event) {
|
||||
case SDL_WINDOWEVENT_EXPOSED:
|
||||
case SDL_WINDOWEVENT_SIZE_CHANGED:
|
||||
screen_update_scale(&screen);
|
||||
screen_render(&screen);
|
||||
break;
|
||||
}
|
||||
|
@ -313,3 +313,7 @@ void screen_resize_to_pixel_perfect(struct screen *screen) {
|
||||
LOGD("Resized to pixel-perfect");
|
||||
}
|
||||
}
|
||||
|
||||
void screen_update_scale(struct screen *screen) {
|
||||
render_set_scaled_logical_size(screen, screen->frame_size);
|
||||
}
|
||||
|
@ -66,4 +66,8 @@ void screen_resize_to_fit(struct screen *screen);
|
||||
// resize window to 1:1 (pixel-perfect)
|
||||
void screen_resize_to_pixel_perfect(struct screen *screen);
|
||||
|
||||
// recompute the scale in case the window moved from/to another screen with a
|
||||
// different HiDPI
|
||||
void screen_update_scale(struct screen *screen);
|
||||
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user