about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2022-06-07 13:24:43 -0700
committerKartik K. Agaram <vc@akkartik.com>2022-06-07 13:24:43 -0700
commit4c0095ea46a162c6b06828755367979caaadddf1 (patch)
tree0a74322fae444cc6461531492850c77a53bdce03
parent33ea91f8d98aa299e536d5cd5f5b021b2081a3bf (diff)
downloadview.love-4c0095ea46a162c6b06828755367979caaadddf1.tar.gz
extract a function
-rw-r--r--main.lua25
1 files changed, 14 insertions, 11 deletions
diff --git a/main.lua b/main.lua
index e7b6429..db2cb32 100644
--- a/main.lua
+++ b/main.lua
@@ -85,16 +85,7 @@ function App.initialize(arg)
   love.keyboard.setTextInput(true)  -- bring up keyboard on touch screen
   love.keyboard.setKeyRepeat(true)
 
-  -- maximize window
-  love.window.setMode(0, 0)  -- maximize
-  App.screen.width, App.screen.height, App.screen.flags = love.window.getMode()
-  -- shrink slightly to account for window decoration
-  App.screen.width = App.screen.width-100
-  App.screen.height = App.screen.height-100
-  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)
-  love.window.updateMode(App.screen.width, App.screen.height, App.screen.flags)
+  initialize_window_geometry()
 
   initialize_font_settings(20)
 
@@ -110,9 +101,21 @@ function App.initialize(arg)
     end
   end
   love.window.setTitle('Text with Lines - '..Filename)
-
 end  -- App.initialize
 
+function initialize_window_geometry()
+  -- maximize window
+  love.window.setMode(0, 0)  -- maximize
+  App.screen.width, App.screen.height, App.screen.flags = love.window.getMode()
+  -- shrink slightly to account for window decoration
+  App.screen.width = App.screen.width-100
+  App.screen.height = App.screen.height-100
+  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)
+  love.window.updateMode(App.screen.width, App.screen.height, App.screen.flags)
+end
+
 function love.resize(w, h)
 --?   print(("Window resized to width: %d and height: %d."):format(w, h))
   App.screen.width, App.screen.height = w, h