#pragma once
#include <enginend/engine.h>
#include "configmenu.h"
#include "../../common/themes.h"
using namespace enginend::nodes::twod::relative;
class mainmenu :public virtual enginend::scene{
private:
	Texture2D bg= LoadTexture(AT("res/images/tilesheet.png"));
public:
	void boot() override {
		this->nodes=std::vector<enginend::nodes::node*>{
			new animated(AT("res/images/sky.gif"),0,0,1,1,2),
			new text(nullptr,clienttheme,0.17,0.05,0.8,0.3,32,"FORESPEND"),
				new labeledbutton("PLAY",nullptr,clienttheme,0.30,0.25,0.4,0.2,
				std::function<void()>([]{
					
				}),32),
				new labeledbutton("OPTIONS",nullptr,clienttheme,0.02,0.75,0.56,0.2,
				std::function<void()>([]{
					configmenupage=1;
				}),32),
				new labeledbutton("EXIT",nullptr,clienttheme,0.63,0.75,0.35,0.2,
				std::function<void()>([](){
					std::exit(1);
				}),32),
		};
		enginend::scene::boot();
	}
	void tick() override {
		switch (configmenupage) {
			case 0:{
				for (enginend::nodes::node* n : this->nodes) {
					n->tick();
				}
				break;
			}
			case 1: {this->nodes[0]->tick();
				for (enginend::nodes::node* n : maincfgpage.children) {
					n->tick();
				}
				break;
			}
			case 2: {this->nodes[0]->tick();
				for (enginend::nodes::node* n : graphics.children) {
					n->tick();
				}
				break;
			}
		}
	}
	void draw() override {
		switch (configmenupage) {
			case 0:{
				for (enginend::nodes::node* n : this->nodes) {
					n->draw();
				}
				break;
			}
			case 1: {(this->nodes[0])->draw();
				for (enginend::nodes::node* n : maincfgpage.children) {
					n->draw();
				}
				break;
			}
			case 2: {this->nodes[0]->draw();
				for (enginend::nodes::node* n : graphics.children) {
					n->draw();
				}
				break;
			}
		}
	}
	void exit() override {
		enginend::scene::exit();
	}
};
