#include "EndState.h"
#include "LevelState.h"

EndState::EndState(LevelState *oldState)
{
	m_oldState = oldState;
}

void EndState::resize(int nWidth, int nHeight)
{

}

void EndState::tick(int nFps)
{
	glClearColor(1.0f, 1.0f, 1.0f, 1.0f);
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

	glActiveTexture(GL_TEXTURE0); 

	glLoadIdentity();

	TextureManager::getInstance()->bindTexture("End");

	glBegin(GL_QUADS);
		glTexCoord2f(0.05f,0);		glVertex2f(-1,-1);
		glTexCoord2f(1.0f,0);		glVertex2f(1,-1);
		glTexCoord2f(1.0f,1.0f);	glVertex2f(1,1);
		glTexCoord2f(0.05f,1.0f);	glVertex2f(-1,1);
	glEnd();

	glutSwapBuffers();
}

void EndState::onclick()
{
	m_oldState->setLevel(0);
	GameState::GAMESTATE = m_oldState;
}