Browse code

Fix blurry pixels on high-DPI displays

Creates the uxnemu window in high-DPI mode when supported. Now it looks
pixel perfect on a display with 2:1 pixel density.

Should have no effect on a 1:1 display, but I don't have access to one
to test this.

Liam Cooke authored on 29/01/2022 02:13:01 • neauoire committed on 04/02/2022 16:52:31
Showing 1 changed files
... ...
@@ -141,7 +141,7 @@ init(void)
141 141
 	as.userdata = NULL;
142 142
 	if(SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_JOYSTICK) < 0)
143 143
 		return error("sdl", SDL_GetError());
144
-	gWindow = SDL_CreateWindow("Uxn", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, (WIDTH + PAD * 2) * zoom, (HEIGHT + PAD * 2) * zoom, SDL_WINDOW_SHOWN);
144
+	gWindow = SDL_CreateWindow("Uxn", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, (WIDTH + PAD * 2) * zoom, (HEIGHT + PAD * 2) * zoom, SDL_WINDOW_SHOWN | SDL_WINDOW_ALLOW_HIGHDPI);
145 145
 	if(gWindow == NULL)
146 146
 		return error("sdl_window", SDL_GetError());
147 147
 	gRenderer = SDL_CreateRenderer(gWindow, -1, 0);