33897dc4dfb614db4c13b9cd648a907a058d05ba
[vrtris] / src / screen.h
1 #ifndef SCREEN_H_
2 #define SCREEN_H_
3
4 struct game_screen {
5         const char *name;
6         int opaque;     /* if 0, the next screen is visible, so keep update/drawing it */
7
8         struct game_screen *next;
9
10         int (*init)(void);
11         void (*cleanup)(void);
12
13         void (*start)(void);
14         void (*stop)(void);
15
16         void (*update)(float dt);
17         void (*draw)(void);
18         void (*reshape)(int, int);
19         /* these functions return 1 if they handled the event, or 0
20          * if it should propagate to the next screen in the stack */
21         int (*keyboard)(int, int);
22         int (*mouse)(int, int, int, int);
23         int (*motion)(int, int);
24         int (*wheel)(int dir);
25 };
26
27 /* this always points to the top screen on the stack
28  * there's always at least one screen, this will never be null
29  */
30 struct game_screen *screen;
31
32 int init_screens(void);
33 void cleanup_screens(void);
34 void reshape_screens(int x, int y);
35
36 void push_screen(struct game_screen *s);
37 int pop_screen(void);
38
39 #endif  /* SCREEN_H_ */