about summary refs log tree commit diff stats
path: root/main.lua
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2022-07-12 13:45:38 -0700
committerKartik K. Agaram <vc@akkartik.com>2022-07-12 13:45:38 -0700
commita5f725ab3b860b22199036f7ab0d0a0193a5a6ac (patch)
tree7878116a62406649b1237665ce7b0816b8a888c5 /main.lua
parent094f3bd7e89ada36ddef8845770de21e71977954 (diff)
downloadlines.love-a5f725ab3b860b22199036f7ab0d0a0193a5a6ac.tar.gz
bring couple more globals back to the app level
Diffstat (limited to 'main.lua')
-rw-r--r--main.lua22
1 files changed, 21 insertions, 1 deletions
diff --git a/main.lua b/main.lua
index c9c5142..f1ac122 100644
--- a/main.lua
+++ b/main.lua
@@ -14,7 +14,13 @@ Editor_state = {}
 
 -- called both in tests and real run
 function App.initialize_globals()
-  return edit.initialize_globals()
+  edit.initialize_globals()
+
+  -- resize
+  Last_resize_time = nil
+
+  -- blinking cursor
+  Cursor_time = 0
 end
 
 -- called only for real run
@@ -144,6 +150,15 @@ function App.draw()
 end
 
 function App.update(dt)
+  Cursor_time = Cursor_time + dt
+  -- some hysteresis while resizing
+  if Last_resize_time then
+    if App.getTime() - Last_resize_time < 0.1 then
+      return
+    else
+      Last_resize_time = nil
+    end
+  end
   edit.update(dt)
 end
 
@@ -165,21 +180,26 @@ function love.quit()
 end
 
 function App.mousepressed(x,y, mouse_button)
+  Cursor_time = 0  -- ensure cursor is visible immediately after it moves
   return edit.mouse_pressed(x,y, mouse_button)
 end
 
 function App.mousereleased(x,y, mouse_button)
+  Cursor_time = 0  -- ensure cursor is visible immediately after it moves
   return edit.mouse_released(x,y, mouse_button)
 end
 
 function App.textinput(t)
+  Cursor_time = 0  -- ensure cursor is visible immediately after it moves
   return edit.textinput(t)
 end
 
 function App.keychord_pressed(chord, key)
+  Cursor_time = 0  -- ensure cursor is visible immediately after it moves
   return edit.keychord_pressed(chord, key)
 end
 
 function App.keyreleased(key, scancode)
+  Cursor_time = 0  -- ensure cursor is visible immediately after it moves
   return edit.key_released(key, scancode)
 end