about summary refs log tree commit diff stats
path: root/text.lua
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2022-06-09 13:45:52 -0700
committerKartik K. Agaram <vc@akkartik.com>2022-06-09 13:47:41 -0700
commitfe170fc579cc084061f6dce70aa9b4e966148ca7 (patch)
tree3ff48d57828ec7c96c7f7ba32564fb58d625b0ca /text.lua
parent25190676ea2a7cee59c57506ccefaed82ee6fb79 (diff)
downloadtext.love-fe170fc579cc084061f6dce70aa9b4e966148ca7.tar.gz
experiment: blinking cursor
I've tried to keep the time period of the blinking similar to my
terminal.

Honestly I'm no longer sure if any of my experiments are showing a
statistically significant result. Let's see how it feels over a period
of time.
Diffstat (limited to 'text.lua')
-rw-r--r--text.lua9
1 files changed, 6 insertions, 3 deletions
diff --git a/text.lua b/text.lua
index b8c3909..69b8c37 100644
--- a/text.lua
+++ b/text.lua
@@ -85,9 +85,12 @@ end
 --  draw with small line_width of 100
 
 function Text.draw_cursor(x, y)
-  love.graphics.setColor(1,0,0, 0.8)
-  love.graphics.rectangle('fill', x,y, 3,Line_height)
-  love.graphics.setColor(0,0,0)
+  -- blink every 0.5s
+  if math.floor(Cursor_time*2)%2 == 0 then
+    love.graphics.setColor(1,0,0)
+    love.graphics.rectangle('fill', x,y, 3,Line_height)
+    love.graphics.setColor(0,0,0)
+  end
   Cursor_x = x
   Cursor_y = y+Line_height
 end