sgl
annotate 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 |
rev | line source |
---|---|
nuclear@1 | 1 #include "sgl.h" |
nuclear@4 | 2 #include "wsys.h" |
nuclear@1 | 3 |
nuclear@5 | 4 void sgl_modules_init(void); |
nuclear@3 | 5 |
nuclear@4 | 6 static struct wsys_module *ws; |
nuclear@4 | 7 |
nuclear@1 | 8 int sgl_init(void) |
nuclear@1 | 9 { |
nuclear@5 | 10 sgl_modules_init(); |
nuclear@3 | 11 sgl_sort_modules(); |
nuclear@7 | 12 sgl_print_modules(); |
nuclear@4 | 13 |
nuclear@4 | 14 if(!(ws = sgl_wsys_module())) { |
nuclear@4 | 15 return -1; |
nuclear@4 | 16 } |
nuclear@4 | 17 return ws->init(); |
nuclear@1 | 18 } |
nuclear@1 | 19 |
nuclear@5 | 20 void sgl_quit(void) |
nuclear@1 | 21 { |
nuclear@4 | 22 ws->shutdown(); |
nuclear@1 | 23 } |
nuclear@1 | 24 |
nuclear@4 | 25 int sgl_set_video_mode(int xsz, int ysz) |
nuclear@1 | 26 { |
nuclear@4 | 27 return ws->set_vidmode(xsz, ysz); |
nuclear@1 | 28 } |
nuclear@1 | 29 |
nuclear@4 | 30 int sgl_get_video_mode(int *xsz, int *ysz) |
nuclear@1 | 31 { |
nuclear@4 | 32 return ws->get_vidmode(xsz, ysz); |
nuclear@1 | 33 } |
nuclear@1 | 34 |
nuclear@4 | 35 int sgl_create_window(int xsz, int ysz, unsigned int mode) |
nuclear@1 | 36 { |
nuclear@4 | 37 return ws->create_window(xsz, ysz, mode); |
nuclear@1 | 38 } |
nuclear@4 | 39 |
nuclear@4 | 40 void sgl_close_window(int win) |
nuclear@4 | 41 { |
nuclear@4 | 42 ws->close_window(win); |
nuclear@4 | 43 } |
nuclear@4 | 44 |
nuclear@4 | 45 int sgl_set_active(int id) |
nuclear@4 | 46 { |
nuclear@4 | 47 return ws->set_active(id); |
nuclear@4 | 48 } |
nuclear@4 | 49 |
nuclear@4 | 50 int sgl_set_title(const char *str) |
nuclear@4 | 51 { |
nuclear@4 | 52 return ws->set_title(str); |
nuclear@4 | 53 } |
nuclear@4 | 54 |
nuclear@5 | 55 void sgl_redisplay(void) |
nuclear@5 | 56 { |
nuclear@5 | 57 ws->redisplay(); |
nuclear@5 | 58 } |
nuclear@5 | 59 |
nuclear@5 | 60 void sgl_swap_buffers(void) |
nuclear@5 | 61 { |
nuclear@5 | 62 ws->swap_buffers(); |
nuclear@5 | 63 } |
nuclear@5 | 64 |
nuclear@4 | 65 int sgl_process_events(void) |
nuclear@4 | 66 { |
nuclear@4 | 67 return ws->process_events(); |
nuclear@4 | 68 } |
nuclear@5 | 69 |
nuclear@5 | 70 void sgl_event_loop(void) |
nuclear@5 | 71 { |
nuclear@5 | 72 while(ws->process_events() == 0); |
nuclear@5 | 73 } |