#include "StdAfx.h"
#include "MENU.h"

extern int STATUS;

MENU::MENU(HWND	hWnd)
{
	Time = GetTickCount();
	Flash	=	new	IMAGE[3];
	Flash[0].LoadImageFromFile(L"Texture/Menu/bomber_log3.png");
	Flash[1].LoadImageFromFile(L"Texture/Menu/bomber_logo1.png");
	Flash[2].LoadImageFromFile(L"Texture/Menu/bomber_logo2.png");

	int X = 380,Y =0;
	Flash[0].SetPosition(X,Y);
	Flash[1].SetPosition(X,Y);
	Flash[2].SetPosition(X,Y);


	this->hWnd = hWnd;
	Background	=	new	IMAGE;
	Background->LoadImageFromFile(L"Texture/Menu/fon_menu.png");
	Background->SetSize(1.07f,1);
	Logo	=	new	IMAGE;
	Logo->LoadImageFromFile(L"Texture/Menu/bomber_logo.png");
	Logo->SetPosition(330,0);

	Play	=	new	BUTTON(L"Texture/Menu/menu_1P.png",L"Texture/Menu/menu_1P_act.png");
	Play->SetPosition(500,250);
	Play->ClickFunc = ClickPlay;

	Quit	=	new	BUTTON(L"Texture/Menu/menu_quit.png",L"Texture/Menu/menu_quit_act.png");
	Quit->SetPosition(500,400);
	Quit->ClickFunc = ClickQuit;
}

void	MENU::Draw(void)
{
	static int Steep = 0;

	Play->Flip();
	Quit->Flip();
	Background->Draw();
	Logo->Draw();

	if(GetTickCount()>Time+100)
	{
		Time = GetTickCount();
		Steep ++;
		if(Steep >=3)
			Steep = 0;
	}


	Flash[Steep].Draw();


	Play->Draw();
	Quit->Draw();
}


MENU::~MENU(void)
{
}

void	ClickPlay(void)
{
	STATUS	=	1;

}
void	ClickQuit(void)
{
	DestroyWindow(CONSOLE::hWnd);
}