Add 'package-glfw/' from commit 'a8f2a899cdd0bb4316b7d50f2ee3296bf6fb208f'

git-subtree-dir: package-glfw
git-subtree-mainline: cddb3ce509
git-subtree-split: a8f2a899cd
This commit is contained in:
2025-08-04 22:14:49 -04:00
5 changed files with 154 additions and 0 deletions

25
package-glfw/src/main.zig Normal file
View File

@@ -0,0 +1,25 @@
const std = @import("std");
const c = @cImport({
@cInclude("GLFW/glfw3.h");
});
pub fn main() !void {
if (c.glfwInit() == 0) {
@panic("GLFW Initialization failed");
}
defer c.glfwTerminate();
// todo error callback
const win = c.glfwCreateWindow(640, 480, "Hello Zig!", null, null);
if (win == null) {
@panic("GLFW window creation failed");
}
defer c.glfwDestroyWindow(win);
while (c.glfwWindowShouldClose(win) == 0) {
c.glfwPollEvents();
c.glfwSwapBuffers(win);
}
}