use $feature() to enable debug features

This commit is contained in:
Alessandro Mauri 2025-10-03 15:31:44 +02:00
parent 8cecb57d93
commit 167676f478
3 changed files with 3 additions and 7 deletions

View File

@ -268,8 +268,6 @@ fn void? Ctx.frame_begin(&ctx)
// TODO: add a background color taken from a theme or config // TODO: add a background color taken from a theme or config
} }
const int DEBUG = 1;
fn void? Ctx.frame_end(&ctx) fn void? Ctx.frame_end(&ctx)
{ {
// FIXME: this is not guaranteed to be root. the user might forget to close a div or some other element // FIXME: this is not guaranteed to be root. the user might forget to close a div or some other element
@ -300,7 +298,7 @@ fn void? Ctx.frame_end(&ctx)
} }
// debug // debug
$if DEBUG == 1: $if $feature(DEBUG_POINTER):
// draw mouse position // draw mouse position
Cmd cmd = { Cmd cmd = {
.type = CMD_RECT, .type = CMD_RECT,

View File

@ -3,7 +3,7 @@
"warnings": ["no-unused"], "warnings": ["no-unused"],
"dependency-search-paths": ["lib", "lib/vendor/libraries"], "dependency-search-paths": ["lib", "lib/vendor/libraries"],
"dependencies": ["sdl3", "ugui"], "dependencies": ["sdl3", "ugui"],
"features": [], "features": ["DEBUG_POINTER"],
"authors": ["Alessandro Mauri <ale@shitposting.expert>"], "authors": ["Alessandro Mauri <ale@shitposting.expert>"],
"version": "0.1.0", "version": "0.1.0",
"sources": ["src/**"], "sources": ["src/**"],
@ -14,7 +14,6 @@
"type": "executable" "type": "executable"
} }
}, },
"cpu": "native",
"opt": "O0", "opt": "O0",
"debug-info": "full" "debug-info": "full"
} }

View File

@ -36,7 +36,6 @@ import ugui;
// CONSTANTS // // CONSTANTS //
// ============================================================================================== // // ============================================================================================== //
const int DEBUG = 1;
const bool CYCLE = true; const bool CYCLE = true;
const int MAX_QUAD_BATCH = 2048; const int MAX_QUAD_BATCH = 2048;
@ -147,7 +146,7 @@ struct Renderer {
fn void Renderer.init(&self, ZString title, uint width, uint height, bool vsync) fn void Renderer.init(&self, ZString title, uint width, uint height, bool vsync)
{ {
// set wayland hint automagically // set wayland hint automagically
$if DEBUG == 0: $if $feature(RENDER_DEBUG) == false && $feature(USE_WAYLAND) == true:
bool has_wayland = false; bool has_wayland = false;
for (int i = 0; i < sdl::get_num_video_drivers(); i++) { for (int i = 0; i < sdl::get_num_video_drivers(); i++) {
ZString driver = sdl::get_video_driver(i); ZString driver = sdl::get_video_driver(i);