110 lines
3.7 KiB
Text
110 lines
3.7 KiB
Text
-- Bezels: the cabinet artwork in testScripts/bezels (cabinet.png and its cabinet.cfg cutout), the
|
|
-- picture landing in the cutout, a GUI drawn on the artwork outside the picture with guiDrawScreen,
|
|
-- and the score panel behind the seven scoreBezel calls. A green frame runs along the very edge of
|
|
-- the picture, so the yellow ring painted just outside the cutout in the artwork must sit right
|
|
-- against it with no gap; magenta corner marks show what artwork drawn in front of the picture
|
|
-- (--bezelflip) covers, and setOverlayOnTop puts them back on top of it.
|
|
-- Run five times: plain, --bezelflip, with a Sinden border, with a Sinden border and
|
|
-- --sindenedge=video, and with no --bezel at all.
|
|
dofile("Singe/Framework.singe")
|
|
|
|
local font = fontLoad("Singe/FreeSansBold.ttf", 12)
|
|
local width, height = overlayGetWidth(), overlayGetHeight()
|
|
local loaded, bezel = mainBezelLoaded()
|
|
local gui = guiNew(128, 384)
|
|
local document = guiLoad(gui, "testScripts/scene47.rml")
|
|
local frames = 0
|
|
local shot = 0
|
|
local note = "scoreBezelGetState " .. tostring(scoreBezelGetState())
|
|
|
|
local STEP_FRAMES = 25
|
|
local SHOT_DELAY = 14
|
|
|
|
-- Every step leaves the panel showing something different, and the last two prove that a cleared
|
|
-- panel comes back as soon as a value arrives.
|
|
local steps = {
|
|
{ "panel off", nil },
|
|
{ "panel on", function()
|
|
scoreBezelEnable(true, 0) -- The type is Hypseus's backend choice; Singe has one and ignores it.
|
|
scoreBezelCredits(5)
|
|
scoreBezelScore(1, 1234)
|
|
scoreBezelLives(1, 3)
|
|
scoreBezelScore(2, 999999) -- Ignored: the second score is not switched on yet.
|
|
note = "scoreBezelGetState " .. tostring(scoreBezelGetState())
|
|
end },
|
|
{ "twin on", function()
|
|
scoreBezelTwinScoreOn(true)
|
|
scoreBezelScore(2, 777)
|
|
scoreBezelLives(2, 2)
|
|
note = "second player on"
|
|
end },
|
|
{ "values", function()
|
|
scoreBezelCredits(12)
|
|
scoreBezelScore(1, 987654)
|
|
scoreBezelLives(1, 9)
|
|
scoreBezelScore(2, 42)
|
|
scoreBezelLives(2, 1)
|
|
note = "credits 12 1UP 987654 2UP 42"
|
|
end },
|
|
{ "overlay on top", function()
|
|
local ok, id = setOverlayOnTop(true)
|
|
note = string.format("setOverlayOnTop(true) -> %s %s", tostring(ok), id)
|
|
end },
|
|
{ "cleared", function()
|
|
setOverlayOnTop(false)
|
|
scoreBezelClear()
|
|
note = "scoreBezelClear()"
|
|
end },
|
|
{ "restored", function()
|
|
scoreBezelCredits(1)
|
|
note = "one credit brings the panel back"
|
|
end },
|
|
}
|
|
local label = steps[1][1]
|
|
|
|
fontSelect(font)
|
|
discPlay()
|
|
guiSetValue(gui, document, "bezel", loaded and bezel or "no")
|
|
|
|
function onOverlayUpdate()
|
|
frames = frames + 1
|
|
overlayClear()
|
|
|
|
-- The very edge of the picture: the artwork's yellow ring must be right against this.
|
|
colorForeground(0, 255, 0)
|
|
overlayBox(0, 0, width - 1, height - 1)
|
|
|
|
-- Corner marks inside the picture, where the artwork's brackets reach when it draws in front.
|
|
colorForeground(255, 0, 255)
|
|
overlayBox(4, 4, 30, 30)
|
|
overlayBox(width - 31, 4, width - 5, 30)
|
|
overlayBox(4, height - 31, 30, height - 5)
|
|
overlayBox(width - 31, height - 31, width - 5, height - 5)
|
|
|
|
colorForeground(255, 255, 255)
|
|
fontPrint(40, 20, string.format("scene47 %s", label))
|
|
fontPrint(40, 38, string.format("bezel %s id %s", tostring(loaded), bezel))
|
|
fontPrint(40, 56, note)
|
|
|
|
guiDrawScreen(gui, 8, 44, 38, 114)
|
|
|
|
if (frames % STEP_FRAMES) == 0 then
|
|
local step = (frames / STEP_FRAMES) + 1
|
|
if steps[step] ~= nil then
|
|
label = steps[step][1]
|
|
if steps[step][2] ~= nil then
|
|
steps[step][2]()
|
|
end
|
|
guiSetValue(gui, document, "step", string.format("%d", step))
|
|
end
|
|
end
|
|
if ((frames % STEP_FRAMES) == SHOT_DELAY) and (shot < #steps) then
|
|
shot = shot + 1
|
|
singeScreenshot()
|
|
end
|
|
if (shot >= #steps) and ((frames % STEP_FRAMES) == (SHOT_DELAY + 2)) then
|
|
singeQuit()
|
|
end
|
|
|
|
return OVERLAY_UPDATED
|
|
end
|