From 6f6b4e6d741d8d9b2afb25afb57112076163da9c Mon Sep 17 00:00:00 2001 From: Kazhnuz Date: Mon, 30 Aug 2021 14:07:02 +0200 Subject: [PATCH] chore: make canvas redraw part of canvas --- sonic-radiance.love/birb/modules/gui/elements/canvas.lua | 7 +++++++ sonic-radiance.love/birb/modules/gui/menus/parent.lua | 5 +---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/sonic-radiance.love/birb/modules/gui/elements/canvas.lua b/sonic-radiance.love/birb/modules/gui/elements/canvas.lua index 616efc0..62a6949 100644 --- a/sonic-radiance.love/birb/modules/gui/elements/canvas.lua +++ b/sonic-radiance.love/birb/modules/gui/elements/canvas.lua @@ -19,6 +19,13 @@ function CanvasElement:initCanvas() self.canvas.padding = 8 end +function CanvasElement:updateElement(dt) + CanvasElement.super.updateElement(self, dt) + if (self.canvas.needRedraw or self.canvas.isAnimated) then + self:redraw() + end +end + function CanvasElement:getCanvasDimensions() return self:getDimensions() end diff --git a/sonic-radiance.love/birb/modules/gui/menus/parent.lua b/sonic-radiance.love/birb/modules/gui/menus/parent.lua index e726388..bee182a 100644 --- a/sonic-radiance.love/birb/modules/gui/menus/parent.lua +++ b/sonic-radiance.love/birb/modules/gui/menus/parent.lua @@ -140,11 +140,8 @@ end -- UPDATE FUNCTIONS function Menu:updateElement(dt) - Menu.super.updateElement(self, dt) self.widget:update(dt) - if (self.canvas.needRedraw or self.canvas.isAnimated) then - self:redraw() - end + Menu.super.updateElement(self, dt) end -- DRAW FUNCTIONS