The title of activity changes when current changes.
This commit is contained in:
30
main.c
30
main.c
@@ -115,7 +115,7 @@ char activity_button(int x, int y, int width, int height, char *title, char *sub
|
||||
(Vector2){
|
||||
(rect.x + rect.width / 2.0f - title_font_d.x / 2.0f),
|
||||
(rect.y + rect.height / 2.0f - title_font_d.y / 2.0f)
|
||||
}, font_size, 2, BLACK);
|
||||
}, font_size, 2, font_color);
|
||||
DrawTextEx(state.font, subtitle,
|
||||
(Vector2){
|
||||
(rect.x + rect.width / 2.0f - subtitle_font_d.x / 2.0f),
|
||||
@@ -143,7 +143,7 @@ char *activity_type_string_representation[activity_type_COUNT] = {
|
||||
};
|
||||
|
||||
Color activity_type_color_representation[activity_type_COUNT] = {
|
||||
RED, BLUE, YELLOW, GREEN, PURPLE
|
||||
RED, BLUE, ORANGE, GREEN, PURPLE
|
||||
};
|
||||
|
||||
// TODO: String representation.
|
||||
@@ -352,12 +352,12 @@ int main(int argc, char *argv[])
|
||||
|
||||
Hours time = break_time(activities_stats[other].total_seconds);
|
||||
snprintf(activities_stats[other].seconds_str, sizeof(activities_stats[other].seconds_str), "%02llu:%02llu:%02llu", time.hours, time.minutes, time.seconds);
|
||||
if(activity_button(padding_x, 60, width, (window_h-70), "Other", activities_stats[other].seconds_str, font_size, BLACK, RED)) {
|
||||
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])) {
|
||||
if(activities[current_activity].activity != other) {
|
||||
current_activity++;
|
||||
|
||||
activities[current_activity].activity = other;
|
||||
activities[current_activity].color = RED;
|
||||
activities[current_activity].color = activity_type_color_representation[other];
|
||||
activities[current_activity].began = now_s;
|
||||
activities[current_activity].ended = now_s;
|
||||
}
|
||||
@@ -367,12 +367,12 @@ int main(int argc, char *argv[])
|
||||
|
||||
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, BLACK, BLUE)) {
|
||||
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 = BLUE;
|
||||
activities[current_activity].color = activity_type_color_representation[work];
|
||||
activities[current_activity].began = now_s;
|
||||
activities[current_activity].ended = now_s;
|
||||
}
|
||||
@@ -382,14 +382,12 @@ int main(int argc, char *argv[])
|
||||
|
||||
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, BLACK, YELLOW)) {
|
||||
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) {
|
||||
printf("Activity PROJECTS\n");
|
||||
|
||||
current_activity++;
|
||||
|
||||
activities[current_activity].activity = projects;
|
||||
activities[current_activity].color = YELLOW;
|
||||
activities[current_activity].color = activity_type_color_representation[projects];
|
||||
activities[current_activity].began = now_s;
|
||||
activities[current_activity].ended = now_s;
|
||||
}
|
||||
@@ -399,14 +397,12 @@ int main(int argc, char *argv[])
|
||||
|
||||
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, BLACK, GREEN)) {
|
||||
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) {
|
||||
printf("Activity GAMING\n");
|
||||
|
||||
current_activity++;
|
||||
|
||||
activities[current_activity].activity = gaming;
|
||||
activities[current_activity].color = GREEN;
|
||||
activities[current_activity].color = activity_type_color_representation[gaming];
|
||||
activities[current_activity].began = now_s;
|
||||
activities[current_activity].ended = now_s;
|
||||
}
|
||||
@@ -416,14 +412,12 @@ int main(int argc, char *argv[])
|
||||
|
||||
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, BLACK, PURPLE)) {
|
||||
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) {
|
||||
printf("Activity EXERCISE\n");
|
||||
|
||||
current_activity++;
|
||||
|
||||
activities[current_activity].activity = exercise;
|
||||
activities[current_activity].color = PURPLE;
|
||||
activities[current_activity].color = activity_type_color_representation[exercise];
|
||||
activities[current_activity].began = now_s;
|
||||
activities[current_activity].ended = now_s;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user