chore: rename heap variable to alloc in main.zig
This commit is contained in:
		
							
								
								
									
										12
									
								
								src/main.zig
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								src/main.zig
									
									
									
									
									
								
							@@ -17,17 +17,17 @@ const WINDOW_HEIGHT = CHIP8_HEIGHT * display.SCALE;
 | 
			
		||||
const PIXELBUF_LEN = display.PIXELBUF_LEN;
 | 
			
		||||
 | 
			
		||||
pub fn main() anyerror!void {
 | 
			
		||||
    const heap = std.heap.page_allocator;
 | 
			
		||||
    const alloc = std.heap.page_allocator;
 | 
			
		||||
    var arg_it = std.process.args();
 | 
			
		||||
 | 
			
		||||
    // Skip process name
 | 
			
		||||
    _ = arg_it.skip();
 | 
			
		||||
 | 
			
		||||
    const os_string = try arg_it.next(heap) orelse {
 | 
			
		||||
    const os_string = try arg_it.next(alloc) orelse {
 | 
			
		||||
        std.debug.warn("Expected first argument to be path to CHIP-8 rom\n", .{});
 | 
			
		||||
        return;
 | 
			
		||||
    };
 | 
			
		||||
    const rom_path = try std.fs.path.resolve(heap, &[_][]const u8{os_string});
 | 
			
		||||
    const rom_path = try std.fs.path.resolve(alloc, &[_][]const u8{os_string});
 | 
			
		||||
 | 
			
		||||
    if (SDL.SDL_Init(SDL.SDL_INIT_VIDEO | SDL.SDL_INIT_EVENTS | SDL.SDL_INIT_AUDIO) < 0) {
 | 
			
		||||
        sdlPanic();
 | 
			
		||||
@@ -35,7 +35,7 @@ pub fn main() anyerror!void {
 | 
			
		||||
    defer SDL.SDL_Quit();
 | 
			
		||||
 | 
			
		||||
    const window = SDL.SDL_CreateWindow(
 | 
			
		||||
        "Zig CHIP-8 Emulator",
 | 
			
		||||
        "CHIP-8 Emulator",
 | 
			
		||||
        SDL.SDL_WINDOWPOS_CENTERED,
 | 
			
		||||
        SDL.SDL_WINDOWPOS_CENTERED,
 | 
			
		||||
        WINDOW_WIDTH,
 | 
			
		||||
@@ -52,8 +52,8 @@ pub fn main() anyerror!void {
 | 
			
		||||
 | 
			
		||||
    var pixels: [PIXELBUF_LEN]u8 = [_]u8{0x00} ** PIXELBUF_LEN;
 | 
			
		||||
 | 
			
		||||
    var scheduler = Scheduler.new(heap, &pixels);
 | 
			
		||||
    var chip8 = try Chip8.fromFile(heap, &scheduler, rom_path);
 | 
			
		||||
    var scheduler = Scheduler.new(alloc, &pixels);
 | 
			
		||||
    var chip8 = try Chip8.fromFile(alloc, &scheduler, rom_path);
 | 
			
		||||
 | 
			
		||||
    const frametime = 1_000_000_000 / OPS_PER_HZ;
 | 
			
		||||
    var timer = Timer.start() catch unreachable;
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user