00001 #include "VExitBox.h" 00002 #include "V2Ddraw.h" 00003 #include<GL/glew.h> 00004 #include<GL/glut.h> 00005 00006 VExitBox::VExitBox(int x, int y, int width, float* color1, float* color2,float* alpha) 00007 { 00008 this->x = x; 00009 this->y = y; 00010 this->width = width; 00011 this->ins = false; 00012 this->alpha = alpha; 00013 this->color1 = color1; 00014 this->color2 = color2; 00015 } 00016 00017 void VExitBox::draw() { 00018 if(!ins) 00019 glColor4f(this->color1[0],this->color1[1],this->color1[2],*(this->alpha)); 00020 else glColor4f(this->color2[0],this->color2[1],this->color2[2],*(this->alpha)); 00021 V2Ddraw::drawRect(this->x,this->y,this->width,this->width); 00022 glBegin(GL_LINES); 00023 glVertex2f(x+2,y+2); 00024 glVertex2f(x+width-2,y+width-2); 00025 glVertex2f(x+width-2,y+2); 00026 glVertex2f(x+2,y+width-2); 00027 glEnd(); 00028 } 00029 00030 void VExitBox::inside(int xm, int ym) { 00031 this->ins = xm > x && xm < x+width && ym > y && ym < y+width; 00032 } 00033 00034 bool VExitBox::isInside(int xm, int ym) { 00035 return xm > x && xm < x+width && ym > y && ym < y+width; 00036 } 00037 00038 VExitBox::~VExitBox(void) 00039 { 00040 }