From 00ba7afac443b2d289918c848213def79d0094a3 Mon Sep 17 00:00:00 2001 From: Rekai Musuka Date: Fri, 21 Oct 2022 05:11:54 -0300 Subject: [PATCH] chore: remove some magic constants --- src/main.zig | 7 +++++-- src/ppu.zig | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/main.zig b/src/main.zig index abe4e02..c58106c 100644 --- a/src/main.zig +++ b/src/main.zig @@ -8,6 +8,9 @@ const Scheduler = @import("scheduler.zig").Scheduler; const Timer = std.time.Timer; +const window_scale = 3; +const gba_width = @import("ppu.zig").width; +const gba_height = @import("ppu.zig").height; const buf_pitch = @import("ppu.zig").buf_pitch; pub fn main() anyerror!void { @@ -49,8 +52,8 @@ pub fn main() anyerror!void { "Gameboy Advance Emulator", SDL.SDL_WINDOWPOS_CENTERED, SDL.SDL_WINDOWPOS_CENTERED, - 240 * 3, - 160 * 3, + gba_width * window_scale, + gba_height * window_scale, SDL.SDL_WINDOW_SHOWN, ) orelse sdlPanic(); defer SDL.SDL_DestroyWindow(window); diff --git a/src/ppu.zig b/src/ppu.zig index ac2c72e..f480c87 100644 --- a/src/ppu.zig +++ b/src/ppu.zig @@ -5,8 +5,8 @@ const Io = @import("bus/io.zig").Io; const Scheduler = @import("scheduler.zig").Scheduler; const Allocator = std.mem.Allocator; -const width = 240; -const height = 160; +pub const width = 240; +pub const height = 160; pub const buf_pitch = width * @sizeOf(u16); const buf_len = buf_pitch * height;