From 38bac54ff0f8ea86188d1655853ebcc20662d2b9 Mon Sep 17 00:00:00 2001 From: Kistaro Windrider Date: Sat, 10 Feb 2024 16:10:34 -0800 Subject: [PATCH] add color fade to text box, default to intended semantic text palette --- vacation.p8 | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/vacation.p8 b/vacation.p8 index a7b864e..6d51f75 100644 --- a/vacation.p8 +++ b/vacation.p8 @@ -305,19 +305,28 @@ end -- text rendering -- text colors for zonk mode: --- 8 -- standard --- 9 -- delayed fade --- 10 -- currently fading in txtbox = { x=0, y=0, - text="???", - col=8, + cols={14, 10, 9, 8}, + f=0, + interval=4, mode=0x81, } -mknew(txtbox) +mknew(txtbox, function(self) + if (not self.cols) self.cols = {14,10,9,8} + self.c = deli(self.cols) +end) -function txtbox:update() end +function txtbox:update() + if #self.cols > 0 then + self.f += 1 + if self.f >= self.interval then + self.f = 0 + self.col = deli(self.cols) + end + end +end function txtbox:draw() poke(0x5f58, self.mode)