Add cursor support

This commit is contained in:
2023-12-07 19:24:29 +01:00
parent f27718cdbf
commit b410867902
4 changed files with 75 additions and 41 deletions

View File

@@ -17,7 +17,7 @@ typedef enum InputType {
#define MOUSE_BUTTON_COUNT (MOUSE_BUTTON_BACK + 1)
#define CLICK_LIMIT 0.2f
#define CLICK_LIMIT 0.12f
#define BUTTON_COUNT (MOUSE_BUTTON_BACK + 1)
typedef struct InputMapping {
@@ -41,6 +41,11 @@ typedef struct InputState {
Vector2 mouse;
Vector2 mouseWorld;
f32 mouseDownElapsed[BUTTON_COUNT];
enum {
CURSOR_NONE,
CURSOR_COLLECT_WOOD,
} cursor;
// INPUT_BUILDING
int building;
bool buildingCanPlace;
@@ -49,6 +54,11 @@ typedef struct InputState {
// SELECTED_UNITS
Rectangle pickArea;
// SELECTED_OBJECT
// SELECTED_BUILDING
// Other
struct {
/* Selected units
* 1: Position
@@ -58,8 +68,6 @@ typedef struct InputState {
ecs_query_t *selected;
//ecs_query_t *selectedBuilding;
} queries;
// SELECTED_OBJECT
// SELECTED_BUILDING
} InputState;
static InputMapping inputDefaultMapping() {