diff options
Diffstat (limited to 'main.lua')
-rw-r--r-- | main.lua | 19 |
1 files changed, 9 insertions, 10 deletions
@@ -7,7 +7,6 @@ local Mat4 = honey.Mat4 local Quaternion = honey.Quaternion local ecs = honey.ecs local sys = honey.standardSystems -local dispatch = sys.dispatch local ode = honey.ode local nvg = honey.nvg @@ -35,12 +34,12 @@ end) -- setup ecs local entities = ecs.EntityDb() local systems = ecs.SystemDb(entities) - -systems:addSystem(sys.node) -systems:addSystem(sys.renderCamera) -systems:addSystem(sys.script) -systems:addSystem(sys.collision, {space=space}) -systems:addSystem(sys.physics, {space=space, world=world}) +local script = ecs.script +systems:addSystem(ecs.node.system) +systems:addSystem(ecs.render.system) +systems:addSystem(ecs.script.system) +systems:addSystem(ecs.collision.system, {space=space}) +systems:addSystem(ecs.physics.system, {space=space, world=world}) package.loaded['baseRotationScript'] = function(entities, id, dt) local node = entities:getComponent(id, "node") node.matrix:rotateZ(math.pi * dt) @@ -299,7 +298,7 @@ setupEntities() -- close window on ESCAPE key window:setKeyCallback(function(_, key, scancode, action) - dispatch(entities, "onKey", {key=key, scancode=scancode, action=action}) + script.dispatch(entities, "onKey", {key=key, scancode=scancode, action=action}) if action == glfw.PRESS then if key == glfw.KEY_ESCAPE then window:setShouldClose(true) @@ -313,14 +312,14 @@ end) window:setCursorPosCallback(function(_, xpos, ypos) - dispatch(entities, "onCursorPos", {xpos=xpos, ypos=ypos}) + script.dispatch(entities, "onCursorPos", {xpos=xpos, ypos=ypos}) end) -- resize window correctly window:setFramebufferSizeCallback(function(_, width, height) gl.Viewport(0, 0, width, height) vw, vh = width, height - dispatch(entities, "onWindowResize", { width=width, height=height }) + script.dispatch(entities, "onWindowResize", { width=width, height=height }) end) package.loaded["cameraHandleResize"] = function(entities, id, data) |