From c62da1c9a0dcdc5a71824e66e89985c01ea888ad Mon Sep 17 00:00:00 2001 From: AllyTally Date: Mon, 3 Jul 2023 14:30:24 -0300 Subject: [PATCH] Add flag display by holding U --- desktop_version/src/LevelDebugger.cpp | 37 ++++++++++++++++++++++----- 1 file changed, 31 insertions(+), 6 deletions(-) diff --git a/desktop_version/src/LevelDebugger.cpp b/desktop_version/src/LevelDebugger.cpp index f28c5d7a..e5953390 100644 --- a/desktop_version/src/LevelDebugger.cpp +++ b/desktop_version/src/LevelDebugger.cpp @@ -211,6 +211,11 @@ namespace level_debugger } } + void render_info(int y, const char* text) + { + font::print(PR_BOR | PR_FONT_8X8, 5, 32 + (10 * y), text, 220 - (help.glow), 220 - (help.glow), 255 - (help.glow / 2)); + } + void render_coords(int y, const char* text, int first, int second) { char buffer[SCREEN_WIDTH_CHARS + 1]; @@ -225,11 +230,6 @@ namespace level_debugger render_info(y, buffer); } - void render_info(int y, const char* text) - { - font::print(PR_BOR | PR_FONT_8X8, 5, 32 + (10 * y), text, 220 - (help.glow), 220 - (help.glow), 255 - (help.glow / 2)); - } - void render(void) { if (!active) @@ -289,7 +289,32 @@ namespace level_debugger int line = 0; - if (hovered == -1) + if (key.isDown(SDLK_u)) + { + SDL_Color on = graphics.getRGB(220 - (help.glow), 220 - (help.glow), 255 - (help.glow / 2)); + SDL_Color off = graphics.getRGB(220 / 2 - (help.glow), 220 / 2 - (help.glow), 255 / 2 - (help.glow / 2)); + + graphics.set_blendmode(SDL_BLENDMODE_BLEND); + graphics.fill_rect(NULL, 0, 0, 0, 127); + graphics.set_blendmode(SDL_BLENDMODE_NONE); + + int x = 0; + int y = 0; + + for (int i = 0; i < SDL_arraysize(obj.flags); i++) + { + SDL_Color color = obj.flags[i] ? on : off; + font::print(PR_BOR | PR_FONT_8X8, 5 + x, 32 + y, help.String(i), color.r, color.g, color.b); + + x += 16 + 8; + if (x >= 300) + { + x = 0; + y += 16; + } + } + } + else if (hovered == -1) { render_coords(line++, "Room", game.roomx % 100, game.roomy % 100); render_coords(line++, "Cursor", key.mx, key.my);