sgl

view src/sgl.c @ 7:edbfc96fe80d

glut wsys thingy and stuff...
author John Tsiombikas <nuclear@siggraph.org>
date Sat, 14 May 2011 08:26:10 +0300
parents 0570e27e5ebc
children
line source
1 #include "sgl.h"
2 #include "wsys.h"
4 void sgl_modules_init(void);
6 static struct wsys_module *ws;
8 int sgl_init(void)
9 {
10 sgl_modules_init();
11 sgl_sort_modules();
12 sgl_print_modules();
14 if(!(ws = sgl_wsys_module())) {
15 return -1;
16 }
17 return ws->init();
18 }
20 void sgl_quit(void)
21 {
22 ws->shutdown();
23 }
25 int sgl_set_video_mode(int xsz, int ysz)
26 {
27 return ws->set_vidmode(xsz, ysz);
28 }
30 int sgl_get_video_mode(int *xsz, int *ysz)
31 {
32 return ws->get_vidmode(xsz, ysz);
33 }
35 int sgl_create_window(int xsz, int ysz, unsigned int mode)
36 {
37 return ws->create_window(xsz, ysz, mode);
38 }
40 void sgl_close_window(int win)
41 {
42 ws->close_window(win);
43 }
45 int sgl_set_active(int id)
46 {
47 return ws->set_active(id);
48 }
50 int sgl_set_title(const char *str)
51 {
52 return ws->set_title(str);
53 }
55 void sgl_redisplay(void)
56 {
57 ws->redisplay();
58 }
60 void sgl_swap_buffers(void)
61 {
62 ws->swap_buffers();
63 }
65 int sgl_process_events(void)
66 {
67 return ws->process_events();
68 }
70 void sgl_event_loop(void)
71 {
72 while(ws->process_events() == 0);
73 }