Personally I would build the menus up from smaller elements and place them in the appropriate places when visible and move them off screen when not. Not sure if that is how you are doing it.
I would also use sprites for the text, buttons and even numbers, that way you have full control over font, colour and can layer the sprites for other effects.
For text you can either create sprites for every word and just place them where needed or make sprites for individual letters (for numbers you would have to do that any way).
Depends entirely on how fancy you want to make it look!
Here is an example from the Asteroids demo thingy.
local function HideNums(sprs)
for k,_ in pairs(sprs) do
SetSpritePosition (sprs[k].D1, 200, 200)
SetSpritePosition (sprs[k].D2, 200, 200)
SetSpritePosition (sprs[k].D3, 200, 200)
SetSpritePosition (sprs[k].D4, 200, 200)
end
end
local function PlotNum (sprs, dp_spr, x, y, str_val, dppos)
local D1 = 'N' .. sub(str_val, 1, 1)
local D2 = 'N' .. sub(str_val, 2, 2)
local D3 = 'N' .. sub(str_val, 3, 3)
local D4 = 'N' .. sub(str_val, 4, 4)
HideNums(sprs)
SetSpritePosition (sprs[D1].D1, x, y + 0.2)
SetSpritePosition (sprs[D2].D2, x + 1.2, y + 0.2)
SetSpritePosition (sprs[D3].D3, x + 2.4, y + 0.2)
SetSpritePosition (sprs[D4].D4, x + 3.6 , y + 0.2)
SetSpritePosition (dp_spr, x - 0.1 + 1.1 * dppos, y + 1.8)
end
local function DisplayNum(colour, value)
local sprites = nil
local dp_spr = nil
local x, y = 0, 83
if colour == 'blue' then
dp_spr = g_BDP_sprite
sprites = g_Bnum_sprites
x = 70.25
elseif colour == 'green' then
dp_spr = g_GDP_sprite
sprites = g_Gnum_sprites
x = 76
else
dp_spr = g_RDP_sprite
sprites = g_Rnum_sprites
x = 64.5
end
local dppos, val
local flash = false
if value >= 1000 then
dppos = 0
val = value
if val >= 9999 then
val = 9999
flash = true
end
elseif value >= 100 then
dppos = 3
val = value * 10
elseif value >= 10 then
dppos = 2
val = value * 100
else
dppos = 1
val = value * 1000
end
local str_val = ""
if val > 100 then
str_val = "0" .. modf(val)
elseif val > 10 then
str_val = "00" .. modf(val)
elseif val > 1 then
str_val = "000" .. modf(val)
else
str_val = "0000"
end
PlotNum (sprites, dp_spr, x, y, str_val, dppos)
end
local function Init_Number_Store()
local back_img = LoadImage ("scriptbank\\images\\Asteroids Cockpit\\Numbers\\Back.png")
g_back_sprites['B'] = CreateSprite(back_img)
g_back_sprites['R'] = CreateSprite(back_img)
g_back_sprites['G'] = CreateSprite(back_img)
g_BDP_sprite = CreateSprite(LoadImage ("scriptbank\\images\\Asteroids Cockpit\\Numbers\\Blue\\dp.png"))
SetSpriteSize (g_BDP_sprite, 0.5, 0.5)
g_GDP_sprite = CreateSprite(LoadImage ("scriptbank\\images\\Asteroids Cockpit\\Numbers\\Green\\dp.png"))
SetSpriteSize (g_GDP_sprite, 0.5, 0.5)
g_RDP_sprite = CreateSprite(LoadImage ("scriptbank\\images\\Asteroids Cockpit\\Numbers\\Red\\dp.png"))
SetSpriteSize (g_RDP_sprite, 0.5, 0.5)
for i = 0,9 do
local num_image = LoadImage ("scriptbank\\images\\Asteroids Cockpit\\Numbers\\Blue\\" .. i .. ".png")
g_Bnum_sprites['N' .. i] = {D1 = CreateSprite(num_image),
D2 = CreateSprite(num_image),
D3 = CreateSprite(num_image),
D4 = CreateSprite(num_image)}
SetSpriteSize (g_Bnum_sprites['N' .. i].D1, 1.1, 2)
SetSpriteSize (g_Bnum_sprites['N' .. i].D2, 1.1, 2)
SetSpriteSize (g_Bnum_sprites['N' .. i].D3, 1.1, 2)
SetSpriteSize (g_Bnum_sprites['N' .. i].D4, 1.1, 2)
SetSpriteDepth (g_Bnum_sprites['N' .. i].D1, 90)
SetSpriteDepth (g_Bnum_sprites['N' .. i].D2, 90)
SetSpriteDepth (g_Bnum_sprites['N' .. i].D3, 90)
SetSpriteDepth (g_Bnum_sprites['N' .. i].D4, 90)
num_image = LoadImage ("scriptbank\\images\\Asteroids Cockpit\\Numbers\\Green\\" .. i .. ".png")
g_Gnum_sprites['N' .. i] = {D1 = CreateSprite(num_image),
D2 = CreateSprite(num_image),
D3 = CreateSprite(num_image),
D4 = CreateSprite(num_image)}
SetSpriteSize (g_Gnum_sprites['N' .. i].D1, 1.1, 2)
SetSpriteSize (g_Gnum_sprites['N' .. i].D2, 1.1, 2)
SetSpriteSize (g_Gnum_sprites['N' .. i].D3, 1.1, 2)
SetSpriteSize (g_Gnum_sprites['N' .. i].D4, 1.1, 2)
SetSpriteDepth (g_Gnum_sprites['N' .. i].D1, 90)
SetSpriteDepth (g_Gnum_sprites['N' .. i].D2, 90)
SetSpriteDepth (g_Gnum_sprites['N' .. i].D3, 90)
SetSpriteDepth (g_Gnum_sprites['N' .. i].D4, 90)
num_image = LoadImage ("scriptbank\\images\\Asteroids Cockpit\\Numbers\\Red\\" .. i .. ".png")
g_Rnum_sprites['N' .. i] = {D1 = CreateSprite(num_image),
D2 = CreateSprite(num_image),
D3 = CreateSprite(num_image),
D4 = CreateSprite(num_image)}
SetSpriteSize (g_Rnum_sprites['N' .. i].D1, 1.1, 2)
SetSpriteSize (g_Rnum_sprites['N' .. i].D2, 1.1, 2)
SetSpriteSize (g_Rnum_sprites['N' .. i].D3, 1.1, 2)
SetSpriteSize (g_Rnum_sprites['N' .. i].D4, 1.1, 2)
SetSpriteDepth (g_Rnum_sprites['N' .. i].D1, 90)
SetSpriteDepth (g_Rnum_sprites['N' .. i].D2, 90)
SetSpriteDepth (g_Rnum_sprites['N' .. i].D3, 90)
SetSpriteDepth (g_Rnum_sprites['N' .. i].D4, 90)
end
SetSpritePosition(g_BDP_sprite, 200, 200)
SetSpritePosition(g_GDP_sprite, 200, 200)
SetSpritePosition(g_RDP_sprite, 200, 200)
HideNums(g_Bnum_sprites)
HideNums(g_Gnum_sprites)
HideNums(g_Rnum_sprites)
end
Been there, done that, got all the T-Shirts!