This works if you're using M1U:
sync on
sync rate 60
draw sprites manual
panel = CreateSimplePanel((screen width() - 400) / 2, (screen height() - 300), 400, 200, 255)
while not escapekey()
draw sprites
center text screen width() / 2, screen height() - 280, "Here goes some text..."
sync
endwhile
end
function CreateSimplePanel(x as integer, y as integer, w as integer, h as integer, alpha as byte)
mem = find free memblock()
img = find free image()
spr = find free sprite()
make memblock mem, 12 + (w * h * 4)
write memblock dword mem, 0, w
write memblock dword mem, 4, h
write memblock dword mem, 8, 32
gStep# = 64.0 / h
bStep# = 128.0 / h
for px = 0 to w - 1
for py = 0 to h - 1
offset = 12 + (((py * w) + px) * 4)
if px = 0 or px = w - 1 or py = 0 or py = h - 1
col = 0xffffff
else
g = gStep# * py
b = 128 + (bStep# * py)
col = g << 8 || b
endif
col = col || alpha << 24
write memblock dword mem, offset, col
next py
next px
make image from memblock img, mem
delete memblock mem
sprite spr, x, y, img
endfunction spr
In a more serious project I would use a custom bitmap font system that renders text to images that are then displayed as sprites on top of the panel sprite however.
"Why do programmers get Halloween and Christmas mixed up?" Because Oct(31) = Dec(25)