Added event.c/h and lua binding

* Changed mouse.c to mimic keyboard.c
* Changed boot.lua to use event.poll() instead of mouse/keyboard.poll()
* Removed love.keyboard.poll()
This commit is contained in:
rxi
2016-10-15 17:40:23 +01:00
parent d8210bfc35
commit a5c66d6154
9 changed files with 302 additions and 149 deletions

View File

@@ -5,20 +5,27 @@ enum {
MOUSE_BUTTON_LEFT,
MOUSE_BUTTON_RIGHT,
MOUSE_BUTTON_MIDDLE,
MOUSE_BUTTON_MAX,
MOUSE_BUTTON_MAX
};
enum {
MOUSE_PRESSED,
MOUSE_RELEASED,
MOUSE_MOVED
};
typedef struct {
int inited;
int type;
int x, y;
int lastX, lastY;
int buttonsPressed[MOUSE_BUTTON_MAX];
int buttonsReleased[MOUSE_BUTTON_MAX];
int buttonsDown[MOUSE_BUTTON_MAX];
} mouse_State;
int dx, dy;
int button;
} mouse_Event;
void mouse_init(void);
void mouse_update(void);
mouse_State* mouse_getState(void);
int mouse_poll(mouse_Event *e);
int mouse_isDown(int button);
int mouse_getX(void);
int mouse_getY(void);
#endif