From 2884f872d84046917919bc36ff5da9425b2a6399 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Fri, 15 Jul 2022 22:12:25 -0700 Subject: make test initializations a little more obvious --- main.lua | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'main.lua') 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 -- cgit 1.4.1-2-gfad0