Added activity activity outline.
This commit is contained in:
26
main.c
26
main.c
@@ -92,7 +92,7 @@ char my_button(int x, int y, int width, int height, int font_size, char *title)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
char activity_button(int x, int y, int width, int height, char *title, char *subtitle, F32 font_size, Color color)
|
char activity_button(int x, int y, int width, int height, char *title, char *subtitle, F32 font_size, Color font_color, Color background_color)
|
||||||
{
|
{
|
||||||
char button_pressed = 0;
|
char button_pressed = 0;
|
||||||
|
|
||||||
@@ -110,7 +110,7 @@ char activity_button(int x, int y, int width, int height, char *title, char *sub
|
|||||||
button_pressed = 1;
|
button_pressed = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
DrawRectangleRounded(rect, 0.2f, 100, color);
|
DrawRectangleRounded(rect, 0.2f, 100, background_color);
|
||||||
DrawTextEx(state.font, title,
|
DrawTextEx(state.font, title,
|
||||||
(Vector2){
|
(Vector2){
|
||||||
(rect.x + rect.width / 2.0f - title_font_d.x / 2.0f),
|
(rect.x + rect.width / 2.0f - title_font_d.x / 2.0f),
|
||||||
@@ -120,7 +120,7 @@ char activity_button(int x, int y, int width, int height, char *title, char *sub
|
|||||||
(Vector2){
|
(Vector2){
|
||||||
(rect.x + rect.width / 2.0f - subtitle_font_d.x / 2.0f),
|
(rect.x + rect.width / 2.0f - subtitle_font_d.x / 2.0f),
|
||||||
(rect.y + rect.height / 2.0f - subtitle_font_d.y / 2.0f) + 20.0f
|
(rect.y + rect.height / 2.0f - subtitle_font_d.y / 2.0f) + 20.0f
|
||||||
}, subtitle_font_size, 2, BLACK); // WARNING: Substracting from font size like that is unsafe.
|
}, subtitle_font_size, 2, font_color); // WARNING: Substracting from font size like that is unsafe.
|
||||||
|
|
||||||
return button_pressed;
|
return button_pressed;
|
||||||
}
|
}
|
||||||
@@ -352,7 +352,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
Hours time = break_time(activities_stats[other].total_seconds);
|
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);
|
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, RED)) {
|
if(activity_button(padding_x, 60, width, (window_h-70), "Other", activities_stats[other].seconds_str, font_size, BLACK, RED)) {
|
||||||
if(activities[current_activity].activity != other) {
|
if(activities[current_activity].activity != other) {
|
||||||
current_activity++;
|
current_activity++;
|
||||||
|
|
||||||
@@ -362,10 +362,12 @@ int main(int argc, char *argv[])
|
|||||||
activities[current_activity].ended = now_s;
|
activities[current_activity].ended = now_s;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(activities[current_activity].activity == other)
|
||||||
|
DrawRectangleRoundedLinesEx((Rectangle){ padding_x, 60, width, (window_h-70) }, 0.2f, 100, 5.0f, WHITE);
|
||||||
|
|
||||||
time = break_time(activities_stats[work].total_seconds);
|
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);
|
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, BLUE)) {
|
if(activity_button((padding_x*2)+(width*1), 60, width, (window_h-70), "Work", activities_stats[work].seconds_str, font_size, BLACK, BLUE)) {
|
||||||
if(activities[current_activity].activity != work) {
|
if(activities[current_activity].activity != work) {
|
||||||
current_activity++;
|
current_activity++;
|
||||||
|
|
||||||
@@ -375,10 +377,12 @@ int main(int argc, char *argv[])
|
|||||||
activities[current_activity].ended = 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);
|
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);
|
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, YELLOW)) {
|
if(activity_button((padding_x*3)+(width*2), 60, width, (window_h-70), "Projects", activities_stats[projects].seconds_str, font_size, BLACK, YELLOW)) {
|
||||||
if(activities[current_activity].activity != projects) {
|
if(activities[current_activity].activity != projects) {
|
||||||
printf("Activity PROJECTS\n");
|
printf("Activity PROJECTS\n");
|
||||||
|
|
||||||
@@ -390,10 +394,12 @@ int main(int argc, char *argv[])
|
|||||||
activities[current_activity].ended = 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);
|
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);
|
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, GREEN)) {
|
if(activity_button((padding_x*4)+(width*3), 60, width, (window_h-70), "Gaming", activities_stats[gaming].seconds_str, font_size, BLACK, GREEN)) {
|
||||||
if(activities[current_activity].activity != gaming) {
|
if(activities[current_activity].activity != gaming) {
|
||||||
printf("Activity GAMING\n");
|
printf("Activity GAMING\n");
|
||||||
|
|
||||||
@@ -405,10 +411,12 @@ int main(int argc, char *argv[])
|
|||||||
activities[current_activity].ended = 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);
|
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);
|
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, PURPLE)) {
|
if(activity_button((padding_x*5)+(width*4), 60, width, (window_h-70), "Exercise", activities_stats[exercise].seconds_str, font_size, BLACK, PURPLE)) {
|
||||||
if(activities[current_activity].activity != exercise) {
|
if(activities[current_activity].activity != exercise) {
|
||||||
printf("Activity EXERCISE\n");
|
printf("Activity EXERCISE\n");
|
||||||
|
|
||||||
@@ -420,6 +428,8 @@ int main(int argc, char *argv[])
|
|||||||
activities[current_activity].ended = 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