sgl

view include/sgl.h @ 21:5d38efd33da0

fixed a bug which prevented wsys_x11 to set the initial window title correctly
author John Tsiombikas <nuclear@member.fsf.org>
date Sun, 26 Jun 2011 08:01:55 +0300
parents 0cb438c86b98
children 9841c90ec769
line source
1 #ifndef SGL_H_
2 #define SGL_H_
4 #define SGL_DOUBLE 1
5 #define SGL_DEPTH 2
6 #define SGL_STENCIL 4
7 #define SGL_STEREO 8
8 #define SGL_MULTISAMPLE 16
10 typedef void (*sgl_create_callback_t)(int);
11 typedef void (*sgl_close_callback_t)(int);
12 typedef void (*sgl_display_callback_t)(void);
13 typedef void (*sgl_reshape_callback_t)(int, int);
14 typedef void (*sgl_keyboard_callback_t)(int, int);
15 typedef void (*sgl_mouse_callback_t)(int, int, int, int, int);
16 typedef void (*sgl_motion_callback_t)(int, int, int);
17 typedef void (*sgl_passive_callback_t)(int, int, int);
18 typedef void (*sgl_idle_callback_t)(void);
20 enum {
21 SGL_CREATE,
22 SGL_CLOSE,
23 SGL_DISPLAY,
24 SGL_RESHAPE,
25 SGL_KEYBOARD,
26 SGL_MOUSE,
27 SGL_MOTION,
28 SGL_PASSIVE,
29 SGL_IDLE,
31 SGL_NUM_CALLBACKS
32 };
34 enum {
35 SGL_LEFT_BUTTON,
36 SGL_MIDDLE_BUTTON,
37 SGL_RIGHT_BUTTON
38 };
40 /* these values happen to coincide with X11 keysyms */
41 #define SGL_KEY_LSHIFT 0xffe1
42 #define SGL_KEY_RSHIFT 0xffe2
43 #define SGL_KEY_LCONTROL 0xffe3
44 #define SGL_KEY_RCONTROL 0xffe4
45 #define SGL_KEY_LALT 0xffe9
46 #define SGL_KEY_RALT 0xffea
48 /* for the sgl_modifiers bitmask */
49 #define SGL_MOD_SHIFT 1
50 #define SGL_MOD_CONTROL 2
51 #define SGL_MOD_ALT 4
53 int sgl_init(void);
54 void sgl_quit(void);
56 int sgl_set_video_mode(int xsz, int ysz);
57 int sgl_get_video_mode(int *xsz, int *ysz);
59 int sgl_create_window(int xsz, int ysz, unsigned int mode);
60 void sgl_close_window(int win);
62 int sgl_set_active(int id);
63 int sgl_set_title(const char *str);
65 void sgl_redisplay(void);
66 void sgl_swap_buffers(void);
68 int sgl_modifiers(void);
70 int sgl_process_events(void);
71 void sgl_event_loop(void);
73 int sgl_push_callbacks(void);
74 int sgl_pop_callbacks(void);
75 void sgl_clear_callbacks(void);
76 void sgl_set_callback(int idx, void (*func)());
77 void (*sgl_get_callback(int idx))();
79 void sgl_create_callback(sgl_create_callback_t func);
80 void sgl_close_callback(sgl_close_callback_t func);
81 void sgl_display_callback(sgl_display_callback_t func);
82 void sgl_reshape_callback(sgl_reshape_callback_t func);
83 void sgl_keyboard_callback(sgl_keyboard_callback_t func);
84 void sgl_mouse_callback(sgl_mouse_callback_t func);
85 void sgl_motion_callback(sgl_motion_callback_t func);
86 void sgl_passive_callback(sgl_passive_callback_t func);
87 void sgl_idle_callback(sgl_idle_callback_t func);
89 #endif /* SGL_H_ */