diff options
author | sanine-a <sanine.not@pm.me> | 2023-05-12 15:06:13 -0500 |
---|---|---|
committer | sanine-a <sanine.not@pm.me> | 2023-05-12 15:06:13 -0500 |
commit | 759db92cf135aba21f0cbd17073d2f2e294fdf4d (patch) | |
tree | 8f0c875217ef2434d898c6c8df1775340f93a986 /honey/ecs | |
parent | 0d96ebc90c9740e7e66a70aa11168b11f49d220b (diff) |
add nice builtin shaders
Diffstat (limited to 'honey/ecs')
-rw-r--r-- | honey/ecs/script.lua | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/honey/ecs/script.lua b/honey/ecs/script.lua index 46af4fa..a9b7644 100644 --- a/honey/ecs/script.lua +++ b/honey/ecs/script.lua @@ -1,3 +1,5 @@ +local glfw = honey.glfw + local ecs = require 'honey.ecs.ecs' local node = require 'honey.ecs.node' @@ -27,6 +29,26 @@ dispatch = function(db, msg, data) end end +--===== bind window events to script handlers =====-- + +bindEvents = function(window, db) + glfw.SetFramebufferSizeCallback(window, function(w, width, height) + dispatch(db, "onFramebufferSize", {window=w, width=width, height=height}) + end) + + glfw.SetKeyCallback(window, function(w, key, scancode, action, mods) + dispatch(db, "onKey", {window=w, key=key, scancode=scancode, action=action, mods=mods}) + end) + + glfw.SetCursorPosCallback(window, function(w, xpos, ypos) + dispatch(db, "onCursorPos", {window=w, xpos=xpos, ypos=ypos}) + end) + + glfw.SetMouseButtonCallback(window, function(w, button, action, mods) + dispatch(db, "onMouseButton", {window=w, button=button, action=action, mods=mods}) + end) +end + --===== script system =====-- local script = ecs.System("script", function(db, dt, params) |