gameui

diff test.cc @ 4:e0916bb20b7f

changed the name to goatkit
author John Tsiombikas <nuclear@member.fsf.org>
date Fri, 21 Mar 2014 21:45:37 +0200
parents f1014234dece
children
line diff
     1.1 --- a/test.cc	Fri Mar 21 03:37:16 2014 +0200
     1.2 +++ b/test.cc	Fri Mar 21 21:45:37 2014 +0200
     1.3 @@ -3,7 +3,7 @@
     1.4  #include <assert.h>
     1.5  #include <vector>
     1.6  #include <GL/glut.h>
     1.7 -#include "gameui.h"
     1.8 +#include "goatkit.h"
     1.9  
    1.10  static bool init();
    1.11  static void cleanup();
    1.12 @@ -17,14 +17,14 @@
    1.13  static void mouse(int bn, int st, int x, int y);
    1.14  static void motion(int x, int y);
    1.15  
    1.16 -static std::vector<gameui::Widget*> widgets;
    1.17 +static std::vector<goatkit::Widget*> widgets;
    1.18  
    1.19  int main(int argc, char **argv)
    1.20  {
    1.21  	glutInitWindowSize(800, 600);
    1.22  	glutInit(&argc, argv);
    1.23  	glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE);
    1.24 -	glutCreateWindow("gameui test");
    1.25 +	glutCreateWindow("goatkit test");
    1.26  
    1.27  	glutDisplayFunc(disp);
    1.28  	glutIdleFunc(idle);
    1.29 @@ -49,7 +49,7 @@
    1.30  
    1.31  static bool init()
    1.32  {
    1.33 -	gameui::Button *button = new gameui::Button;
    1.34 +	goatkit::Button *button = new goatkit::Button;
    1.35  	button->set_position(350, 280);
    1.36  	button->set_size(100, 40);
    1.37  	widgets.push_back(button);
    1.38 @@ -115,14 +115,14 @@
    1.39  	bool down = st == GLUT_DOWN;
    1.40  
    1.41  	for(size_t i=0; i<widgets.size(); i++) {
    1.42 -		gameui::Widget *w = widgets[i];
    1.43 +		goatkit::Widget *w = widgets[i];
    1.44  
    1.45 -		if(w->hit_test(gameui::Vec2(x, y))) {
    1.46 -			gameui::Event ev;
    1.47 -			ev.type = gameui::EV_MOUSE_BUTTON;
    1.48 +		if(w->hit_test(goatkit::Vec2(x, y))) {
    1.49 +			goatkit::Event ev;
    1.50 +			ev.type = goatkit::EV_MOUSE_BUTTON;
    1.51  			ev.button.button = bidx;
    1.52  			ev.button.press = down;
    1.53 -			ev.button.pos = gameui::Vec2(x, y);
    1.54 +			ev.button.pos = goatkit::Vec2(x, y);
    1.55  			w->handle_event(ev);
    1.56  		}
    1.57  	}
    1.58 @@ -130,23 +130,23 @@
    1.59  
    1.60  static void motion(int x, int y)
    1.61  {
    1.62 -	static gameui::Widget *active;
    1.63 +	static goatkit::Widget *active;
    1.64  
    1.65 -	if(active && !active->hit_test(gameui::Vec2(x, y))) {
    1.66 -		gameui::Event ev;
    1.67 -		ev.type = gameui::EV_MOUSE_FOCUS;
    1.68 +	if(active && !active->hit_test(goatkit::Vec2(x, y))) {
    1.69 +		goatkit::Event ev;
    1.70 +		ev.type = goatkit::EV_MOUSE_FOCUS;
    1.71  		ev.focus.enter = false;
    1.72  		active->handle_event(ev);
    1.73  		active = 0;
    1.74  	}
    1.75  
    1.76  	for(size_t i=0; i<widgets.size(); i++) {
    1.77 -		gameui::Widget *w = widgets[i];
    1.78 +		goatkit::Widget *w = widgets[i];
    1.79  
    1.80 -		if(w->hit_test(gameui::Vec2(x, y))) {
    1.81 +		if(w->hit_test(goatkit::Vec2(x, y))) {
    1.82  			if(active != w) {
    1.83 -				gameui::Event ev;
    1.84 -				ev.type = gameui::EV_MOUSE_FOCUS;
    1.85 +				goatkit::Event ev;
    1.86 +				ev.type = goatkit::EV_MOUSE_FOCUS;
    1.87  				ev.focus.enter = true;
    1.88  				w->handle_event(ev);
    1.89  				active = w;