From 01a8b2a3d98f816b8b712a974f3d1e98f05152f5 Mon Sep 17 00:00:00 2001 From: sanine-a Date: Fri, 14 Apr 2023 15:44:38 -0500 Subject: implement loading/saving entity db --- main.lua | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'main.lua') diff --git a/main.lua b/main.lua index 16e27e6..30581fc 100644 --- a/main.lua +++ b/main.lua @@ -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) -- cgit v1.2.1