From 718a74641e2c2077982798f5ff5a992e9ed3ead0 Mon Sep 17 00:00:00 2001 From: neauoire Date: Wed, 22 Sep 2021 11:21:57 -0700 Subject: [PATCH] Removed flickering on initial resize --- src/uxnemu.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/uxnemu.c b/src/uxnemu.c index 67cbc20..7ea702e 100644 --- a/src/uxnemu.c +++ b/src/uxnemu.c @@ -598,23 +598,24 @@ main(int argc, char **argv) /* unused */ uxn_port(&u, 0xe, nil_talk); /* unused */ uxn_port(&u, 0xf, nil_talk); - if(!init()) - return error("Init", "Failed to initialize emulator."); - if(!set_size(WIDTH, HEIGHT, 0)) - return error("Window", "Failed to set window size."); - /* default zoom */ + /* set default zoom */ SDL_GetCurrentDisplayMode(0, &DM); - set_zoom(DM.w / 1000); - /* zoom from flags */ + 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) { if((i + 1) < argc - 1) - set_zoom(atoi(argv[++i])); + zoom = clamp(atoi(argv[++i]), 1, 3); else return error("Opt", "-s No scale provided."); } } + if(!init()) + return error("Init", "Failed to initialize emulator."); + if(!set_size(WIDTH, HEIGHT, 0)) + return error("Window", "Failed to set window size."); + run(&u); quit(); return 0;