Skip to content

Commit 3427eeb

Browse files
committed
Fix: Help menu text alignment
1 parent 4209a59 commit 3427eeb

3 files changed

Lines changed: 26 additions & 10 deletions

File tree

include/constants.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
#ifndef CONSTANTS_H
22
#define CONSTANTS_H
33

4-
#define INITIAL_WINDOW_WIDTH 1920
5-
#define INITIAL_WINDOW_HEIGHT 1080
4+
// @TODO(Victor): Set the render size based on display resolution? after window init.
5+
#define INITIAL_WINDOW_WIDTH 2560
6+
#define INITIAL_WINDOW_HEIGHT 1440
67

78
#define MAX_DATA_POINTS 100000UL
89
#define MAX_REDSHIFT_GALAXIES 100000UL

src/app.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
internal i32
1717
app_init_platform(app_state_t *app_state)
1818
{
19-
SetTraceLogLevel(LOG_WARNING);
19+
SetTraceLogLevel(LOG_DEBUG);
2020
SetConfigFlags(FLAG_WINDOW_RESIZABLE | FLAG_VSYNC_HINT);
2121
const char *window_title = TextFormat("Galaxy Visualization v%s", APP_VERSION);
2222
InitWindow(app_state->window_width, app_state->window_height, window_title);

src/ui.c

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -186,20 +186,35 @@ ui_draw_help_panel(app_state_t *app_state)
186186
DrawTextEx(app_state->main_font, "Controls", (Vector2){(f32)(help_x + UI_PANEL_PADDING), (f32)line_y}, FONT_SIZE_MEDIUM, 2, WHITE);
187187
line_y += line_spacing + 4;
188188

189-
// Consolidated static help text (reduces DrawTextEx calls from 5 to 1)
190189
bool zoom_locked = !app_state->is_paused &&
191190
(app_state->data_to_draw == DRAW_DATA_A ||
192191
app_state->data_to_draw == DRAW_DATA_B ||
193192
app_state->data_to_draw == DRAW_DATA_ALL);
194-
const char *help_lines = zoom_locked
195-
? "1-4 Dataset\nR Camera mode\nB Toggle bloom\nH Toggle help\nF11 Fullscreen"
196-
: "1-4 Dataset\nR Camera mode\nB Toggle bloom\nH Toggle help\nF11 Fullscreen\nScroll Zoom";
197-
DrawTextEx(app_state->main_font, help_lines, (Vector2){(f32)(help_x + UI_PANEL_PADDING), (f32)line_y}, FONT_SIZE_MEDIUM, 1, TEXT_DIM);
193+
194+
const char *lines[8];
195+
i32 line_count = 0;
196+
lines[line_count++] = "1-4 Dataset";
197+
lines[line_count++] = "R Camera mode";
198+
lines[line_count++] = "B Toggle bloom";
199+
lines[line_count++] = "H Toggle help";
200+
lines[line_count++] = "F11 Fullscreen";
201+
if (!zoom_locked)
202+
{
203+
lines[line_count++] = "Scroll Zoom";
204+
}
205+
206+
for (i32 i = 0; i < line_count; ++i)
207+
{
208+
DrawTextEx(app_state->main_font, lines[i],
209+
(Vector2){(f32)(help_x + UI_PANEL_PADDING), (f32)line_y}, FONT_SIZE_MEDIUM, 1, TEXT_DIM);
210+
line_y += line_spacing;
211+
}
198212

199213
if (app_state->is_paused)
200214
{
201-
line_y += line_spacing * 5 + 6;
202-
DrawTextEx(app_state->main_font, "WASD+Mouse Shift/Space", (Vector2){(f32)(help_x + UI_PANEL_PADDING), (f32)line_y}, FONT_SIZE_MEDIUM, 1, ACCENT_PURPLE);
215+
line_y += 4;
216+
DrawTextEx(app_state->main_font, "WASD+Mouse Shift/Space",
217+
(Vector2){(f32)(help_x + UI_PANEL_PADDING), (f32)line_y}, FONT_SIZE_MEDIUM, 1, ACCENT_PURPLE);
203218
}
204219
}
205220
else

0 commit comments

Comments
 (0)