summaryrefslogtreecommitdiff
path: root/honey.bak/init.lua
diff options
context:
space:
mode:
authorsanine-a <sanine.not@pm.me>2023-03-28 16:35:22 -0500
committersanine-a <sanine.not@pm.me>2023-03-28 16:35:22 -0500
commit45dbe47d17303050cbea7c2c51e838acfe21c2fb (patch)
treec2827c7aae6cf29286766209af942f16f91ee4c8 /honey.bak/init.lua
parentd1c2a881f55b80603f6a7772a2c32394d23e795a (diff)
add cached mesh loading
Diffstat (limited to 'honey.bak/init.lua')
-rw-r--r--honey.bak/init.lua48
1 files changed, 48 insertions, 0 deletions
diff --git a/honey.bak/init.lua b/honey.bak/init.lua
new file mode 100644
index 0000000..6cf8801
--- /dev/null
+++ b/honey.bak/init.lua
@@ -0,0 +1,48 @@
+local glfw = honey.glfw
+local gl = honey.gl
+local window = require 'honey.window'
+
+local module = {}
+setmetatable(module, {__index=_G})
+setfenv(1, module)
+
+
+function init(width, height, title)
+ local width = width or 640
+ local height = height or 480
+ local title = title or "honey3d"
+
+ glfw.Init()
+ glfw.WindowHint(glfw.OPENGL_PROFILE, glfw.OPENGL_CORE_PROFILE)
+ glfw.WindowHint(glfw.CONTEXT_VERSION_MAJOR, 4)
+ glfw.WindowHint(glfw.CONTEXT_VERSION_MINOR, 1)
+ local window = honey.Window(width, height, title)
+ glfw.MakeContextCurrent(window.win)
+ gl.InitGlad()
+ gl.Enable(gl.DEPTH_TEST)
+
+ honey.ode.InitODE()
+
+ return window
+end
+
+
+function loop(window, update)
+ local prevTime = 0
+ while not window:shouldClose() do
+ local time = glfw.GetTime()
+ local dt = time - prevTime
+ prevTime = time
+ update(dt)
+ window:swapBuffers()
+ glfw.PollEvents()
+ end
+end
+
+
+function terminate()
+ glfw.Terminate()
+end
+
+
+return module