diff --git a/src/devices/screen.c b/src/devices/screen.c index 9a550d4..f1f8b68 100644 --- a/src/devices/screen.c +++ b/src/devices/screen.c @@ -106,6 +106,7 @@ screen_resize(Uint16 width, Uint16 height) uxn_screen.height = height; screen_fill(uxn_screen.bg, 0, 0, uxn_screen.width, uxn_screen.height, 0); screen_fill(uxn_screen.fg, 0, 0, uxn_screen.width, uxn_screen.height, 0); + emu_resize(); } void diff --git a/src/devices/screen.h b/src/devices/screen.h index ab3d688..e76b714 100644 --- a/src/devices/screen.h +++ b/src/devices/screen.h @@ -17,6 +17,8 @@ typedef struct UxnScreen { } UxnScreen; extern UxnScreen uxn_screen; +extern int emu_resize(void); + void screen_palette(Uint8 *addr); void screen_resize(Uint16 width, Uint16 height); void screen_redraw(void); diff --git a/src/uxnemu.c b/src/uxnemu.c index 16fdaed..ca096c3 100644 --- a/src/uxnemu.c +++ b/src/uxnemu.c @@ -48,7 +48,6 @@ static SDL_Window *emu_window; static SDL_Texture *emu_texture; static SDL_Renderer *emu_renderer; static SDL_AudioDeviceID audio_id; -static SDL_Rect emu_frame; static SDL_Thread *stdin_thread; Uint16 deo_mask[] = {0xff28, 0x0300, 0xc028, 0x8000, 0x8000, 0x8000, 0x8000, 0x0000, 0x0000, 0x0000, 0xa260, 0xa260, 0x0000, 0x0000, 0x0000, 0x0000}; @@ -166,13 +165,7 @@ set_window_size(SDL_Window *window, int w, int h) SDL_SetWindowSize(window, w, h); } -static int -set_size(void) -{ - emu_frame.x = 0; - emu_frame.y = 0; - emu_frame.w = uxn_screen.width; - emu_frame.h = uxn_screen.height; +int emu_resize(void){ if(emu_texture != NULL) SDL_DestroyTexture(emu_texture); SDL_RenderSetLogicalSize(emu_renderer, uxn_screen.width, uxn_screen.height); @@ -188,8 +181,6 @@ set_size(void) static void redraw(void) { - if(emu_frame.w != uxn_screen.width || emu_frame.h != uxn_screen.height) - set_size(); screen_redraw(); if(SDL_UpdateTexture(emu_texture, NULL, uxn_screen.pixels, uxn_screen.width * sizeof(Uint32)) != 0) system_error("SDL_UpdateTexture", SDL_GetError());