#include "Title.h"
#include "Credits.h"
#include "Globals.h"
#include "rapidxml.hpp"
#include "Rabbit.h"
#include "Wumbo-KeyboardInput.h"
#include "Wumbo-Quicky.h"
#include "FjordsSound.h"

Credits::Credits(Wumbo::Program *prog) : Wumbo::Scene(prog)
{
}
void Credits::begin()
{
	stopAllMusic();
}
void Credits::update()
{
	if (Wumbo::__quickyKeyboard->isKeyPressed(Wumbo::Key::X))
		program->setScene(new Title(program));
}
void Credits::render()
{
	unsigned int TOPBARHEIGHT = 30;
#if PLATFORM_IOS
	if (Wumbo::Platform_iOS::iPad())
		renderer->setVirtualRenderTarget(VirtualRenderTarget(0,0,768,1024,768,1024));
	else if (Wumbo::Platform_iOS::FourInch())
		renderer->setVirtualRenderTarget(VirtualRenderTarget(0,0,320,568,320,568));
	else
		renderer->setVirtualRenderTarget(VirtualRenderTarget(0,0,320,480,320,480));
#else
	program->getRenderer()->setVirtualRenderTarget(VirtualRenderTarget(0,0,WINDOW_WIDTH*WINDOW_SCALE,WINDOW_HEIGHT*WINDOW_SCALE,WINDOW_WIDTH,WINDOW_HEIGHT));
#endif
	glClearColor(SHARECART_BLACK);
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

	glBindTexture(GL_TEXTURE_2D,tex->getTexture());
	VIEW = glm::mat4x4(1.f);//glm::lookAt(glm::vec3(10*width/2+xdist,ydist,10*width/2+zdist),glm::vec3(10*width/2,0.f,10*height/2),glm::vec3(0.f,1.f,0.f));//glm::ortho(-1.f,1.f,1.f,-1.f,-10.f,10.f);// * glm::translate(glm::mat4(1.0f), glm::vec3(-10.f,-10.f,0)) * glm::scale(glm::mat4(1.0f),glm::vec3(2.f/320.f,2.f/480.f,0.f));
	PROJ = glm::ortho(0.f,(float)WINDOW_WIDTH,(float)WINDOW_HEIGHT,0.f);

	draw_rectangle(0,0,WINDOW_WIDTH,WINDOW_HEIGHT);
	draw_text(10,10,"THANK YOU FOR PLAYING\r\n\r\nWhat is Morton?\r\n\r\nI don't know. SHARECART1000\r\ndoesn't have a unique color\r\nfor me to use for a bunny, so\r\nMorton was a green rabbit. To\r\nsome, that looks like a frog!\r\nWith a rabbit tail! :/\r\n\r\nSpecial thanks go out to\r\nAndi, who suggested Morton\r\nas a game name to Kyle\r\n\r\n\r\nhttps://twitter.com/mcclure111\r\n/status/460288011213615104");
	draw_text(10,460,"Press X to restart!");
}