about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2022-05-25 13:35:32 -0700
committerKartik K. Agaram <vc@akkartik.com>2022-05-25 13:35:32 -0700
commit442133fe7f629a825bbf30b05e29cc85b836c93c (patch)
tree7a15dfba5bf4e7762c8a19be33fa3371273861af
parentfa103ca2e8674dd389888d77f9ef60f361a0c704 (diff)
downloadlines.love-442133fe7f629a825bbf30b05e29cc85b836c93c.tar.gz
no, make sure to compute line width after screen dimensions
-rw-r--r--app.lua3
-rw-r--r--main.lua8
-rw-r--r--text.lua3
3 files changed, 8 insertions, 6 deletions
diff --git a/app.lua b/app.lua
index ffcb30e..311be18 100644
--- a/app.lua
+++ b/app.lua
@@ -14,6 +14,7 @@ function love.run()
   -- Tests always run at the start.
   App.run_tests()
 
+--?   print('==')
   App.disable_tests()
   if App.initialize_globals then App.initialize_globals() end
   if App.initialize then App.initialize(love.arg.parseGameArguments(arg), arg) end
@@ -42,7 +43,7 @@ function love.run()
       love.graphics.origin()
       love.graphics.clear(love.graphics.getBackgroundColor())
 
-      if App.draw then App:draw() end
+      if App.draw then App.draw() end
 
       love.graphics.present()
     end
diff --git a/main.lua b/main.lua
index ce411d6..1c3ef50 100644
--- a/main.lua
+++ b/main.lua
@@ -62,10 +62,6 @@ Cursor_x, Cursor_y = 0, 0  -- in pixels
 Current_drawing_mode = 'line'
 Previous_drawing_mode = nil
 
--- maximum width available to either text or drawings, in pixels
-Line_width = math.floor(App.screen.width/2/40)*40
---? Line_width = 100
-
 Zoom = 1.5
 
 Filename = love.filesystem.getUserDirectory()..'/lines.txt'
@@ -87,6 +83,10 @@ function App.initialize(arg)
 --?   App.screen.height = 200
 --?   love.window.setMode(App.screen.width, App.screen.height)
 
+  -- maximum width available to either text or drawings, in pixels
+  Line_width = math.floor(App.screen.width/2/40)*40
+--?   Line_width = 100
+
   -- still in App.initialize
   if #arg > 0 then
     Filename = arg[1]
diff --git a/text.lua b/text.lua
index 200ed64..5fbff05 100644
--- a/text.lua
+++ b/text.lua
@@ -641,7 +641,7 @@ function test_pageup_scrolls_up_from_middle_screen_line()
 end
 
 function Text.compute_fragments(line, line_width)
---?   print('compute_fragments')
+--?   print('compute_fragments', line_width)
   line.fragments = {}
   local x = 25
   -- try to wrap at word boundaries
@@ -1158,6 +1158,7 @@ function Text.previous_screen_line(pos2)
 end
 
 function Text.populate_screen_line_starting_pos(line_index)
+--?   print('Text.populate_screen_line_starting_pos')
   -- duplicate some logic from Text.draw
   local line = Lines[line_index]
   if line.fragments == nil then