about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2023-03-18 23:48:42 -0700
committerKartik K. Agaram <vc@akkartik.com>2023-03-18 23:48:42 -0700
commit1b90ffca9ef5d3c1b47808841bcf20c55a73cb4d (patch)
tree671bb76a917f28804a957e410d6cfdc58f02e741
parente8d6a8a26d435ee73dae93d97c91811f9ab4908b (diff)
downloadtext.love-1b90ffca9ef5d3c1b47808841bcf20c55a73cb4d.tar.gz
extract a function
-rw-r--r--source.lua24
1 files changed, 14 insertions, 10 deletions
diff --git a/source.lua b/source.lua
index 5c8bb82..0fdd7f6 100644
--- a/source.lua
+++ b/source.lua
@@ -105,16 +105,7 @@ end
 function source.load_settings()
   local settings = Settings.source
   love.graphics.setFont(love.graphics.newFont(settings.font_height))
-  -- maximize window to determine maximum allowable dimensions
-  App.screen.resize(0, 0)  -- maximize
-  Display_width, Display_height, App.screen.flags = App.screen.size()
-  -- set up desired window dimensions
-  App.screen.flags.resizable = true
-  App.screen.flags.minwidth = math.min(Display_width, 200)
-  App.screen.flags.minheight = math.min(Display_height, 200)
-  App.screen.width, App.screen.height = settings.width, settings.height
---?   print('setting window from settings:', App.screen.width, App.screen.height)
-  App.screen.resize(App.screen.width, App.screen.height, App.screen.flags)
+  source.resize_window_from_settings(settings)
 --?   print('loading source position', settings.x, settings.y, settings.displayindex)
   source.set_window_position_from_settings(settings)
   Show_log_browser_side = settings.show_log_browser_side
@@ -136,6 +127,19 @@ function source.load_settings()
   end
 end
 
+function source.resize_window_from_settings(settings)
+  -- maximize window to determine maximum allowable dimensions
+  App.screen.resize(0, 0)  -- maximize
+  Display_width, Display_height, App.screen.flags = App.screen.size()
+  -- set up desired window dimensions
+  App.screen.flags.resizable = true
+  App.screen.flags.minwidth = math.min(Display_width, 200)
+  App.screen.flags.minheight = math.min(Display_height, 200)
+  App.screen.width, App.screen.height = settings.width, settings.height
+--?   print('setting window from settings:', App.screen.width, App.screen.height)
+  App.screen.resize(App.screen.width, App.screen.height, App.screen.flags)
+end
+
 function source.set_window_position_from_settings(settings)
   -- love.window.setPosition doesn't quite seem to do what is asked of it on Linux.
   App.screen.move(settings.x, settings.y-37, settings.displayindex)