gltiki
diff src/gltiki.c @ 0:ea177566fe79
initial commit
author | John Tsiombikas <nuclear@mutantstargoat.com> |
---|---|
date | Sat, 07 Jul 2012 07:07:40 +0300 |
parents | |
children |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/src/gltiki.c Sat Jul 07 07:07:40 2012 +0300 1.3 @@ -0,0 +1,94 @@ 1.4 +/* 1.5 +A simple cross-platform OpenGL GUI toolkit 1.6 +Copyright (C) 2012 John Tsiombikas <nuclear@member.fsf.org> 1.7 + 1.8 +This program is free software: you can redistribute it and/or modify 1.9 +it under the terms of the GNU Lesser General Public License as published by 1.10 +the Free Software Foundation, either version 3 of the License, or 1.11 +(at your option) any later version. 1.12 + 1.13 +This program is distributed in the hope that it will be useful, 1.14 +but WITHOUT ANY WARRANTY; without even the implied warranty of 1.15 +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1.16 +GNU Lesser General Public License for more details. 1.17 + 1.18 +You should have received a copy of the GNU Lesser General Public License 1.19 +along with this program. If not, see <http://www.gnu.org/licenses/>. 1.20 +*/ 1.21 +#include <stdio.h> 1.22 +#include <stdlib.h> 1.23 +#include "gltiki.h" 1.24 +#include "gltiki_impl.h" 1.25 + 1.26 +int gltk_init(void) 1.27 +{ 1.28 + return 0; 1.29 +} 1.30 + 1.31 +void gltk_cleanup(void) 1.32 +{ 1.33 +} 1.34 + 1.35 +gltk_widget *gltk_create_widget(void) 1.36 +{ 1.37 + gltk_widget *w; 1.38 + 1.39 + if(!(w = calloc(1, sizeof *w))) { 1.40 + return 0; 1.41 + } 1.42 + return w; 1.43 +} 1.44 + 1.45 +void gltk_free_widget(gltk_widget *w) 1.46 +{ 1.47 + free(w); 1.48 +} 1.49 + 1.50 +void gltk_move(gltk_widget *w, float x, float y) 1.51 +{ 1.52 + w->x = x; 1.53 + w->y = y; 1.54 +} 1.55 + 1.56 +void gltk_resize(gltk_widget *w, float xsz, float ysz) 1.57 +{ 1.58 + w->width = xsz; 1.59 + w->height = ysz; 1.60 +} 1.61 + 1.62 +/* events */ 1.63 +void gltk_event_button(int bn, int state, float x, float y) 1.64 +{ 1.65 +} 1.66 + 1.67 +void gltk_event_motion(float x, float y) 1.68 +{ 1.69 +} 1.70 + 1.71 +void gltk_event_keyboard(int key, int state) 1.72 +{ 1.73 +} 1.74 + 1.75 +/* drawing */ 1.76 +void gltk_draw(gltk_widget *wlist) 1.77 +{ 1.78 + gltk_widget *w = wlist; 1.79 + 1.80 + while(w) { 1.81 + if(w->draw) { 1.82 + w->draw(w); 1.83 + } 1.84 + w = w->next; 1.85 + } 1.86 +} 1.87 + 1.88 +/* GUI file format */ 1.89 +gltk_widget *gltk_load(const char *fname) 1.90 +{ 1.91 + return 0; 1.92 +} 1.93 + 1.94 +int gltk_save(const char *fname, gltk_widget *wlist) 1.95 +{ 1.96 + return -1; 1.97 +}