Improve input processing
This commit is contained in:
@@ -4,48 +4,6 @@
|
||||
#include <breeze.h>
|
||||
#include <flecs.h>
|
||||
|
||||
typedef enum InputType {
|
||||
INPUT_NONE,
|
||||
INPUT_BUILDING,
|
||||
INPUT_SELECTED_UNITS,
|
||||
INPUT_SELECTED_OBJECT,
|
||||
INPUT_SELECTED_BUILDING,
|
||||
} InputType;
|
||||
|
||||
typedef struct InputState {
|
||||
InputType state;
|
||||
// Input mapping
|
||||
MouseButton LMB;
|
||||
MouseButton RMB;
|
||||
MouseButton MMB;
|
||||
KeyboardKey ESC;
|
||||
f32 CLICK_LIMIT;
|
||||
// Common
|
||||
Vector2 mouseDown;
|
||||
Vector2 mouseDownWorld;
|
||||
f32 mouseDownElapsed;
|
||||
// INPUT_BUILDING
|
||||
int building;
|
||||
bool buildingCanPlace;
|
||||
TilePosition buildingPos;
|
||||
TileSize buildingSize;
|
||||
// Units
|
||||
Rectangle pickArea;
|
||||
|
||||
struct {
|
||||
/* Selected units
|
||||
* 1: Position
|
||||
* 2: Size
|
||||
* 3: UnitSelected
|
||||
*/
|
||||
ecs_query_t *selected;
|
||||
//ecs_query_t *selectedBuilding;
|
||||
} queries;
|
||||
Position *unitPositions;
|
||||
// SELECTED_OBJECT
|
||||
// SELECTED_BUILDING
|
||||
} InputState;
|
||||
|
||||
typedef struct Game {
|
||||
Camera2D camera;
|
||||
BzTileset terrainTileset;
|
||||
@@ -77,7 +35,6 @@ typedef struct Game {
|
||||
|
||||
extern ecs_world_t *ECS;
|
||||
|
||||
extern ECS_COMPONENT_DECLARE(Game);
|
||||
extern ECS_COMPONENT_DECLARE(InputState);
|
||||
extern ECS_COMPONENT_DECLARE(Game); // defined in main.c
|
||||
|
||||
#endif //PIXELDEFENSE_GAME_STATE_H
|
||||
|
||||
Reference in New Issue
Block a user