Activity timeline popup is done.
This commit is contained in:
17
main.c
17
main.c
@@ -437,7 +437,6 @@ int main(int argc, char *argv[])
|
|||||||
DrawTextEx(state.font, index_buf, (Vector2){ rect.x + 10.0f, rect.y + 10.0f }, state.font_size - 5.0f, 2, BLACK);
|
DrawTextEx(state.font, index_buf, (Vector2){ rect.x + 10.0f, rect.y + 10.0f }, state.font_size - 5.0f, 2, BLACK);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Display a popup on mouse hover over activity line.
|
|
||||||
// NOTE: This is rendered last because a popup has to flow above everything else.
|
// NOTE: This is rendered last because a popup has to flow above everything else.
|
||||||
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));
|
||||||
@@ -445,18 +444,18 @@ int main(int argc, char *argv[])
|
|||||||
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: This should be its own component.
|
// TOOD: A general popup should be its own component.
|
||||||
char *str_activity_type = activity_type_string_representation[i];
|
char *str_activity_type = activity_type_string_representation[i];
|
||||||
Vector2 activity_type_d = MeasureTextEx(state.font, str_activity_type, state.font_size - 5.0f, 2);
|
|
||||||
|
|
||||||
DrawRectangleRounded((Rectangle){ start_x, 40, (F32)(activity_type_d.x), (F32)(activity_type_d.y) }, 0.3f, 100, BLACK);
|
Vector2 activity_type_d = MeasureTextEx(state.font, str_activity_type, state.font_size - 5.0f, 2);
|
||||||
DrawRectangleRoundedLinesEx((Rectangle){ start_x, 40, (F32)(activity_type_d.x), (F32)(activity_type_d.y) }, 0.3f, 100, 2.0f, DARKGRAY);
|
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);
|
||||||
|
DrawRectangleRounded((Rectangle){ start_x, 40, rect_w, (F32)(activity_time_d.y + activity_type_d.y) }, 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);
|
||||||
|
|
||||||
DrawTextEx(state.font, str_activity_type, (Vector2){ start_x, 40.0f }, state.font_size - 5.0f, 2, WHITE);
|
DrawTextEx(state.font, str_activity_type, (Vector2){ start_x, 40.0f }, state.font_size - 5.0f, 2, WHITE);
|
||||||
|
DrawTextEx(state.font, activities_stats[i].seconds_str, (Vector2){ start_x, 40.0f + (F32)(activity_type_d.y) }, state.font_size - 10.0f, 2, WHITE);
|
||||||
//local_persist char index_buf[8];
|
|
||||||
//snprintf(index_buf, sizeof(index_buf), "%d", i + 1);
|
|
||||||
//DrawTextEx(state.font, index_buf, (Vector2){ rect.x + 10.0f, rect.y + 10.0f }, state.font_size - 5.0f, 2, BLACK);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
|
|||||||
Reference in New Issue
Block a user