00001 #include "VMenuStarter.h"
00002 #include <iostream>
00003 #include <GL/glew.h>
00004 #include <GL/glut.h>
00005
00006 using namespace std;
00007
00008 VMenuStarter::VMenuStarter(int* width,int*height,unsigned int* fps,vector<GUIelement*> elements) :
00009 GUIelement(width,height,fps) {
00010 if(elements.size() != 4)
00011 cerr << "Error: Wrong number of GUI elements" << endl;
00012 this->elements = elements;
00013 this->active = true;
00014 this->width = 0;
00015 this->height = 0;
00016 this->offset = 10;
00017 }
00018
00019 void VMenuStarter::motion(int xm,int ym) {
00020 if(xm < offset && ym < offset) {
00021 if(!elements[0]->isActive())
00022 elements[0]->setBlend(true);
00023
00024 } else if(xm > *wwidth-offset && ym < offset) {
00025 if(!elements[1]->isActive())
00026 elements[1]->setBlend(true);
00027
00028 } else if(xm < offset && ym > *wheight-offset) {
00029 if(!elements[2]->isActive())
00030 elements[2]->setBlend(true);
00031
00032 } else if(xm > *wwidth-offset && ym > *wheight-offset) {
00033 if(!elements[3]->isActive())
00034 elements[3]->setBlend(true);
00035
00036 }
00037 }
00038
00039 bool VMenuStarter::isInside(int xm, int ym) {
00040 return (xm < offset && ym < offset) || (xm > *wwidth-offset && ym < offset)
00041 || (xm < offset && ym > *wheight-offset) || (xm > *wwidth-offset && ym > *wheight-offset);
00042 }
00043
00044 void VMenuStarter::render() {
00045 glColor3f(1.0,1.0,1.0);
00046 glRasterPos3f(30, 10, 0.0);
00047 for(char * ch= "<- Transferfunktion"; *ch; ch++) {
00048 glutBitmapCharacter(GLUT_BITMAP_HELVETICA_10, (int)*ch);
00049 }
00050 glRasterPos3f((*this->wwidth)-95, 10, 0.0);
00051 for(char * ch= "Rendermode ->"; *ch; ch++) {
00052 glutBitmapCharacter(GLUT_BITMAP_HELVETICA_10, (int)*ch);
00053 }
00054 glRasterPos3f((*this->wwidth)-70, (*this->wheight)-10, 0.0);
00055 for(char * ch= "Slicing ->"; *ch; ch++) {
00056 glutBitmapCharacter(GLUT_BITMAP_HELVETICA_10, (int)*ch);
00057 }
00058 }