diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2024-06-11 10:37:58 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2024-06-11 10:37:58 -0700 |
commit | 69c88da98ca1bba3ab1c890639aa0228f125c467 (patch) | |
tree | ed5d0a06eeeb97d205a905efe73bd8730e79cd32 /help.lua | |
parent | f2299cb422d0fc07a1b01f0c31f88e9ae5ab168f (diff) | |
download | lines.love-69c88da98ca1bba3ab1c890639aa0228f125c467.tar.gz |
stop caching starty
This is quite useful because I used to have a long list of places in which to invalidate the cache.
Diffstat (limited to 'help.lua')
-rw-r--r-- | help.lua | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/help.lua b/help.lua index 6f8633b..cc7a0c9 100644 --- a/help.lua +++ b/help.lua @@ -1,8 +1,8 @@ function draw_help_without_mouse_pressed(State, drawing_index) local drawing = State.lines[drawing_index] - local line_cache = State.line_cache[drawing_index] + local starty = Text.starty(State, drawing_index) App.color(Help_color) - local y = line_cache.starty+10 + local y = starty+10 love.graphics.print("Things you can do:", State.left+30,y) y = y + State.line_height love.graphics.print("* Press the mouse button to start drawing a "..current_shape(State), State.left+30,y) @@ -48,14 +48,14 @@ function draw_help_without_mouse_pressed(State, drawing_index) love.graphics.print("Press 'esc' now to hide this message", State.left+30,y) y = y + State.line_height App.color(Help_background_color) - love.graphics.rectangle('fill', State.left,line_cache.starty, State.width, math.max(Drawing.pixels(drawing.h, State.width),y-line_cache.starty)) + love.graphics.rectangle('fill', State.left,starty, State.width, math.max(Drawing.pixels(drawing.h, State.width),y-starty)) end function draw_help_with_mouse_pressed(State, drawing_index) local drawing = State.lines[drawing_index] - local line_cache = State.line_cache[drawing_index] + local starty = Text.starty(State, drawing_index) App.color(Help_color) - local y = line_cache.starty+10 + local y = starty+10 love.graphics.print("You're currently drawing a "..current_shape(State, drawing.pending), State.left+30,y) y = y + State.line_height love.graphics.print('Things you can do now:', State.left+30,y) @@ -129,7 +129,7 @@ function draw_help_with_mouse_pressed(State, drawing_index) y = y + State.line_height end App.color(Help_background_color) - love.graphics.rectangle('fill', State.left,line_cache.starty, State.width, math.max(Drawing.pixels(drawing.h, State.width),y-line_cache.starty)) + love.graphics.rectangle('fill', State.left,starty, State.width, math.max(Drawing.pixels(drawing.h, State.width),y-starty)) end function current_shape(State, shape) |