From 7b4b1904c72f8cb3e6f40ce07e31dfb641cb6868 Mon Sep 17 00:00:00 2001 From: igor Date: Sun, 15 Feb 2026 11:46:27 -0800 Subject: [PATCH] Added new activity and fixed a small bug. --- main.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/main.c b/main.c index c8692f4..7f7f6ea 100644 --- a/main.c +++ b/main.c @@ -133,15 +133,16 @@ typedef enum activity_type { projects, gaming, exercise, + reading, activity_type_COUNT } activity_type; char *activity_type_string_representation[activity_type_COUNT] = { - "Other", "Work", "Projects", "Gaming", "Exercise" + "Other", "Work", "Projects", "Gaming", "Exercise", "Reading" }; Color activity_type_color_representation[activity_type_COUNT] = { - RED, BLUE, ORANGE, GREEN, PURPLE + RED, BLUE, ORANGE, GREEN, PURPLE, YELLOW }; // TODO: String representation. @@ -342,7 +343,7 @@ int main(int argc, char *argv[]) } // TODO: CLEAN UP. - F32 width = (window_w-padding_x*6.0f) / 5.0f; + F32 width = (window_w-padding_x*(float)(activity_type_COUNT+1)) / (float)activity_type_COUNT; for(U32 i = 0; i <= current_activity; i++) { activities_stats[activities[i].type].total_seconds += activities[i].ended - activities[i].began; @@ -374,6 +375,7 @@ int main(int argc, char *argv[]) activities_stats[activities[i].type].total_seconds = 0; } + // WARNING: This is error prone. // Save the state every 5 seconds. if((now_s - last_save) >= 5) { f = freopen(file_buffer, "w", f); // WARNING: TODO: Might fail.