mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-08-02 14:57:31 +03:00
rendering a window
This commit is contained in:
2
src/glfw/glfw.zig
Normal file
2
src/glfw/glfw.zig
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
pub const c = @import("c.zig");
|
||||||
|
pub const errors = @import("errors.zig");
|
19
src/main.zig
19
src/main.zig
@ -1,7 +1,20 @@
|
|||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
const c = @import("glfw/c.zig");
|
const glfw = @import("glfw/glfw.zig");
|
||||||
|
|
||||||
pub fn main() !void {
|
pub fn main() !void {
|
||||||
if (c.glfwInit() != c.GLFW_TRUE) return error.GlfwInitFailed;
|
// Iniialize GLFW
|
||||||
defer c.glfwTerminate();
|
if (glfw.c.glfwInit() != glfw.c.GLFW_TRUE) return glfw.errors.getError();
|
||||||
|
defer glfw.c.glfwTerminate();
|
||||||
|
|
||||||
|
// Create our initial window
|
||||||
|
const window = glfw.c.glfwCreateWindow(640, 480, "My Title", null, null) orelse
|
||||||
|
return glfw.errors.getError();
|
||||||
|
defer glfw.c.glfwDestroyWindow(window);
|
||||||
|
|
||||||
|
// Setup OpenGL
|
||||||
|
glfw.c.glfwMakeContextCurrent(window);
|
||||||
|
|
||||||
|
while (glfw.c.glfwWindowShouldClose(window) == glfw.c.GLFW_FALSE) {
|
||||||
|
glfw.c.glfwWaitEvents();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user