Add basic input system

This commit is contained in:
2023-11-23 11:07:46 +01:00
parent 36690f8066
commit 19d84a5dbb
5 changed files with 280 additions and 82 deletions

View File

@@ -19,7 +19,7 @@ typedef struct InputState {
MouseButton RMB;
MouseButton MMB;
KeyboardKey ESC;
f32 DRAG_LIMIT;
f32 CLICK_LIMIT;
// Common
Vector2 mouseDown;
Vector2 mouseDownWorld;
@@ -30,7 +30,8 @@ typedef struct InputState {
TilePosition buildingPos;
TileSize buildingSize;
// SELECTED_UNITS
// SELECTED_OBJECTS
ecs_entity_t *entities;
// SELECTED_OBJECT
// SELECTED_BUILDING
} InputState;
@@ -43,7 +44,6 @@ typedef struct Game {
BzSpatialGrid *entityGrid;
f32 frameDuration;
ecs_entity_t entity;
InputState input;
struct {
i64 wood;
i64 iron;
@@ -66,5 +66,6 @@ typedef struct Game {
extern ecs_world_t *ECS;
extern ECS_COMPONENT_DECLARE(Game);
extern ECS_COMPONENT_DECLARE(InputState);
#endif //PIXELDEFENSE_GAME_STATE_H