sgl

diff src/sgl.c @ 4:648f8604d2b2

cont. x11 module
author John Tsiombikas <nuclear@siggraph.org>
date Thu, 12 May 2011 11:04:10 +0300
parents 1b6c5dadb460
children 0570e27e5ebc
line diff
     1.1 --- a/src/sgl.c	Wed May 11 09:09:43 2011 +0300
     1.2 +++ b/src/sgl.c	Thu May 12 11:04:10 2011 +0300
     1.3 @@ -1,29 +1,57 @@
     1.4  #include "sgl.h"
     1.5 +#include "wsys.h"
     1.6  
     1.7  void sgl_register_modules(void);
     1.8  
     1.9 +static struct wsys_module *ws;
    1.10 +
    1.11  int sgl_init(void)
    1.12  {
    1.13  	sgl_register_modules();
    1.14  	sgl_sort_modules();
    1.15 -	return 0;
    1.16 +
    1.17 +	if(!(ws = sgl_wsys_module())) {
    1.18 +		return -1;
    1.19 +	}
    1.20 +	return ws->init();
    1.21  }
    1.22  
    1.23 -int sgl_set_video_mode(int xsz, int ysz, int bpp)
    1.24 +void sgl_shutdown(void)
    1.25  {
    1.26 -	return 0;
    1.27 +	ws->shutdown();
    1.28  }
    1.29  
    1.30 -int sgl_get_video_mode(int *xsz, int *ysz, int *bpp)
    1.31 +int sgl_set_video_mode(int xsz, int ysz)
    1.32  {
    1.33 -	return 0;
    1.34 +	return ws->set_vidmode(xsz, ysz);
    1.35  }
    1.36  
    1.37 -int sgl_window(int x, int y, unsigned int mode)
    1.38 +int sgl_get_video_mode(int *xsz, int *ysz)
    1.39  {
    1.40 -	return 0;
    1.41 +	return ws->get_vidmode(xsz, ysz);
    1.42  }
    1.43  
    1.44 -void sgl_close(int win)
    1.45 +int sgl_create_window(int xsz, int ysz, unsigned int mode)
    1.46  {
    1.47 +	return ws->create_window(xsz, ysz, mode);
    1.48  }
    1.49 +
    1.50 +void sgl_close_window(int win)
    1.51 +{
    1.52 +	ws->close_window(win);
    1.53 +}
    1.54 +
    1.55 +int sgl_set_active(int id)
    1.56 +{
    1.57 +	return ws->set_active(id);
    1.58 +}
    1.59 +
    1.60 +int sgl_set_title(const char *str)
    1.61 +{
    1.62 +	return ws->set_title(str);
    1.63 +}
    1.64 +
    1.65 +int sgl_process_events(void)
    1.66 +{
    1.67 +	return ws->process_events();
    1.68 +}