summaryrefslogtreecommitdiff
path: root/demo/main.lua
diff options
context:
space:
mode:
authorsanine-a <sanine.not@pm.me>2020-10-25 12:56:16 -0500
committersanine-a <sanine.not@pm.me>2020-10-25 12:56:16 -0500
commitc5874a0fc256a429b682f14344fca74fd0deab3a (patch)
tree81deeffab51f4cb30f74855066b4d92a87f406e2 /demo/main.lua
parent8dbfbdc929c2321f23b50754eda8fbcdba00ad03 (diff)
add basic cglm binding functions
Diffstat (limited to 'demo/main.lua')
-rw-r--r--demo/main.lua29
1 files changed, 29 insertions, 0 deletions
diff --git a/demo/main.lua b/demo/main.lua
index 46a9947..28e74b2 100644
--- a/demo/main.lua
+++ b/demo/main.lua
@@ -1,4 +1,5 @@
local fullscreen = false
+local cursor_mode = honey.input.mouse.mode.normal
local a_func = function(action, data)
if (action == 0) then return end
@@ -19,10 +20,38 @@ honey.window.set_title('honey engine demo')
honey.input.key.bind(honey.input.key.a, a_func)
honey.input.key.bind(honey.input.key.escape, honey.exit)
+honey.input.key.bind(
+ honey.input.key.c,
+ function(action)
+ local next_mode
+ if cursor_mode == honey.input.mouse.mode.normal then
+ next_mode = honey.input.mouse.mode.disabled
+ else
+ next_mode = honey.input.mouse.mode.normal
+ end
+
+ if action == 1 then
+ honey.input.mouse.set_mode(next_mode)
+ cursor_mode = next_mode
+ end
+ end
+)
honey.window.resize_bind(resize_func)
honey.input.mouse.set_mode( honey.input.mouse.mode.disabled )
honey.input.mouse.bind_movement(mousemove)
+function demo_cglm()
+ local array = honey.cglm.new_array_zero(3)
+ honey.cglm.set_value(array, 0, 0)
+ honey.cglm.set_value(array, 1, 5)
+ honey.cglm.set_value(array, 2, 2)
+ local x = honey.cglm.get_value(array, 0)
+ local y = honey.cglm.get_value(array, 1)
+ local z = honey.cglm.get_value(array, 2)
+
+ print(x, y, z)
+end
+demo_cglm()
local focus_func = function(focus)
print('focus:', focus)