Cleaned up the activity buttons a bit.
This commit is contained in:
77
main.c
77
main.c
@@ -350,80 +350,23 @@ int main(int argc, char *argv[])
|
|||||||
activities_stats[activities[i].activity].total_seconds += activities[i].ended - activities[i].began;
|
activities_stats[activities[i].activity].total_seconds += activities[i].ended - activities[i].began;
|
||||||
}
|
}
|
||||||
|
|
||||||
Hours time = break_time(activities_stats[other].total_seconds);
|
for(U32 i = 0; i < activity_type_COUNT; i ++) {
|
||||||
snprintf(activities_stats[other].seconds_str, sizeof(activities_stats[other].seconds_str), "%02llu:%02llu:%02llu", time.hours, time.minutes, time.seconds);
|
Hours time = break_time(activities_stats[i].total_seconds);
|
||||||
if(activity_button(padding_x, 60, width, (window_h-70), "Other", activities_stats[other].seconds_str, font_size, (activities[current_activity].activity == other ? WHITE : BLACK), activity_type_color_representation[other])) {
|
snprintf(activities_stats[i].seconds_str, sizeof(activities_stats[i].seconds_str), "%02llu:%02llu:%02llu", time.hours, time.minutes, time.seconds);
|
||||||
if(activities[current_activity].activity != other) {
|
|
||||||
|
if(activity_button((padding_x*(i+1))+(width*i), 60, width, (window_h-70), activity_type_string_representation[i], activities_stats[i].seconds_str, font_size, (activities[current_activity].activity == i ? WHITE : BLACK), activity_type_color_representation[i])) {
|
||||||
|
if(activities[current_activity].activity != i) {
|
||||||
current_activity++;
|
current_activity++;
|
||||||
|
|
||||||
activities[current_activity].activity = other;
|
activities[current_activity].activity = i;
|
||||||
activities[current_activity].color = activity_type_color_representation[other];
|
activities[current_activity].color = activity_type_color_representation[i];
|
||||||
activities[current_activity].began = now_s;
|
activities[current_activity].began = now_s;
|
||||||
activities[current_activity].ended = now_s;
|
activities[current_activity].ended = now_s;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(activities[current_activity].activity == other)
|
if(activities[current_activity].activity == i)
|
||||||
DrawRectangleRoundedLinesEx((Rectangle){ padding_x, 60, width, (window_h-70) }, 0.2f, 100, 5.0f, WHITE);
|
DrawRectangleRoundedLinesEx((Rectangle){ (padding_x*(i+1))+(width*i), 60, width, (window_h-70) }, 0.2f, 100, 5.0f, WHITE);
|
||||||
|
|
||||||
time = break_time(activities_stats[work].total_seconds);
|
|
||||||
snprintf(activities_stats[work].seconds_str, sizeof(activities_stats[work].seconds_str), "%02llu:%02llu:%02llu", time.hours, time.minutes, time.seconds);
|
|
||||||
if(activity_button((padding_x*2)+(width*1), 60, width, (window_h-70), "Work", activities_stats[work].seconds_str, font_size, (activities[current_activity].activity == work ? WHITE : BLACK), activity_type_color_representation[work])) {
|
|
||||||
if(activities[current_activity].activity != work) {
|
|
||||||
current_activity++;
|
|
||||||
|
|
||||||
activities[current_activity].activity = work;
|
|
||||||
activities[current_activity].color = activity_type_color_representation[work];
|
|
||||||
activities[current_activity].began = now_s;
|
|
||||||
activities[current_activity].ended = now_s;
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if(activities[current_activity].activity == work)
|
|
||||||
DrawRectangleRoundedLinesEx((Rectangle){ (padding_x*2)+(width*1), 60, width, (window_h-70) }, 0.2f, 100, 5.0f, WHITE);
|
|
||||||
|
|
||||||
time = break_time(activities_stats[projects].total_seconds);
|
|
||||||
snprintf(activities_stats[projects].seconds_str, sizeof(activities_stats[projects].seconds_str), "%02llu:%02llu:%02llu", time.hours, time.minutes, time.seconds);
|
|
||||||
if(activity_button((padding_x*3)+(width*2), 60, width, (window_h-70), "Projects", activities_stats[projects].seconds_str, font_size, (activities[current_activity].activity == projects ? WHITE : BLACK), activity_type_color_representation[projects])) {
|
|
||||||
if(activities[current_activity].activity != projects) {
|
|
||||||
current_activity++;
|
|
||||||
|
|
||||||
activities[current_activity].activity = projects;
|
|
||||||
activities[current_activity].color = activity_type_color_representation[projects];
|
|
||||||
activities[current_activity].began = now_s;
|
|
||||||
activities[current_activity].ended = now_s;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(activities[current_activity].activity == projects)
|
|
||||||
DrawRectangleRoundedLinesEx((Rectangle){ (padding_x*3)+(width*2), 60, width, (window_h-70) }, 0.2f, 100, 5.0f, WHITE);
|
|
||||||
|
|
||||||
time = break_time(activities_stats[gaming].total_seconds);
|
|
||||||
snprintf(activities_stats[gaming].seconds_str, sizeof(activities_stats[gaming].seconds_str), "%02llu:%02llu:%02llu", time.hours, time.minutes, time.seconds);
|
|
||||||
if(activity_button((padding_x*4)+(width*3), 60, width, (window_h-70), "Gaming", activities_stats[gaming].seconds_str, font_size, (activities[current_activity].activity == gaming ? WHITE : BLACK), activity_type_color_representation[gaming])) {
|
|
||||||
if(activities[current_activity].activity != gaming) {
|
|
||||||
current_activity++;
|
|
||||||
|
|
||||||
activities[current_activity].activity = gaming;
|
|
||||||
activities[current_activity].color = activity_type_color_representation[gaming];
|
|
||||||
activities[current_activity].began = now_s;
|
|
||||||
activities[current_activity].ended = now_s;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(activities[current_activity].activity == gaming)
|
|
||||||
DrawRectangleRoundedLinesEx((Rectangle){ (padding_x*4)+(width*3), 60, width, (window_h-70) }, 0.2f, 100, 5.0f, WHITE);
|
|
||||||
|
|
||||||
time = break_time(activities_stats[exercise].total_seconds);
|
|
||||||
snprintf(activities_stats[exercise].seconds_str, sizeof(activities_stats[exercise].seconds_str), "%02llu:%02llu:%02llu", time.hours, time.minutes, time.seconds);
|
|
||||||
if(activity_button((padding_x*5)+(width*4), 60, width, (window_h-70), "Exercise", activities_stats[exercise].seconds_str, font_size, (activities[current_activity].activity == exercise ? WHITE : BLACK), activity_type_color_representation[exercise])) {
|
|
||||||
if(activities[current_activity].activity != exercise) {
|
|
||||||
current_activity++;
|
|
||||||
|
|
||||||
activities[current_activity].activity = exercise;
|
|
||||||
activities[current_activity].color = activity_type_color_representation[exercise];
|
|
||||||
activities[current_activity].began = now_s;
|
|
||||||
activities[current_activity].ended = now_s;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(activities[current_activity].activity == exercise)
|
|
||||||
DrawRectangleRoundedLinesEx((Rectangle){ (padding_x*5)+(width*4), 60, width, (window_h-70) }, 0.2f, 100, 5.0f, WHITE);
|
|
||||||
|
|
||||||
// DrawTextEx(state.font, "Hello, world! && How are you?", (Vector2){100, 400}, font_size, 2, BLUE);
|
// DrawTextEx(state.font, "Hello, world! && How are you?", (Vector2){100, 400}, font_size, 2, BLUE);
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
|
|||||||
Reference in New Issue
Block a user