about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2022-07-13 09:31:54 -0700
committerKartik K. Agaram <vc@akkartik.com>2022-07-13 09:31:54 -0700
commite4f9d50a553f6ebd46e5505d46edbd945e821ae7 (patch)
treeb13de0e293924e5d0cb140cc9f50d81d5b1d9faf
parentd231f4d37d42ae6eeb14a27f5f3498ee80482fad (diff)
downloadtext.love-e4f9d50a553f6ebd46e5505d46edbd945e821ae7.tar.gz
a more radical attempt at ignoring nil y's
-rw-r--r--app.lua8
-rw-r--r--drawing.lua4
2 files changed, 5 insertions, 7 deletions
diff --git a/app.lua b/app.lua
index 2655ea0..ff6a7de 100644
--- a/app.lua
+++ b/app.lua
@@ -35,9 +35,7 @@ function love.run()
       end
     end
 
-    if love.timer then dt = love.timer.step() end
-
-    if App.update then App.update(dt) end -- will pass 0 if love.timer is disabled
+    -- perform draw before update to give it a chance to mutate state
 
     if love.graphics and love.graphics.isActive() then
       love.graphics.origin()
@@ -48,6 +46,10 @@ function love.run()
       love.graphics.present()
     end
 
+    if love.timer then dt = love.timer.step() end
+
+    if App.update then App.update(dt) end -- will pass 0 if love.timer is disabled
+
     if love.timer then love.timer.sleep(0.001) end
   end
 end
diff --git a/drawing.lua b/drawing.lua
index 38e62c3..587c24c 100644
--- a/drawing.lua
+++ b/drawing.lua
@@ -241,10 +241,6 @@ function Drawing.update(State)
   if State.lines.current_drawing == nil then return end
   local drawing = State.lines.current_drawing
   assert(drawing.mode == 'drawing')
-  if drawing.y == nil then
-    -- something invalidated all the y's; just wait for a draw
-    return
-  end
   local pmx, pmy = App.mouse_x(), App.mouse_y()
   local mx = Drawing.coord(pmx-State.left, State.width)
   local my = Drawing.coord(pmy-drawing.y, State.width)