#include "client.h"

#include "scenes/mainmenu.h"

client::client() {
	
}
void client::boot() {
	this->framerate=60;
	this->tickrate=20;
	SetConfigFlags(FLAG_VSYNC_HINT|FLAG_WINDOW_RESIZABLE);
	InitWindow(380,240,"forespend - 0.03h");
	initthemes();
	this->currentscene=new mainmenu();
	this->currentscene->boot();
	target=LoadRenderTexture(380,240);
	display=LoadShader(
		AT("res/shaders/screen.vs"),
		AT("res/shaders/screen.fs")
	);

}
void client::draw() {
	BeginTextureMode(target);
	ClearBackground(rl::WHITE);
	this->currentscene->draw();
	EndTextureMode();
	BeginDrawing();
	BeginShaderMode(display);
	DrawTexturePro(
		target.texture,{0,0,380,-240},{0,0,(float)GetScreenWidth(),(float)GetScreenHeight()},{0,0},0,rl::WHITE
	);
	EndShaderMode();
	EndDrawing();
	
}
void client::exit() {
	this->currentscene->exit();
	delete this->currentscene;
	UnloadRenderTexture(target);
	UnloadShader(display);
}
void client::tick() {
	this->currentscene->tick();
}



