package gui.menu;

import imgui.ImGui;
import imgui.ImVec2;

public class MainMenu extends BaseView {

	public MainMenu(StateMachine stateMachine) {
		super(stateMachine);
	}

	@Override
	public void render() {
		var displaySize = ImGui.getIO().getDisplaySize();
		ImVec2 buttonSize = new ImVec2(500, 150);
		int paddingHeight = 20;

		float centerX = displaySize.x / 2.0f - buttonSize.x / 2.0f;
		float centerY = displaySize.y / 2.0f - buttonSize.y / 2.0f;

		ImGui.setCursorPos(centerX, centerY - buttonSize.y - paddingHeight);
		if (ImGui.button("Mode histoire", buttonSize)) {
			this.stateMachine.pushState(new SoloMenu(this.stateMachine));
		}
		
		ImGui.setCursorPos(centerX, centerY);
		if (ImGui.button("Multijoueur", buttonSize)) {
			this.stateMachine.pushState(new MultiMenu(this.stateMachine));
		}
		
		ImGui.setCursorPos(centerX, centerY + buttonSize.y + paddingHeight);
		if (ImGui.button("Options", buttonSize)) {
			this.stateMachine.pushState(new OptionsMenu(this.stateMachine));
		}
	}

}
