about summary refs log tree commit diff stats
path: root/main.lua
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2022-07-15 22:12:25 -0700
committerKartik K. Agaram <vc@akkartik.com>2022-07-15 22:12:25 -0700
commit2884f872d84046917919bc36ff5da9425b2a6399 (patch)
tree92b81d1f7189f27d56553c3345186612377b4c3a /main.lua
parentfc6b602342beba3dc9ebef8748470018be6652a8 (diff)
downloadtext.love-2884f872d84046917919bc36ff5da9425b2a6399.tar.gz
make test initializations a little more obvious
Diffstat (limited to 'main.lua')
-rw-r--r--main.lua13
1 files changed, 4 insertions, 9 deletions
diff --git a/main.lua b/main.lua
index a15ab41..32eaaa5 100644
--- a/main.lua
+++ b/main.lua
@@ -71,24 +71,19 @@ function App.initialize(arg)
 end
 
 function load_settings()
+  local settings = json.decode(love.filesystem.read('config'))
+  love.graphics.setFont(love.graphics.newFont(settings.font_height))
   -- maximize window to determine maximum allowable dimensions
-  love.window.setMode(0, 0)  -- maximize
   App.screen.width, App.screen.height, App.screen.flags = love.window.getMode()
-  --
-  local settings = json.decode(love.filesystem.read('config'))
+  -- set up desired window dimensions
   love.window.setPosition(settings.x, settings.y, settings.displayindex)
-  App.screen.width, App.screen.height, App.screen.flags = love.window.getMode()
   App.screen.flags.resizable = true
   App.screen.flags.minwidth = math.min(App.screen.width, 200)
   App.screen.flags.minheight = math.min(App.screen.width, 200)
   App.screen.width, App.screen.height = settings.width, settings.height
   love.window.setMode(App.screen.width, App.screen.height, App.screen.flags)
-  Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width-Margin_right)
+  Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width-Margin_right, settings.font_height, math.floor(settings.font_height*1.3))
   Editor_state.filename = settings.filename
-  Editor_state.font_height = settings.font_height
-  love.graphics.setFont(love.graphics.newFont(Editor_state.font_height))
-  Editor_state.line_height = math.floor(Editor_state.font_height*1.3)
-  Editor_state.em = App.newText(love.graphics.getFont(), 'm')
   Editor_state.screen_top1 = settings.screen_top
   Editor_state.cursor1 = settings.cursor
 end