Activities switch with numbers and display indeces.
This commit is contained in:
20
main.c
20
main.c
@@ -312,10 +312,22 @@ int main(int argc, char *argv[])
|
||||
|
||||
state.mouse_pos = GetMousePosition();
|
||||
|
||||
// TODO: Switch activities with number keys.
|
||||
if(IsKeyPressed(KEY_Q))
|
||||
break;
|
||||
|
||||
for(U32 i = 0; i < activity_type_COUNT; i++) {
|
||||
if(IsKeyPressed(KEY_ONE + i)) {
|
||||
current_activity++;
|
||||
|
||||
activities[current_activity].type = i;
|
||||
activities[current_activity].color =
|
||||
activity_type_color_representation[i];
|
||||
activities[current_activity].began = now_s;
|
||||
activities[current_activity].ended = now_s;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
activities[current_activity].ended = now_s;
|
||||
|
||||
BeginDrawing();
|
||||
@@ -374,6 +386,12 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
if(activities[current_activity].type == i)
|
||||
DrawRectangleRoundedLinesEx(rect, 0.2f, 100, 5.0f, WHITE);
|
||||
|
||||
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 },
|
||||
font_size - 5.0f, 2, BLACK);
|
||||
}
|
||||
EndDrawing();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user