-- Hypseus extensions over the disc: a sprite sheet drawn by frame in the three spriteDrawFrame -- forms, the disc focus area, both monochrome modes, the scale, YUV and RGB pixel reads and the -- controller checks. discAudioSuffix needs a sidecar file and is exercised by hand. The -- framework supplies keyboardCatchQuit, the Hypseus name for the quit key setting. dofile("Singe/Framework.singe") local font = fontLoad("Singe/FreeSansBold.ttf", 18) local strip = spriteLoadFrames(5, "testScripts/strip.png") local crate = spriteLoad("testScripts/crate.png") local frames = 0 local width, height = overlayGetWidth(), overlayGetHeight() local discW, discH = discGetWidth(), discGetHeight() fontSelect(font) discPlay() spriteResetColorKey(strip, true) -- Accepted; nothing to re-key in Singe. singeSetQuitKeyEnabled(false) -- The quit switch would reach the script now ... singeSetQuitKeyEnabled(true) -- ... and quits the engine again. keyboardCatchQuit(false) -- The Hypseus alias, same setting. controllerDoRumble(1, 1) -- No controller headless: a silent no-op in both forms. if controllerIsValid(0) then controllerDoRumble(0, 2, 1) end function onOverlayUpdate() frames = frames + 1 local frame = (math.floor(frames / 10) % 5) + 1 overlayClear() -- The three forms side by side, an out of range frame (draws frame 1) and a still through the same call. spriteDrawFrame(strip, 20, 40, frame) spriteDrawFrame(strip, 70, 40, frame, 2) spriteDrawFrame(strip, 150, 40, frame, 3, 1.5) spriteDrawFrame(strip, 260, 40, 9) spriteDrawFrame(crate, 300, 40, 4, 0.5) -- spriteDraw shows the sheet as an ordinary animation parked on a frame, 0-based through spriteSetFrame. spriteSetFrame(strip, 2) spriteDraw(strip, 20, 100) -- The effects, on and off again, with a screenshot of each state. if frames == 60 then vldpFocusArea(discW * 0.25, discH * 0.25, discW * 0.5, discH * 0.5) elseif frames == 80 then vldpFocusArea() elseif frames == 90 then vldpSetMonochrome(true) overlaySetMonochrome(true) elseif frames == 110 then vldpSetMonochrome(false) overlaySetMonochrome(false) end local y1, u1, v1 = vldpGetYUVPixel(width / 2, height / 2) local r, g, b = vldpGetPixel(width / 2, height / 2) fontPrint(10, 130, string.format("frame %d disc frame %d scale %d", frames, discGetFrame(), vldpGetScale())) fontPrint(10, 155, string.format("yuv %d %d %d rgb %d %d %d pad0 %s", y1, u1, v1, r, g, b, tostring(controllerIsValid(0)))) fontPrint(10, 180, string.format("frame size %dx%d crate %dx%d", spriteFrameWidth(strip), spriteFrameHeight(strip), spriteFrameWidth(crate), spriteFrameHeight(crate))) if frames == 30 or frames == 70 or frames == 100 or frames == 120 then singeScreenshot() end if frames == 130 then singeQuit() end return OVERLAY_UPDATED end