#include "game/main_menu.h"
#include "input/input_system.h"
#include "render/ui.h"

MainMenu* g_pMainMenu = nullptr;

MainMenu::MainMenu()
{
	//// HD Resolution - 1280x720
	//Button g_startGameButton = { Vec2{ (1280.0f / 2.f) - 128.f , (720.f / 2.f)}, Vec2{256.f, 128.f} };
	//Button g_quitButton = { Vec2{ (1280.0f / 2.f) - 128.f , (720.f / 2.f) + 128.f + 6.0f}, Vec2{256.f, 128.f} };

	m_startGameButton.pos = Vec2{ (1280.0f / 2.f) - 128.f , (720.f / 2.f) };
	m_startGameButton.size = Vec2{ 256.f, 128.f };

	m_quitButton = { Vec2{ (1280.0f / 2.f) - 128.f , (720.f / 2.f) + 128.f + 6.0f}, Vec2{256.f, 128.f} };
}

MainMenu::~MainMenu()
{
}

void MainMenu::Update()
{
}

void MainMenu::Render()
{
	//Vec4 color = { 1.0f, 0.0f, 0.0f, 1.0f };


}

bool buttonIsSelected(const Button* button)
{
	int32_t x = 0, y = 0;
	g_inputSystem->GetMousePosition(&x, &y);

	return GetBoxIntersection2D(
		Vec2{ (float)x + 16.0f, (float)y + 35.0f },
		Vec2{ (float)x,(float)y },
		Vec2{ button->pos.x + button->size.x, button->pos.y + button->size.y },
		button->pos);
}