summaryrefslogtreecommitdiff
path: root/demo/basic
diff options
context:
space:
mode:
authorsanine <sanine.not@pm.me>2023-03-10 02:05:18 -0600
committersanine <sanine.not@pm.me>2023-03-10 02:05:18 -0600
commit51c7235d4e0a2df109dd5050328a0ad4a1878ae4 (patch)
tree201b065e93bf6a35d2bab0e49bcd32f7a971da94 /demo/basic
parent5bb783912ac384156b8abbe6e83a5a61da73881d (diff)
refactor: move glfw functions into separate table
Diffstat (limited to 'demo/basic')
-rw-r--r--demo/basic/main.lua19
1 files changed, 19 insertions, 0 deletions
diff --git a/demo/basic/main.lua b/demo/basic/main.lua
new file mode 100644
index 0000000..0950690
--- /dev/null
+++ b/demo/basic/main.lua
@@ -0,0 +1,19 @@
+local glfw = honey.glfw
+
+local err = glfw.Init()
+print(err, glfw.TRUE)
+if err ~= glfw.TRUE then
+ local err, desc = glfw.GetError()
+ error("failed to initialize glfw: " .. tostring(err))
+end
+
+local window = glfw.CreateWindow(640, 480, "Hello world c:", nil, nil)
+
+glfw.MakeContextCurrent(window)
+while (glfw.WindowShouldClose(window) ~= glfw.FALSE) do
+ gl.Clear(gl.COLOR_BUFFER_BIT)
+ glfw.SwapBUffers(window)
+ glfw.PollEvents()
+end
+
+glfw.Terminate()