From 14526bf7bbea0439e1eda93b4c4d25799b58b863 Mon Sep 17 00:00:00 2001 From: cinnaboot Date: Fri, 30 Jan 2026 10:12:37 -0500 Subject: [PATCH] Extract child indicator constants from magic numbers --- docs/planning/rendering-cleanup-plan.md | 2 +- src/renderer.cpp | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/docs/planning/rendering-cleanup-plan.md b/docs/planning/rendering-cleanup-plan.md index fc4af6a..08022ef 100644 --- a/docs/planning/rendering-cleanup-plan.md +++ b/docs/planning/rendering-cleanup-plan.md @@ -70,7 +70,7 @@ Remove all spacecraft texture-related code: - Replace magic numbers in all UI rendering functions - **PAUSE** for user review -### Step 7: Extract Child Indicator Constants +### Step 7: Extract Child Indicator Constants [COMPLETED] - Add constants to renderer.cpp: - `CHILD_INDICATOR_RADIUS = 20.0f` - `CHILD_INDICATOR_FONT_SIZE = 10` diff --git a/src/renderer.cpp b/src/renderer.cpp index 92cf18f..1c8a9a8 100644 --- a/src/renderer.cpp +++ b/src/renderer.cpp @@ -29,6 +29,10 @@ #define MIN_DISTANCE_SPACECRAFT_PARENT_RADIUS_MULT 0.1f #define CAMERA_NEAR_CULL_DISTANCE 0.05f +// Child indicator constants +#define CHILD_INDICATOR_RADIUS 20.0f +#define CHILD_INDICATOR_FONT_SIZE 10 + // Zoom direction enumeration for improved readability enum ZoomDirection { ZOOM_IN = 1, @@ -47,11 +51,9 @@ enum ZoomDirection { static Vector3 sim_to_render(Vec3 pos, double scale); static void draw_child_indicator(Vector2 screen_pos, const char* name, Color color) { - const float radius = 20.0f; - - DrawCircleLinesV(screen_pos, radius, color); + DrawCircleLinesV(screen_pos, CHILD_INDICATOR_RADIUS, color); - int font_size = 10; + int font_size = CHILD_INDICATOR_FONT_SIZE; int text_width = MeasureText(name, font_size); Vector2 text_pos = {screen_pos.x - text_width/2, screen_pos.y - font_size/2}; DrawText(name, (int)text_pos.x, (int)text_pos.y, font_size, color);