package projectzombie.menu;

import gl_engine.vec.Vec3d;
import projectzombie.Main;
import projectzombie.input.types.InputGUI;
import projectzombie.menu.gui.GUI;
import projectzombie.menu.gui.GUIButtonBasic;
import projectzombie.menu.gui.GUIButtonGroup;
import projectzombie.menu.gui.GUILabelMain;
import projectzombie.world.World;

public class MenuMain extends Menu
{
	private GUI gui;
	
	public MenuMain() {
		this.doGameloop = false;
		this.doGameRender = true;
		this.keepMouse = false;
		this.showIngameGUI = false;
		
		this.gui = new GUI();
		this.input = new InputGUI(gui);
		
		gui.add(new GUILabelMain());
		
		GUIButtonGroup group = new GUIButtonGroup();
		
		group.add(new GUIButtonBasic("Play", button -> {
			Main.menu = new MenuSaves(Main.menu);
		}));
		
		group.add(new GUIButtonBasic("Settings", button -> {
			Main.menu = new MenuSettings(Main.menu);
		}));
		
		group.add(new GUIButtonBasic("Quit", button -> {
			Main.mainloop.stop();
		}));
		
		gui.add(group);
		gui.setSelected(group.get(0));
		
		World.createDemoWorld();
		Main.player.dead = true;
	}

	@Override
	public void render() {
		this.gui.render();
	}
	
	@Override
	public void update() {
		super.update();
		
		Main.player.angle += 0.05;
		Main.player.angle %= 360;
		
		Main.player.setPos(new Vec3d(Main.player.getPos().x + 0.005, 0, 0));
	}

}
