浏览代码

Automagically determine ideal integer scale

master
Nathaniel Walizer 11 个月前
父节点
当前提交
3b3f457634
共有 1 个文件被更改,包括 10 次插入2 次删除
  1. +10
    -2
      src/sdl_render.c

+ 10
- 2
src/sdl_render.c 查看文件

@@ -57,12 +57,20 @@ static int sdl_render_init(nes_Renderer* rend) {
fprintf(stderr, "SDL: Failed to initialize\n");

} 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(
"NESe",
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
);
if (NULL == data->window) {


正在加载...
取消
保存