uxn

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

commit eeeeb905429542d931efd20a4896915fbcbbac86
parent 45a7941d7dd18609a8d02923545c589e46b891a5
Author: neauoire <aliceffekt@gmail.com>
Date:   Wed, 22 Sep 2021 10:42:17 -0700

Wait for textures and size before default zoom

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

diff --git a/src/uxnemu.c b/src/uxnemu.c @@ -245,9 +245,8 @@ quit(void) } static int -init(Uxn *u) +init(void) { - SDL_DisplayMode DM; SDL_AudioSpec as; SDL_zero(as); as.freq = SAMPLE_FREQUENCY; @@ -276,8 +275,6 @@ init(Uxn *u) SDL_CreateThread(stdin_handler, "stdin", NULL); SDL_StartTextInput(); SDL_ShowCursor(SDL_DISABLE); - SDL_GetCurrentDisplayMode(0, &DM); - set_zoom(u, DM.w / 1000); return 1; } @@ -574,6 +571,7 @@ load(Uxn *u, char *filepath) int main(int argc, char **argv) { + SDL_DisplayMode DM; Uxn u; int i; @@ -601,11 +599,14 @@ main(int argc, char **argv) /* unused */ uxn_port(&u, 0xe, nil_talk); /* unused */ uxn_port(&u, 0xf, nil_talk); - if(!init(&u)) + 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 */ + SDL_GetCurrentDisplayMode(0, &DM); + set_zoom(&u, DM.w / 1000); + /* zoom from flags */ for(i = 1; i < argc - 1; i++) { if(strcmp(argv[i], "-s") == 0) { if((i + 1) < argc - 1)