summaryrefslogtreecommitdiff
path: root/src/main.zig
blob: a3cfd2fdee87e07f29d4408e26b3de2e7c459ea2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
const std = @import("std");
const rl = @cImport(@cInclude("raylib.h"));
const root = @import("root.zig");
const context = @import("context.zig");

pub fn main() !void {
    const win_width = 960;
    const win_height = 540;
    rl.InitWindow(win_width, win_height, "shipit");

    rl.SetTargetFPS(60);
    defer rl.CloseWindow();

    // Game State Initialization
    try root.setup();
    //
    //--------------------------------------------------------------------------------------

    // Main game loop
    while (!rl.WindowShouldClose()) {
        try root.update();
        try root.draw();
    }
}

test "simple test" {
    var list = std.ArrayList(i32).init(std.testing.allocator);
    defer list.deinit(); // try commenting this out and see if zig detects the memory leak!
    try list.append(42);
    try std.testing.expectEqual(@as(i32, 42), list.pop());
}