Tables
Posted: Wed Jun 18, 2025 1:09 pm
I want to use a table to store a custom palette with hex values and instead of referencing their positions in the table call them by their variable names, because it's a little easier to remember names.
I tried:
Which runs, but only the Bl variable is used. I thought this would work, what is the proper way to do this?
Thanks!
I tried:
Code: Select all
_COLS = {[Yel] = $FFD300, [Rd] = $FF4C4C, [Gr] = $3FB63F, [Bl] = $53ACE4}
Function p_testscreen()
Local display_w = GetAttribute(#DISPLAY, 1, #ATTRWIDTH)
Local display_h = GetAttribute(#DISPLAY, 1, #ATTRHEIGHT)
SetFont(#MONOSPACE, 30)
SetFontStyle(#ANTIALIAS)
SetFontColor(_GREYS[9])
TextOut(#CENTER, #CENTER, "Hello World!")
Line(0, 0, display_w, display_h, _COLS[Gr])
Line(display_w, 0, 0, display_h, _COLS[Gr])
Box(0, 0, display_w, display_h, _COLS[Yel])
Box(#CENTER, #CENTER, display_w / 2, display_h / 2, _COLS[Rd])
Circle(#CENTER, #CENTER, display_h / 8, _COLS[Bl])
EndFunctionThanks!