Added some spacing to the popup.
This commit is contained in:
@@ -441,8 +441,8 @@ int main(int argc, char *argv[])
|
|||||||
for(U32 i = 0; i <= current_activity; i++) {
|
for(U32 i = 0; i <= current_activity; i++) {
|
||||||
F32 start_x = floor((F32)(activities[i].began - lower_bound_s) / (F32)(upper_bound_s - lower_bound_s) * (F32)(state.window_w));
|
F32 start_x = floor((F32)(activities[i].began - lower_bound_s) / (F32)(upper_bound_s - lower_bound_s) * (F32)(state.window_w));
|
||||||
F32 end_x = floor(((F32)(activities[i].ended - lower_bound_s) / (F32)(upper_bound_s - lower_bound_s)) * (F32)(state.window_w));
|
F32 end_x = floor(((F32)(activities[i].ended - lower_bound_s) / (F32)(upper_bound_s - lower_bound_s)) * (F32)(state.window_w));
|
||||||
Rectangle rect = {start_x, 0, end_x - start_x, 40};
|
|
||||||
|
|
||||||
|
Rectangle rect = { start_x, 0, end_x - start_x, 40 };
|
||||||
if(CheckCollisionPointRec(state.mouse_pos, rect)) {
|
if(CheckCollisionPointRec(state.mouse_pos, rect)) {
|
||||||
// TOOD: A general popup should be its own component.
|
// TOOD: A general popup should be its own component.
|
||||||
char *str_activity_type = activity_type_string_representation[activities[i].type];
|
char *str_activity_type = activity_type_string_representation[activities[i].type];
|
||||||
@@ -450,18 +450,16 @@ int main(int argc, char *argv[])
|
|||||||
Vector2 activity_type_d = MeasureTextEx(state.font, str_activity_type, state.font_size - 5.0f, 2);
|
Vector2 activity_type_d = MeasureTextEx(state.font, str_activity_type, state.font_size - 5.0f, 2);
|
||||||
Vector2 activity_time_d = MeasureTextEx(state.font, activities_stats[i].seconds_str, state.font_size - 10.0f, 2);
|
Vector2 activity_time_d = MeasureTextEx(state.font, activities_stats[i].seconds_str, state.font_size - 10.0f, 2);
|
||||||
|
|
||||||
S32 rect_w = (S32)((activity_type_d.x >= activity_time_d.x) ? activity_type_d.x : activity_time_d.x);
|
S32 rect_w = (S32)((activity_type_d.x >= activity_time_d.x) ? activity_type_d.x + 10.0f : activity_time_d.x + 10.0f);
|
||||||
DrawRectangleRounded((Rectangle){ start_x, 40, rect_w, (F32)(activity_time_d.y + activity_type_d.y) }, 0.3f, 100, BLACK);
|
DrawRectangleRounded((Rectangle){ start_x, 40, rect_w, (F32)(activity_time_d.y + activity_type_d.y + 10.0f) }, 0.3f, 100, BLACK);
|
||||||
DrawRectangleRoundedLinesEx((Rectangle){ start_x, 40, rect_w, (F32)(activity_time_d.y + activity_type_d.y) }, 0.3f, 100, 2.0f, DARKGRAY);
|
DrawRectangleRoundedLinesEx((Rectangle){ start_x, 40, rect_w, (F32)(activity_time_d.y + activity_type_d.y + 10.0f) }, 0.3f, 100, 2.0f, DARKGRAY);
|
||||||
|
|
||||||
local_persist char buffer[24];
|
local_persist char buffer[24];
|
||||||
Hours time = break_time(activities[i].ended - activities[i].began);
|
Hours time = break_time(activities[i].ended - activities[i].began);
|
||||||
snprintf(buffer, sizeof(buffer), "%02llu:%02llu:%02llu", time.hours, time.minutes, time.seconds);
|
snprintf(buffer, sizeof(buffer), "%02llu:%02llu:%02llu", time.hours, time.minutes, time.seconds);
|
||||||
|
|
||||||
// FIXME: We are pulling the aggregate seconds here from the activity statisctics. This is wrong.
|
DrawTextEx(state.font, str_activity_type, (Vector2){ start_x + 5.0f, 40.0f + 5.0f }, state.font_size - 5.0f, 2, WHITE);
|
||||||
// FIXME: The moreover
|
DrawTextEx(state.font, buffer, (Vector2){ start_x + 5.0f, 40.0f + (F32)(activity_type_d.y) }, state.font_size - 10.0f, 2, WHITE);
|
||||||
DrawTextEx(state.font, str_activity_type, (Vector2){ start_x, 40.0f }, state.font_size - 5.0f, 2, WHITE);
|
|
||||||
DrawTextEx(state.font, buffer, (Vector2){ start_x, 40.0f + (F32)(activity_type_d.y) }, state.font_size - 10.0f, 2, WHITE);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
|
|||||||
Reference in New Issue
Block a user