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

36 lines
1.4 KiB
Text

-- GUI gradients: testScripts/scene43.rml (styled by scene43.rcss on top of the shipped
-- Singe/gui.rcss) in a GUI the size of the overlay, over the disc. A three-stop linear
-- gradient panel, a radial gradient disc, a conic gradient wheel, a repeating linear gradient
-- stripe, and a gradient with twenty stops (which trips the sixteen-stop warning once). Between
-- the two screenshots the wheel's starting angle turns through RmlUi's Lua API.
local font = fontLoad("Singe/FreeSansBold.ttf", 24)
local frames = 0
local wheel = "conic-gradient(from %ddeg, #ff3030, #ffd35a, #30c030, #30d0d0, #4a7ad8, #d040d0, #ff3030)"
fontSelect(font)
overlaySetResolution(discGetWidth(), discGetHeight())
local gui = guiNew(overlayGetWidth(), overlayGetHeight())
local doc = guiLoad(gui, "testScripts/scene43.rml")
function onOverlayUpdate()
frames = frames + 1
overlayClear()
colorForeground(255, 255, 255, 255)
fontPrint(10, overlayGetHeight() - 30, "scene43 frame " .. frames .. " (overlay text under the GUI)")
guiSetValue(gui, doc, "frame", "frame " .. frames)
guiDraw(gui)
if frames == 40 then
singeScreenshot()
end
if frames == 60 then
rmlui.contexts["gui0"].documents["scene43"]:GetElementById("wheel").style.decorator = string.format(wheel, 90)
end
if frames == 110 then
singeScreenshot()
end
if frames == 130 then
singeQuit()
end
return OVERLAY_UPDATED
end