summaryrefslogtreecommitdiffstats
path: root/sdl/platform.c
diff options
context:
space:
mode:
Diffstat (limited to 'sdl/platform.c')
-rw-r--r--sdl/platform.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/sdl/platform.c b/sdl/platform.c
index ea9dce6..138596a 100644
--- a/sdl/platform.c
+++ b/sdl/platform.c
@@ -12,11 +12,13 @@
#include <SDL/SDL_image.h>
#include <GL/glew.h>
#include <string.h>
+#include "event.h"
#include "gldraw.h"
#include "gltools.h"
#include "luatools.h"
#include "platform.h"
#include "sdltools.h"
+#include "window.h"
/* few light arrays */
const GLfloat fNoLight[] = { 0.0f, 0.0f, 0.0f, 1.0f };
@@ -40,6 +42,8 @@ extern unsigned int maxfps_w;
void platform_init(struct platform *p)
{
+ int ret;
+
/* Lua */
/* create new lua state */
p->L = luaL_newstate();
@@ -63,6 +67,14 @@ void platform_init(struct platform *p)
/* set the camera to <0,0,0> */
glframe_reset(&p->camera);
+ /* setup and init the event handler */
+ struct event_vtbl event_tbl;
+ memset(&event_tbl, 0, sizeof(event_tbl));
+ event_tbl.keydown = event_keydown;
+ ret = event_handler_init(&event_tbl);
+ if (ret == -1)
+ fprintf(stderr, "platform: warning, failed to init event handler\n");
+
/* init client */
p->client_init(p->c);
}