Added new activity and fixed a small bug.

This commit is contained in:
2026-02-15 11:46:27 -08:00
parent de7324fc90
commit 7b4b1904c7

8
main.c
View File

@@ -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.