| @@ -57,12 +57,20 @@ static int sdl_render_init(nes_Renderer* rend) { | |||||
| fprintf(stderr, "SDL: Failed to initialize\n"); | fprintf(stderr, "SDL: Failed to initialize\n"); | ||||
| } else { | } else { | ||||
| SDL_DisplayMode mode = {0}; | |||||
| SDL_GetCurrentDisplayMode(0, &mode); | |||||
| int yscale = (mode.h - 1) / nes_ppu_scan_h; | |||||
| int xscale = mode.w / nes_ppu_scan_w; | |||||
| int scale = (xscale < yscale ? xscale : yscale); | |||||
| data->window = SDL_CreateWindow( | data->window = SDL_CreateWindow( | ||||
| "NESe", | "NESe", | ||||
| SDL_WINDOWPOS_UNDEFINED, | SDL_WINDOWPOS_UNDEFINED, | ||||
| SDL_WINDOWPOS_UNDEFINED, | SDL_WINDOWPOS_UNDEFINED, | ||||
| nes_ppu_scan_w * 4, | |||||
| nes_ppu_scan_h * 4, | |||||
| nes_ppu_scan_w * scale, | |||||
| nes_ppu_scan_h * scale, | |||||
| 0 | 0 | ||||
| ); | ); | ||||
| if (NULL == data->window) { | if (NULL == data->window) { | ||||