-- Overlay layers round guiDraw: what a script draws before a guiDraw is under the document and -- what it draws after is over it, so a gun's sight or an editor's pointer is never hidden by a -- HUD. Forge's own chrome, an opaque panel down the left, is the document: a red box is drawn -- before it and a yellow cross after it, both across the panel's edge, and the shot shows the box -- cut off by the panel and the cross whole over it. Then a second copy of the panel drawn small -- after the cross, with a blue box drawn after that, three layers deep. local font = fontLoad("Singe/FreeSansBold.ttf", 16) local gui = guiNew(720, 480) local doc = guiLoad(gui, "Forge/Forge.rml") local gui2 = guiNew(720, 480) local doc2 = guiLoad(gui2, "Forge/Forge.rml") local frames = 0 fontSelect(font) fontQuality(FONT_QUALITY_BLENDED) overlaySetResolution(720, 480) function onOverlayUpdate() frames = frames + 1 colorBackground(20, 20, 30, 255) overlayClear() -- Under the panel: a red box across its right edge (the panel is 190 wide, and its grip -- and title are the opaque part of an empty one, across the top). colorForeground(230, 60, 60, 255) for y = 40, 80 do overlayLine(100, y, 300, y) end guiDraw(gui) -- Over it: a yellow cross on the panel's edge, and a line of text. colorForeground(255, 220, 60, 255) overlayLine(150, 60, 230, 60) overlayLine(190, 20, 190, 100) fontPrint(220, 300, "drawn after guiDraw: over the panel") -- A second panel, drawn small over the cross's layer, and a blue box over its grip. guiDraw(gui2, 400, 150, 240, 160) colorForeground(80, 120, 255, 255) for y = 150, 170 do overlayLine(380, y, 480, y) end if frames == 10 then singeScreenshot("layers") debugPrint("LAYERS two panels queued, each with what follows it on a layer of its own; see the shot") debugPrint("LAYERS RESULT done") end if frames > 14 then singeQuit() end return OVERLAY_UPDATED end