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();
|
state.mouse_pos = GetMousePosition();
|
||||||
|
|
||||||
// TODO: Switch activities with number keys.
|
|
||||||
if(IsKeyPressed(KEY_Q))
|
if(IsKeyPressed(KEY_Q))
|
||||||
break;
|
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;
|
activities[current_activity].ended = now_s;
|
||||||
|
|
||||||
BeginDrawing();
|
BeginDrawing();
|
||||||
@@ -374,6 +386,12 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
if(activities[current_activity].type == i)
|
if(activities[current_activity].type == i)
|
||||||
DrawRectangleRoundedLinesEx(rect, 0.2f, 100, 5.0f, WHITE);
|
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();
|
EndDrawing();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user