singe/testScripts/scene42.singe
2026-09-07 23:44:37 -05:00

45 lines
1.7 KiB
Text

-- GUI filters: testScripts/scene42.rml (styled by scene42.rcss on top of the shipped
-- Singe/gui.rcss) in a GUI the size of the overlay, over the disc. A panel under filter: blur,
-- text under drop-shadow, a row of squares each through one colour filter (grayscale, sepia,
-- invert, hue-rotate, saturate), a panel with a soft box-shadow, and a wide blur that runs
-- through the downscaled path. guiGetStats() is printed at each screenshot; between the two
-- the script narrows both blurs through RmlUi's Lua API.
local font = fontLoad("Singe/FreeSansBold.ttf", 24)
local frames = 0
fontSelect(font)
overlaySetResolution(discGetWidth(), discGetHeight())
local gui = guiNew(overlayGetWidth(), overlayGetHeight())
local doc = guiLoad(gui, "testScripts/scene42.rml")
local function printStats()
local s = guiGetStats()
debugPrint(string.format("scene42 frame %d stats: drawCalls %d layerPushes %d filterPasses %d maskWrites %d layerBytes %d passes %d", frames, s.drawCalls, s.layerPushes, s.filterPasses, s.maskWrites, s.layerBytes, s.passes))
end
function onOverlayUpdate()
frames = frames + 1
overlayClear()
colorForeground(255, 255, 255, 255)
fontPrint(10, overlayGetHeight() - 30, "scene42 frame " .. frames .. " (overlay text under the GUI)")
guiSetValue(gui, doc, "frame", "frame " .. frames)
guiDraw(gui)
if frames == 40 then
printStats()
singeScreenshot()
end
if frames == 60 then
local document = rmlui.contexts["gui0"].documents["scene42"]
document:GetElementById("blurred").style.filter = "blur(2dp)"
document:GetElementById("wide").style.filter = "blur(12dp)"
end
if frames == 110 then
printStats()
singeScreenshot()
end
if frames == 130 then
singeQuit()
end
return OVERLAY_UPDATED
end