commit aeaf7b0810eb08af51b968b751ab13d8dee7559e
parent c83721c6593c8ee66d1b99fe3abc0a6d3b0e6ea4
Author: hhvn <dev@hhvn.uk>
Date: Sun, 13 Nov 2022 10:54:08 +0000
Improve debug/devel experience
Diffstat:
4 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/Makefile b/Makefile
@@ -41,7 +41,7 @@ data-clean:
@echo $(DATADIR): make clean
@cd $(DATADIR); make clean
-tags:
+tags: $(SRC)
ctags -R .
# ignore generated headers
diff --git a/config.mk b/config.mk
@@ -1,3 +1,6 @@
-STYLE = hhvn
-CFLAGS = -Wall -Wno-discarded-qualifiers -g3 -O0
+STYLE = aurora
SAVEDIR = saves
+
+# Uncomment when developing:
+# CFLAGS += -Wall -Wno-discarded-qualifiers -g3 -O0 -DDEBUG
+# all: tags
diff --git a/src/ui.c b/src/ui.c
@@ -222,6 +222,9 @@ ui_draw_views(void) {
int sw = GetScreenWidth();
if (sw > VIEWS_MAX_WIDTH) sw = VIEWS_MAX_WIDTH;
gui_tabs(0, 0, sw, VIEWS_HEIGHT, &view_tabs);
+#ifdef DEBUG
+ DrawFPS(sw + FONT_SIZE, FONT_SIZE / 2);
+#endif /* DEBUG */
}
void
diff --git a/src/views/main.c b/src/views/main.c
@@ -226,13 +226,13 @@ ui_draw_view_main(void) {
float dist;
float x, y;
- /* debug info */
+#ifdef DEBUG
ui_print(GetScreenWidth() / 2, VIEWS_HEIGHT + PAD, col_fg, "W: %f | H: %f", (float)screen.w, (float)screen.h);
ui_print(GetScreenWidth() / 2, VIEWS_HEIGHT + PAD * 2, col_fg, "Xoff: %f | Yoff: %f | km/px: %f",
view_main.kmx, view_main.kmy, view_main.kmperpx);
ui_print(GetScreenWidth() / 2, VIEWS_HEIGHT + PAD * 3, col_fg, "X: %f | Y: %f",
mousekm.x, mousekm.y);
- ui_print(GetScreenWidth() / 2, VIEWS_HEIGHT + PAD * 4, col_fg, "FPS: %d (target: %d)", GetFPS(), TARGET_FPS);
+#endif /* DEBUG */
/* draw system bodies */
for (t = view_main.sys->t->d; t; t = t->n) {