-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
474d72b
commit 3f1786b
Showing
7 changed files
with
169 additions
and
375 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
const std = @import("std"); | ||
const win = @import("window.zig"); | ||
const render = @import("render.zig"); | ||
|
||
const AppError = error{ | ||
WindowCreationError, | ||
RendererCreationError, | ||
}; | ||
|
||
pub fn main() AppError!void { | ||
var gpa = std.heap.GeneralPurposeAllocator(.{}){}; | ||
const allocator = gpa.allocator(); | ||
|
||
const window = win.create(allocator, .{ | ||
.title = "Phy", | ||
.width = 800, | ||
.height = 600, | ||
}) catch { | ||
std.debug.print("Failed to create App window\n", .{}); | ||
return error.WindowCreationError; | ||
}; | ||
|
||
defer allocator.destroy(window); | ||
defer window.deinit(); | ||
|
||
const renderer = render.create(allocator) catch { | ||
std.debug.print("Failed to create App renderer\n", .{}); | ||
return error.RendererCreationError; | ||
}; | ||
|
||
defer allocator.destroy(renderer); | ||
|
||
while (!window.shouldClose()) { | ||
window.pollEvents(); | ||
|
||
renderer.clearColor(.{ | ||
.r = 0.2, | ||
.g = 0.3, | ||
.b = 0.3, | ||
.a = 1.0, | ||
}); | ||
|
||
window.swapBuffers(); | ||
} | ||
} |
Oops, something went wrong.