From 69c88da98ca1bba3ab1c890639aa0228f125c467 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Tue, 11 Jun 2024 10:37:58 -0700 Subject: stop caching starty This is quite useful because I used to have a long list of places in which to invalidate the cache. --- help.lua | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'help.lua') 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) -- cgit 1.4.1-2-gfad0