85 lines
3.9 KiB
Text
85 lines
3.9 KiB
Text
-- Hypseus parity, stage 1: the framework's setOverlaySize presets and setOverlayResolution
|
|
-- (every call is followed by a redraw and a screenshot, since the resize empties the overlay),
|
|
-- the engine's setOverlayLinearScale over a checkerboard the window scales up, the music
|
|
-- wrappers over a generated tone, and a status line carrying scoreBezelGetState (false until a
|
|
-- game asks for the score panel, which scene47 does), rewriteStatus, ratioGetX, ratioGetY and
|
|
-- musicIsPlaying.
|
|
dofile("Singe/Framework.singe")
|
|
local font = fontLoad("Singe/FreeSansBold.ttf", 12)
|
|
local checker = spriteLoad("testScripts/checker.png")
|
|
local tone = musicLoad("testScripts/tone.ogg")
|
|
local frames = 0
|
|
local note = "start"
|
|
|
|
fontSelect(font)
|
|
discPlay()
|
|
scoreBezelEnable(false, 0) -- Accepted with a type Singe ignores; the panel stays off, as Hypseus ships it.
|
|
scoreBezelCredits(3)
|
|
scoreBezelScore(1, 12345)
|
|
scoreBezelLives(1, 3)
|
|
scoreBezelTwinScoreOn(true)
|
|
musicSetVolume(soundGetVolume() * 2) -- The round trip every Hypseus game makes.
|
|
musicPlay(tone, -1)
|
|
|
|
function onOverlayUpdate()
|
|
frames = frames + 1
|
|
overlayClear()
|
|
overlayBox(1, 1, overlayGetWidth() - 2, overlayGetHeight() - 2)
|
|
spriteDraw(checker, 10, 10)
|
|
spriteDraw(checker, overlayGetWidth() - 74, 10)
|
|
fontPrint(10, 90, string.format("frame %d overlay %dx%d disc %dx%d", frames, overlayGetWidth(), overlayGetHeight(), discGetWidth(), discGetHeight()))
|
|
fontPrint(10, 108, string.format("bezel %s rewrite %s ratio %d %d music %s", tostring(scoreBezelGetState()), tostring(rewriteStatus()), ratioGetX(), ratioGetY(), tostring(musicIsPlaying())))
|
|
fontPrint(10, 126, note)
|
|
-- Each overlay size in turn, every one a visible change from the one before it.
|
|
if frames == 10 then
|
|
setOverlaySize(1) -- The disc's own size.
|
|
note = "setOverlaySize(1)"
|
|
elseif frames == 30 then
|
|
setOverlaySize(2) -- Half the disc, both axes.
|
|
note = "setOverlaySize(2)"
|
|
elseif frames == 50 then
|
|
setOverlaySize(4, 640, 400) -- The size given.
|
|
note = "setOverlaySize(4, 640, 400)"
|
|
elseif frames == 70 then
|
|
setOverlaySize(3) -- 360x240, whatever the disc is.
|
|
note = "setOverlaySize(3)"
|
|
elseif frames == 90 then
|
|
setOverlaySize(4, 320, 240)
|
|
note = "setOverlaySize(4, 320, 240)"
|
|
elseif frames == 110 then
|
|
setOverlaySize(4) -- Ignored without a size, as in Hypseus: still 320x240.
|
|
note = "setOverlaySize(4) ignored"
|
|
elseif frames == 130 then
|
|
setOverlaySize(9) -- Unrecognised: half the disc, as preset 2 does.
|
|
note = "setOverlaySize(9) is half"
|
|
elseif frames == 150 then
|
|
setOverlayResolution(480, 320) -- The alias of overlaySetResolution.
|
|
note = "setOverlayResolution(480, 320)"
|
|
elseif frames == 170 then
|
|
setOverlayLinearScale(true) -- The checkerboard softens as the window scales it.
|
|
note = "setOverlayLinearScale(true)"
|
|
elseif frames == 190 then
|
|
setOverlayLinearScale(false) -- ... and blocks up again.
|
|
note = "setOverlayLinearScale(false)"
|
|
elseif frames == 210 then
|
|
musicStop(tone)
|
|
note = string.format("musicStop(tone): playing %s", tostring(musicIsPlaying(tone)))
|
|
elseif frames == 220 then
|
|
musicPlay(tone) -- Once through, no loop count.
|
|
musicSetVolume(128) -- The top of Hypseus's own 0 to 128 scale.
|
|
note = string.format("musicPlay(tone): playing %s", tostring(musicIsPlaying(tone)))
|
|
elseif frames == 230 then
|
|
musicStop() -- Every piece of music, with no fade.
|
|
note = string.format("musicStop(): playing %s", tostring(musicIsPlaying()))
|
|
elseif frames == 240 then
|
|
musicUnload(tone)
|
|
note = "musicUnload(tone)"
|
|
end
|
|
if frames == 20 or frames == 40 or frames == 60 or frames == 80 or frames == 100 or frames == 120 or frames == 140 or frames == 160 or frames == 180 or frames == 200 or frames == 245 then
|
|
singeScreenshot()
|
|
end
|
|
if frames == 250 then
|
|
singeQuit()
|
|
end
|
|
return OVERLAY_UPDATED
|
|
end
|