summaryrefslogtreecommitdiff
path: root/demo/vector
diff options
context:
space:
mode:
authorsanine <sanine.not@pm.me>2023-03-12 00:12:39 -0600
committersanine <sanine.not@pm.me>2023-03-12 00:12:39 -0600
commitb2f8ef6dad8925b43b87015e2c10b12f10a2f415 (patch)
treeeca64efe16963e7a861a6da551fc48a1c5acf3e3 /demo/vector
parent13745925df1c7ba12fb0cbe80e36fa0681a89b5e (diff)
remove glfw binds from opengl
Diffstat (limited to 'demo/vector')
-rw-r--r--demo/vector/common.lua28
-rw-r--r--demo/vector/main.lua6
2 files changed, 17 insertions, 17 deletions
diff --git a/demo/vector/common.lua b/demo/vector/common.lua
index 7ddd487..4ae36f9 100644
--- a/demo/vector/common.lua
+++ b/demo/vector/common.lua
@@ -1,15 +1,15 @@
honey.run = function()
local gl = honey.gl
- local window = honey.window
+ local glfw = honey.glfw
-- initialize opengl
- gl.Init()
- window.setHint(window.hintType.contextVersionMajor, 3)
- window.setHint(window.hintType.contextVersionMinor, 3)
+ glfw.Init()
+ --window.setHint(window.hintType.contextVersionMajor, 3)
+ --window.setHint(window.hintType.contextVersionMinor, 3)
- local win = window.create(640, 480, 'first person demo')
- honey.window.win = win
- window.makeContextCurrent(win)
+ local win = glfw.CreateWindow(640, 480, 'honey3d', glfw.monitor_NULL, glfw.window_NULL)
+ glfw.MakeContextCurrent(win)
+ glfw.win = win
gl.InitGlad()
gl.Enable(gl.DEPTH_TEST)
@@ -17,7 +17,7 @@ honey.run = function()
honey.init()
end
- window.setFramebufferSizeCallback(win, function(_, width, height)
+ glfw.SetFramebufferSizeCallback(win, function(_, width, height)
if honey.windowSizeCallback then
honey.windowSizeCallback(width, height)
end
@@ -25,13 +25,13 @@ honey.run = function()
local time = 0
drawTime = 1/60
- while not window.shouldClose(win) do
- local t = window.getTime()
+ while glfw.WindowShouldClose(win) == glfw.FALSE do
+ local t = glfw.GetTime()
local dt = t-time
time = t
honey.update(dt)
- window.pollEvents()
+ glfw.PollEvents()
if time > drawTime then
if honey.clearColor then
@@ -46,13 +46,13 @@ honey.run = function()
end
gl.Clear(gl.COLOR_BUFFER_BIT + gl.DEPTH_BUFFER_BIT)
honey.draw()
- window.swapBuffers(win)
+ glfw.SwapBuffers(win)
drawTime = drawTime + 1/60
end
end
- window.destroy(win)
- gl.Terminate()
+ --window.destroy(win)
+ glfw.Terminate()
end
diff --git a/demo/vector/main.lua b/demo/vector/main.lua
index 2b29999..28090c6 100644
--- a/demo/vector/main.lua
+++ b/demo/vector/main.lua
@@ -1,6 +1,6 @@
require 'common'
-local window = honey.window
+local glfw = honey.glfw
local nvg = honey.nvg
@@ -17,8 +17,8 @@ end
local time = 0
local frames = 0
function honey.update(dt)
- if window.getKey(window.win, window.KEY_ESCAPE) == window.PRESS then
- window.setShouldClose(honey.window.win, true)
+ if glfw.GetKey(glfw.win, glfw.KEY_ESCAPE) == glfw.PRESS then
+ glfw.SetWindowShouldClose(glfw.win, true)
end
time = time + dt