about summary refs log tree commit diff stats
path: root/main.lua
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2022-06-30 22:15:07 -0700
committerKartik K. Agaram <vc@akkartik.com>2022-06-30 22:20:16 -0700
commitb40dab67f22e4b9957769367d682a92e4bd981cf (patch)
treeeec8922f358c4d461c5589759416eba48a030a1f /main.lua
parent2025172e525ab8e40433989cee6833550937b3c7 (diff)
downloadtext.love-b40dab67f22e4b9957769367d682a92e4bd981cf.tar.gz
start saving some settings to disk on quit
We're still not reading them anywhere.
Diffstat (limited to 'main.lua')
-rw-r--r--main.lua9
1 files changed, 8 insertions, 1 deletions
diff --git a/main.lua b/main.lua
index 9e0f886..3898bc1 100644
--- a/main.lua
+++ b/main.lua
@@ -264,11 +264,18 @@ function schedule_save()
   end
 end
 
--- make sure to save before quitting
 function love.quit()
+  -- make sure to save before quitting
   if Next_save then
     save_to_disk(Lines, Filename)
   end
+  -- save some important settings
+  local x,y,displayindex = love.window.getPosition()
+  local settings = {
+    x=x, y=y, displayindex=displayindex,
+    width=App.screen.width, height=App.screen.height,
+    font_height=Font_height, filename=Filename, screen_top=Screen_top1, cursor=Cursor1}
+  love.filesystem.write('config', json.encode(settings))
 end
 
 function App.mousepressed(x,y, mouse_button)