diff options
author | sanine-a <sanine.not@pm.me> | 2023-05-09 14:46:08 -0500 |
---|---|---|
committer | sanine-a <sanine.not@pm.me> | 2023-05-09 14:46:08 -0500 |
commit | 9c9690ab5e4ecb484ee130c21f1767785908bd10 (patch) | |
tree | 847d7868a25936b1e632caac2b581b2c90d0eee0 /honey/window.lua | |
parent | fe6564d8c31662d4d2c2606c62ba6d4416c6b6a6 (diff) |
fix texture loading
Diffstat (limited to 'honey/window.lua')
-rw-r--r-- | honey/window.lua | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/honey/window.lua b/honey/window.lua index 3b5d5c1..e2b9fb2 100644 --- a/honey/window.lua +++ b/honey/window.lua @@ -1,3 +1,5 @@ +local ecs = require 'honey.ecs' + local module = {} local glfw = honey.glfw setmetatable(module, {__index=_G}) @@ -165,4 +167,17 @@ function Window.swapBuffers(self) end +function Window.bindEvents(self, db) + self:setCursorPosCallback(function(_, xpos, ypos) + ecs.script.dispatch(db, "onCursorPos", {window=self, xpos=xpos, ypos=ypos}) + end) + self:setKeyCallback(function(_, key, scancode, action) + ecs.script.dispatch(db, "onKey", {window=self, key=key, scancode=scancode, action=action}) + end) + self:setFramebufferSizeCallback(function(_, width, height) + ecs.script.dispatch(db, "onFramebufferSize", {window=self, width=width, height=height}) + end) +end + + return module.Window |