#include "VExitBox.h"
#include "V2Ddraw.h"
#include<GL/glew.h>
#include<GL/glut.h>

VExitBox::VExitBox(int x, int y, int width, float* color1, float* color2,float* alpha)
{
	this->x = x;
	this->y = y;
	this->width = width;
	this->ins = false;
	this->alpha = alpha;
	this->color1 = color1;
	this->color2 = color2;
}

void VExitBox::draw() {
	if(!ins)
		glColor4f(this->color1[0],this->color1[1],this->color1[2],*(this->alpha));
	else glColor4f(this->color2[0],this->color2[1],this->color2[2],*(this->alpha));
	V2Ddraw::drawRect(this->x,this->y,this->width,this->width);
	glBegin(GL_LINES);
		glVertex2f(x+2,y+2);
		glVertex2f(x+width-2,y+width-2);
		glVertex2f(x+width-2,y+2);
		glVertex2f(x+2,y+width-2);
	glEnd();
}

void VExitBox::inside(int xm, int ym) {
	this->ins = xm > x && xm < x+width && ym > y && ym < y+width;
}

bool VExitBox::isInside(int xm, int ym) {
	return xm > x && xm < x+width && ym > y && ym < y+width;
}

VExitBox::~VExitBox(void)
{
}
