From 9c9690ab5e4ecb484ee130c21f1767785908bd10 Mon Sep 17 00:00:00 2001 From: sanine-a Date: Tue, 9 May 2023 14:46:08 -0500 Subject: fix texture loading --- honey/window.lua | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'honey/window.lua') 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 -- cgit v1.2.1