singe/testScripts/scene48.singe

71 lines
2.5 KiB
Text

-- User options and the settings file: everything a script can see of the new configuration.
-- getFValue, ratioGetX and ratioGetY come straight from --fvalue, --xratio and --yratio (or from
-- settings.cfg), soundGetVolume follows --volume_nonvldp, controllerIsValid(0) and mouseHowMany
-- follow --nogamepad and --nomouse, and controllerDoRumble is called once so the trace records the
-- step --haptic left of it. The disc fills most of the picture, so --monochrome shows in a
-- screenshot; --startsilent, --altaudio, --idleexit and --screen are checked from the trace.
dofile("Singe/Framework.singe")
local font = fontLoad("Singe/FreeSansBold.ttf", 12)
local width, height = overlayGetWidth(), overlayGetHeight()
local frames = 0
local shot = 0
local STEP_FRAMES = 30
local SHOT_DELAY = 18
local SHOTS = 3
local SWATCHES = 6
local SWATCH_HEIGHT = 15
-- A colour ramp in the overlay beside the disc: the overlay keeps its colour under --monochrome,
-- which greys the disc alone, so the two together show exactly what the option did.
local swatch = {
{ 255, 0, 0 },
{ 0, 255, 0 },
{ 0, 0, 255 },
{ 255, 255, 0 },
{ 0, 255, 255 },
{ 255, 0, 255 },
}
fontSelect(font)
discPlay()
-- Once, so --haptic shows in the trace whether a pad is plugged in or not.
controllerDoRumble(0, 4, 1)
function onOverlayUpdate()
local x = 0
local y = 0
frames = frames + 1
overlayClear()
colorForeground(0, 255, 0)
overlayBox(0, 0, width - 1, height - 1)
for x = 1, SWATCHES do
colorForeground(swatch[x][1], swatch[x][2], swatch[x][3])
for y = 0, SWATCH_HEIGHT do
overlayLine(width - 30, 8 + (x - 1) * 18 + y, width - 8, 8 + (x - 1) * 18 + y)
end
end
colorForeground(255, 255, 255)
fontPrint(20, 20, "scene48 user options")
fontPrint(20, 38, string.format("getFValue %s", tostring(getFValue())))
fontPrint(20, 56, string.format("ratioGetX %s ratioGetY %s", tostring(ratioGetX()), tostring(ratioGetY())))
fontPrint(20, 74, string.format("soundGetVolume %d vldpGetScale %d", soundGetVolume(), vldpGetScale()))
fontPrint(20, 92, string.format("controllerIsValid(0) %s mouseHowMany %d", tostring(controllerIsValid(0)), mouseHowMany()))
fontPrint(20, 110, string.format("singeWantsCrosshairs %s", tostring(singeWantsCrosshairs())))
if ((frames % STEP_FRAMES) == SHOT_DELAY) and (shot < SHOTS) then
shot = shot + 1
singeScreenshot()
end
if (shot >= SHOTS) and ((frames % STEP_FRAMES) == (SHOT_DELAY + 2)) then
singeQuit()
end
return OVERLAY_UPDATED
end