feat(gui): draw windowed apps through a batched SDL2 surface

Compiled programs could only write to the terminal, so the demo editor had no
real window. When CMake finds SDL2 the runtime now exposes a `gui` table and
Demo/guipaint.lua builds a 960x640 editor on top of it.

Frames are collected in Lua, merged into horizontal runs and sent with a single
`gui.rects` call: a full scene goes from 15071 draw calls and 42.9 ms per frame
to 1522 calls and 2.1 ms, and the rendered screenshot stays pixel-identical.
This commit is contained in:
BlackAngelTV committed 2026-11-18 10:18:44 +01:00
1 parent 0fc96b243a
commit 9587d1ed49
11 files changed
+1840 -9

No files matched your search

+2
View File
@@ -325,6 +325,8 @@ int run_script(const Options& opt) {
command += " -I" + quoted(srcDir.string());
command += " -I" + quoted(LUACPP_RUNTIME_INCLUDE_DIR);
command += " " + lua_link_flags();
std::string gui_flags = LUACPP_GUI_FLAGS;
if (!gui_flags.empty()) command += " " + gui_flags;
if (opt.verbose) std::cerr << "luacpp: compile: " << command << "\n";
if (!opt.quiet) std::cout << "luacpp: building " << display(exe) << "\n";