Removed flickering on initial resize

This commit is contained in:
neauoire 2021-09-22 11:21:57 -07:00
parent 2822e598ed
commit 718a74641e
1 changed files with 9 additions and 8 deletions

View File

@ -598,23 +598,24 @@ main(int argc, char **argv)
/* unused */ uxn_port(&u, 0xe, nil_talk); /* unused */ uxn_port(&u, 0xe, nil_talk);
/* unused */ uxn_port(&u, 0xf, nil_talk); /* unused */ uxn_port(&u, 0xf, nil_talk);
if(!init()) /* set default zoom */
return error("Init", "Failed to initialize emulator.");
if(!set_size(WIDTH, HEIGHT, 0))
return error("Window", "Failed to set window size.");
/* default zoom */
SDL_GetCurrentDisplayMode(0, &DM); SDL_GetCurrentDisplayMode(0, &DM);
set_zoom(DM.w / 1000); zoom = clamp(DM.w / 1280, 1, 3);
/* zoom from flags */ /* get default zoom from flags */
for(i = 1; i < argc - 1; i++) { for(i = 1; i < argc - 1; i++) {
if(strcmp(argv[i], "-s") == 0) { if(strcmp(argv[i], "-s") == 0) {
if((i + 1) < argc - 1) if((i + 1) < argc - 1)
set_zoom(atoi(argv[++i])); zoom = clamp(atoi(argv[++i]), 1, 3);
else else
return error("Opt", "-s No scale provided."); 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); run(&u);
quit(); quit();
return 0; return 0;