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

44
src/event.h Normal file
View File

@@ -0,0 +1,44 @@
/**
* Copyright (c) 2016 rxi
*
* This library is free software; you can redistribute it and/or modify it
* under the terms of the MIT license. See LICENSE for details.
*/
#ifndef EVENT_H
#define EVENT_H
enum {
EVENT_NULL,
EVENT_KEYBOARD_PRESSED,
EVENT_KEYBOARD_RELEASED,
EVENT_KEYBOARD_TEXTINPUT,
EVENT_MOUSE_MOVED,
EVENT_MOUSE_PRESSED,
EVENT_MOUSE_RELEASED
};
typedef union {
int type;
struct {
int type;
int x, y;
int dx, dy;
int button;
} mouse;
struct {
int type;
const char *key;
char text[64];
int isrepeat;
} keyboard;
} event_t;
const char* event_typestr(int type);
int event_poll(event_t *e);
#endif