summaryrefslogtreecommitdiffstats
path: root/sdl/event.h
blob: 30669de680021a036ffeae33c8dd60fc21f42cff (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#ifndef _EVENT_H_
#define _EVENT_H_

struct platform;

/* a table holding function pointers to functions that handle events */
struct event_vtbl
{
    void (*keydown)(SDL_keysym *);
    void (*windowresize)(int, int);
    void (*quit)(void);
};

struct event_handler
{
    struct event_vtbl funcs;     /* table of event function handlers */
    unsigned int keys_held[323]; /* keep track of the keys that were held */

    struct platform *p;          /* reference to the host platform */
    int key_held;                /* helper flag */
};

/* function prototypes */
int event_handler_init(struct platform *, struct event_vtbl *);
void sdl_process_events(void);
void event_keydown(SDL_keysym *);

void event_keydown_gen(SDL_keysym *);
void event_quit_gen(void);

#endif