Exemple #1
0
LTBOOL CMenuMgr::SetCurrentMenu(uint8 index)
{
	if (index < m_MenuArray.size() && m_MenuArray[index]->IsEnabled() )
	{
		m_nMenuIndex = index;
		SwitchToMenu(m_MenuArray[index]);
		return LTTRUE;
	}
	return LTFALSE;
}
void State_Menu::Init()
{	
	LoadResources();

	isCleanedUp = false;

	mainMenu = new Menu("Main Menu");
	characterSelectionMenu = new Menu("Character Selection");
	optionsMenu = new Menu("Options");
	resolutionMenu = new Menu("Resolution Settings");
	creditsMenu = new Menu("Credits");
	pauseMenu = new Menu("Surrender?");
	waveMenu = new Menu("Wave Menu");

	mainMenu->AddButton("Start Game", MenuActions::CharacterSelection);
	mainMenu->AddButton("Options", MenuActions::Options);
	mainMenu->AddButton("Credits", MenuActions::Credits);
	mainMenu->AddButton("Exit", MenuActions::Exit);

	optionsMenu->AddButton("Resolution", MenuActions::Resolution);
	optionsMenu->AddButton("Sound", MenuActions::Sound);
	optionsMenu->AddButton("Back", MenuActions::Back);
	
	creditsMenu->AddImage(SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2, 530, 190, 0);
	creditsMenu->AddButton("Back", SCREEN_WIDTH / 2, SCREEN_HEIGHT - 100, MenuActions::Back);

	pauseMenu->AddButton("Yesh", MenuActions::Yesh);
	pauseMenu->AddButton("Nah", MenuActions::Nah);

	waveMenu->AddButton("Continue", MenuActions::Continue);
	waveMenu->AddButton("Surrender", MenuActions::Surrender);

	characterSelectionMenu->AddClassIconBig(ClassIconGraphic::WarriorClicked, nullptr);
	characterSelectionMenu->AddClassIconBig(ClassIconGraphic::Disabled, nullptr);
	characterSelectionMenu->AddClassIconBig(ClassIconGraphic::Disabled, nullptr);
	characterSelectionMenu->AddButton("Begin", 570, 520, MenuActions::StartGame);
	characterSelectionMenu->AddButton("Back", 240, 520, MenuActions::Back);

	resolutionMenu->AddImage(SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2, SliderDimension::sliderBarWidth, SliderDimension::sliderBarHeight, 1);
	resolutionMenu->AddImage(SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2, SliderDimension::sliderWidth, SliderDimension::sliderHeight, 2);
	resolutionMenu->AddButton("Back", SCREEN_WIDTH / 2, SCREEN_HEIGHT - 100, MenuActions::Options);

	menuList = { mainMenu, characterSelectionMenu, optionsMenu, resolutionMenu, creditsMenu, waveMenu, pauseMenu };
	SwitchToMenu("Main Menu");
}
Exemple #3
0
LTBOOL CMenuMgr::SetCurrentMenu(eMenuID menuID)
{
	MenuArray::iterator iter = m_MenuArray.begin();
	uint8 index = 0;
	while (iter != m_MenuArray.end() && (*iter)->GetMenuID() != menuID )
	{
		index++;
		iter++;
	}

	if (iter != m_MenuArray.end() && (*iter)->IsEnabled())
	{
		m_nMenuIndex = index;
		SwitchToMenu(*iter);
		return LTTRUE;
	}
	return LTFALSE;
}