chore: remove some magic constants

This commit is contained in:
Rekai Nyangadzayi Musuka 2022-01-12 00:46:20 -04:00
parent 3596caf106
commit 769c67b9d4
2 changed files with 7 additions and 4 deletions

View File

@ -8,6 +8,9 @@ const Scheduler = @import("scheduler.zig").Scheduler;
const Timer = std.time.Timer; 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; const buf_pitch = @import("ppu.zig").buf_pitch;
pub fn main() anyerror!void { pub fn main() anyerror!void {
@ -49,8 +52,8 @@ pub fn main() anyerror!void {
"Gameboy Advance Emulator", "Gameboy Advance Emulator",
SDL.SDL_WINDOWPOS_CENTERED, SDL.SDL_WINDOWPOS_CENTERED,
SDL.SDL_WINDOWPOS_CENTERED, SDL.SDL_WINDOWPOS_CENTERED,
240 * 3, gba_width * window_scale,
160 * 3, gba_height * window_scale,
SDL.SDL_WINDOW_SHOWN, SDL.SDL_WINDOW_SHOWN,
) orelse sdlPanic(); ) orelse sdlPanic();
defer SDL.SDL_DestroyWindow(window); defer SDL.SDL_DestroyWindow(window);

View File

@ -5,8 +5,8 @@ const Io = @import("bus/io.zig").Io;
const Scheduler = @import("scheduler.zig").Scheduler; const Scheduler = @import("scheduler.zig").Scheduler;
const Allocator = std.mem.Allocator; const Allocator = std.mem.Allocator;
const width = 240; pub const width = 240;
const height = 160; pub const height = 160;
pub const buf_pitch = width * @sizeOf(u16); pub const buf_pitch = width * @sizeOf(u16);
const buf_len = buf_pitch * height; const buf_len = buf_pitch * height;