#include "MenuState.h"

MenuState::MenuState(GameWindow *win) : GameState(win, L"menu")
{
}

MenuState::~MenuState(void)
{
}

void MenuState::Initial()
{
	m_title.Create(GetWindow()->GetGraphics(), L"돋움", 60);
	m_menu.Create(GetWindow()->GetGraphics(), L"돋움", 16);
	m_help.Create(GetWindow()->GetGraphics(), L"굴림", 10);
	m_daram.Create(GetWindow()->GetGraphics(), GetResource(RC_Daram));
}

void MenuState::Update(float dt)
{
	if(GetWindow()->IsKeyDown((DWORD)'1'))
	{
		GetWindow()->GetStateManager().IntroState(L"game");
	}
	if(GetWindow()->IsKeyDown((DWORD)'2'))
	{
		GetWindow()->GetStateManager().IntroState(L"rank");
	}
	if(GetWindow()->IsKeyDown(VK_ESCAPE))
	{
		GetWindow()->Close();
	}
}

void MenuState::Draw(float dt)
{
	m_title.Draw(110, 40, L"Dodge");
	m_menu.Draw(30, 260, L"1. 게임 시작");
	m_menu.Draw(30, 300, L"2. 랭킹");
	m_menu.Draw(30, 340, L"ESC. 종료");
	m_help.Draw(100, 380, L"실행하기 원하는 메뉴의 단축키를 눌러주세요!");
	m_daram.Draw(280, 280);
}

void MenuState::Destroy()
{
	m_title.Destroy();
	m_menu.Destroy();
	m_help.Destroy();
	m_daram.Destroy();
}