about summary refs log tree commit diff stats
path: root/main.lua
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2022-05-25 12:59:12 -0700
committerKartik K. Agaram <vc@akkartik.com>2022-05-25 12:59:12 -0700
commitfa103ca2e8674dd389888d77f9ef60f361a0c704 (patch)
treef9aa4eb7a7d4ff588150614489e672e80b41753a /main.lua
parent299960553037fcaf93b545e85f7601b24c5975d8 (diff)
downloadtext.love-fa103ca2e8674dd389888d77f9ef60f361a0c704.tar.gz
couple more tests
Along with the App helpers needed for them.
Diffstat (limited to 'main.lua')
-rw-r--r--main.lua36
1 files changed, 19 insertions, 17 deletions
diff --git a/main.lua b/main.lua
index e2a0e95..ce411d6 100644
--- a/main.lua
+++ b/main.lua
@@ -12,12 +12,8 @@ local geom = require 'geom'
 require 'help'
 require 'icons'
 
-function App.initialize(arg)
-  love.keyboard.setTextInput(true)  -- bring up keyboard on touch screen
-  love.keyboard.setKeyRepeat(true)
-
--- globals
-
+-- run in both tests and a real run
+function App.initialize_globals()
 -- a line is either text or a drawing
 -- a text is a table with:
 --    mode = 'text'
@@ -61,17 +57,6 @@ Cursor1 = {line=1, pos=1}  -- position of cursor
 Screen_top1 = {line=1, pos=1}  -- position of start of screen line at top of screen
 Screen_bottom1 = {line=1, pos=1}  -- position of start of screen line at bottom of screen
 
--- maximize window
-love.window.setMode(0, 0)  -- maximize
-App.screen.width, App.screen.height = love.window.getMode()
--- shrink slightly to account for window decoration
-App.screen.width = App.screen.width-100
-App.screen.height = App.screen.height-100
-love.window.setMode(App.screen.width, App.screen.height)
---? App.screen.width = 120
---? App.screen.height = 200
---? love.window.setMode(App.screen.width, App.screen.height)
-
 Cursor_x, Cursor_y = 0, 0  -- in pixels
 
 Current_drawing_mode = 'line'
@@ -85,6 +70,23 @@ Zoom = 1.5
 
 Filename = love.filesystem.getUserDirectory()..'/lines.txt'
 
+end  -- App.initialize_globals
+
+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 = love.window.getMode()
+  -- shrink slightly to account for window decoration
+  App.screen.width = App.screen.width-100
+  App.screen.height = App.screen.height-100
+  love.window.setMode(App.screen.width, App.screen.height)
+--?   App.screen.width = 120
+--?   App.screen.height = 200
+--?   love.window.setMode(App.screen.width, App.screen.height)
+
   -- still in App.initialize
   if #arg > 0 then
     Filename = arg[1]