gltiki

annotate src/gltiki.c @ 0:ea177566fe79

initial commit
author John Tsiombikas <nuclear@mutantstargoat.com>
date Sat, 07 Jul 2012 07:07:40 +0300
parents
children
rev   line source
nuclear@0 1 /*
nuclear@0 2 A simple cross-platform OpenGL GUI toolkit
nuclear@0 3 Copyright (C) 2012 John Tsiombikas <nuclear@member.fsf.org>
nuclear@0 4
nuclear@0 5 This program is free software: you can redistribute it and/or modify
nuclear@0 6 it under the terms of the GNU Lesser General Public License as published by
nuclear@0 7 the Free Software Foundation, either version 3 of the License, or
nuclear@0 8 (at your option) any later version.
nuclear@0 9
nuclear@0 10 This program is distributed in the hope that it will be useful,
nuclear@0 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
nuclear@0 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
nuclear@0 13 GNU Lesser General Public License for more details.
nuclear@0 14
nuclear@0 15 You should have received a copy of the GNU Lesser General Public License
nuclear@0 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
nuclear@0 17 */
nuclear@0 18 #include <stdio.h>
nuclear@0 19 #include <stdlib.h>
nuclear@0 20 #include "gltiki.h"
nuclear@0 21 #include "gltiki_impl.h"
nuclear@0 22
nuclear@0 23 int gltk_init(void)
nuclear@0 24 {
nuclear@0 25 return 0;
nuclear@0 26 }
nuclear@0 27
nuclear@0 28 void gltk_cleanup(void)
nuclear@0 29 {
nuclear@0 30 }
nuclear@0 31
nuclear@0 32 gltk_widget *gltk_create_widget(void)
nuclear@0 33 {
nuclear@0 34 gltk_widget *w;
nuclear@0 35
nuclear@0 36 if(!(w = calloc(1, sizeof *w))) {
nuclear@0 37 return 0;
nuclear@0 38 }
nuclear@0 39 return w;
nuclear@0 40 }
nuclear@0 41
nuclear@0 42 void gltk_free_widget(gltk_widget *w)
nuclear@0 43 {
nuclear@0 44 free(w);
nuclear@0 45 }
nuclear@0 46
nuclear@0 47 void gltk_move(gltk_widget *w, float x, float y)
nuclear@0 48 {
nuclear@0 49 w->x = x;
nuclear@0 50 w->y = y;
nuclear@0 51 }
nuclear@0 52
nuclear@0 53 void gltk_resize(gltk_widget *w, float xsz, float ysz)
nuclear@0 54 {
nuclear@0 55 w->width = xsz;
nuclear@0 56 w->height = ysz;
nuclear@0 57 }
nuclear@0 58
nuclear@0 59 /* events */
nuclear@0 60 void gltk_event_button(int bn, int state, float x, float y)
nuclear@0 61 {
nuclear@0 62 }
nuclear@0 63
nuclear@0 64 void gltk_event_motion(float x, float y)
nuclear@0 65 {
nuclear@0 66 }
nuclear@0 67
nuclear@0 68 void gltk_event_keyboard(int key, int state)
nuclear@0 69 {
nuclear@0 70 }
nuclear@0 71
nuclear@0 72 /* drawing */
nuclear@0 73 void gltk_draw(gltk_widget *wlist)
nuclear@0 74 {
nuclear@0 75 gltk_widget *w = wlist;
nuclear@0 76
nuclear@0 77 while(w) {
nuclear@0 78 if(w->draw) {
nuclear@0 79 w->draw(w);
nuclear@0 80 }
nuclear@0 81 w = w->next;
nuclear@0 82 }
nuclear@0 83 }
nuclear@0 84
nuclear@0 85 /* GUI file format */
nuclear@0 86 gltk_widget *gltk_load(const char *fname)
nuclear@0 87 {
nuclear@0 88 return 0;
nuclear@0 89 }
nuclear@0 90
nuclear@0 91 int gltk_save(const char *fname, gltk_widget *wlist)
nuclear@0 92 {
nuclear@0 93 return -1;
nuclear@0 94 }