uxn

Varvara Ordinator, written in ANSI C(SDL2)
git clone https://git.eamoncaddigan.net/uxn.git
Log | Files | Refs | README | LICENSE

commit 7f3a889771d07f53205242719a53ff2a671c2cfe
parent 8d72c36123274cbfd89208a56a56734c4bd8e91f
Author: neauoire <aliceffekt@gmail.com>
Date:   Wed, 29 Sep 2021 16:08:36 -0700

Removed clamp from within set_zoom

Diffstat:
Msrc/uxnemu.c | 10++++------
1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/src/uxnemu.c b/src/uxnemu.c @@ -141,12 +141,10 @@ set_window_size(SDL_Window *window, int w, int h) static void set_zoom(Uint8 scale) { - if(scale == zoom) + if(scale == zoom || !gWindow) return; - zoom = clamp(scale, 1, 3); + set_window_size(gWindow, (ppu.width + PAD * 2) * zoom, (ppu.height + PAD * 2) * zoom); reqdraw = 1; - if(gWindow) - set_window_size(gWindow, (ppu.width + PAD * 2) * zoom, (ppu.height + PAD * 2) * zoom); } static int @@ -329,7 +327,7 @@ doctrl(SDL_Event *event, int z) case SDLK_DOWN: flag = 0x20; break; case SDLK_LEFT: flag = 0x40; break; case SDLK_RIGHT: flag = 0x80; break; - case SDLK_F1: if(z) set_zoom(zoom == 3 ? 1 : zoom + 1); break; + case SDLK_F1: if(z) set_zoom(zoom > 2 ? 1 : zoom + 1); break; case SDLK_F2: if(z) set_inspect(!devsystem->dat[0xe]); break; case SDLK_F3: if(z) capture_screen(); break; } @@ -601,7 +599,7 @@ main(int argc, char **argv) /* set default zoom */ SDL_GetCurrentDisplayMode(0, &DM); - set_zoom(DM.w / 1280); + set_zoom(clamp(DM.w / 1280, 1, 3)); /* get default zoom from flags */ for(i = 1; i < argc - 1; i++) { if(strcmp(argv[i], "-s") == 0) {