sgl

annotate src/sgl.c @ 5:0570e27e5ebc

pretty much done with the basic functionality and GLX shit
author John Tsiombikas <nuclear@siggraph.org>
date Fri, 13 May 2011 07:49:47 +0300
parents 648f8604d2b2
children edbfc96fe80d
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@4 12
nuclear@4 13 if(!(ws = sgl_wsys_module())) {
nuclear@4 14 return -1;
nuclear@4 15 }
nuclear@4 16 return ws->init();
nuclear@1 17 }
nuclear@1 18
nuclear@5 19 void sgl_quit(void)
nuclear@1 20 {
nuclear@4 21 ws->shutdown();
nuclear@1 22 }
nuclear@1 23
nuclear@4 24 int sgl_set_video_mode(int xsz, int ysz)
nuclear@1 25 {
nuclear@4 26 return ws->set_vidmode(xsz, ysz);
nuclear@1 27 }
nuclear@1 28
nuclear@4 29 int sgl_get_video_mode(int *xsz, int *ysz)
nuclear@1 30 {
nuclear@4 31 return ws->get_vidmode(xsz, ysz);
nuclear@1 32 }
nuclear@1 33
nuclear@4 34 int sgl_create_window(int xsz, int ysz, unsigned int mode)
nuclear@1 35 {
nuclear@4 36 return ws->create_window(xsz, ysz, mode);
nuclear@1 37 }
nuclear@4 38
nuclear@4 39 void sgl_close_window(int win)
nuclear@4 40 {
nuclear@4 41 ws->close_window(win);
nuclear@4 42 }
nuclear@4 43
nuclear@4 44 int sgl_set_active(int id)
nuclear@4 45 {
nuclear@4 46 return ws->set_active(id);
nuclear@4 47 }
nuclear@4 48
nuclear@4 49 int sgl_set_title(const char *str)
nuclear@4 50 {
nuclear@4 51 return ws->set_title(str);
nuclear@4 52 }
nuclear@4 53
nuclear@5 54 void sgl_redisplay(void)
nuclear@5 55 {
nuclear@5 56 ws->redisplay();
nuclear@5 57 }
nuclear@5 58
nuclear@5 59 void sgl_swap_buffers(void)
nuclear@5 60 {
nuclear@5 61 ws->swap_buffers();
nuclear@5 62 }
nuclear@5 63
nuclear@4 64 int sgl_process_events(void)
nuclear@4 65 {
nuclear@4 66 return ws->process_events();
nuclear@4 67 }
nuclear@5 68
nuclear@5 69 void sgl_event_loop(void)
nuclear@5 70 {
nuclear@5 71 while(ws->process_events() == 0);
nuclear@5 72 }