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 --- scripts/cameraHandleResize.lua | 6 ++++++ scripts/loadSaveQuit.lua | 13 +++++++++++++ scripts/viewportResize.lua | 3 +++ 3 files changed, 22 insertions(+) create mode 100644 scripts/cameraHandleResize.lua create mode 100644 scripts/loadSaveQuit.lua create mode 100644 scripts/viewportResize.lua (limited to 'scripts') diff --git a/scripts/cameraHandleResize.lua b/scripts/cameraHandleResize.lua new file mode 100644 index 0000000..7d1713d --- /dev/null +++ b/scripts/cameraHandleResize.lua @@ -0,0 +1,6 @@ +return function(entities, id, data) + local camera = entities:getComponent(id, "camera") + if camera then + camera.projection:perspectiveResize(data.width/data.height) + end +end diff --git a/scripts/loadSaveQuit.lua b/scripts/loadSaveQuit.lua new file mode 100644 index 0000000..8d5f353 --- /dev/null +++ b/scripts/loadSaveQuit.lua @@ -0,0 +1,13 @@ +local glfw = honey.glfw + +return function(entities, id, data) + if data.action == glfw.PRESS then + if data.key == glfw.KEY_ESCAPE then + data.window:setShouldClose(true) + elseif data.key == glfw.KEY_SPACE then + entities:save("save") + elseif data.key == glfw.KEY_L then + entities:load("save") + end + end +end diff --git a/scripts/viewportResize.lua b/scripts/viewportResize.lua new file mode 100644 index 0000000..4b43d29 --- /dev/null +++ b/scripts/viewportResize.lua @@ -0,0 +1,3 @@ +return function(entities, id, data) + honey.gl.Viewport(0, 0, data.width, data.height) +end -- cgit v1.2.1