diff options
author | sanine-a <sanine.not@pm.me> | 2023-04-14 15:44:38 -0500 |
---|---|---|
committer | sanine-a <sanine.not@pm.me> | 2023-04-14 15:44:38 -0500 |
commit | 01a8b2a3d98f816b8b712a974f3d1e98f05152f5 (patch) | |
tree | 742c9375bd533c45f8ebd01278c336177ae614ab /main.lua | |
parent | 64194866e9a1d6991efc9f44a0e3075905ab6470 (diff) |
implement loading/saving entity db
Diffstat (limited to 'main.lua')
-rw-r--r-- | main.lua | 13 |
1 files changed, 10 insertions, 3 deletions
@@ -43,7 +43,7 @@ entities:addComponents(camera, { transform={ matrix=Mat4():identity():translate(Vec3{0, 0, -6}), }, - z = {value=-6}, + z = {value=-60}, script={ script="cameraRotationScript", }, @@ -93,8 +93,8 @@ entities:addComponents(id, { density = 1, radius = 1, }, - velocity = Vec3{ 0, 0, 0 }, - angularVelocity = Vec3{ 0, 0, 0 }, + velocity = Vec3{ 0, 10, 0 }, + angularVelocity = Vec3{ 0, 1, 0 }, }, }) @@ -118,6 +118,9 @@ window:setKeyCallback(function(_, key, scancode, action) if action == glfw.PRESS then if key == glfw.KEY_ESCAPE then window:setShouldClose(true) + elseif key == glfw.KEY_SPACE then + entities:save("save") + elseif key == glfw.KEY_L then end end end) @@ -150,6 +153,10 @@ end local fpsAverage = averager(200) + +entities:load("save") + + -- main loop honey.loop(window, function(dt) gl.ClearColor(0.2, 0.4, 1.0, 1.0) |