Пример #1
0
int BannerWindow::MainLoop()
{
	if (startBtn->GetState() == STATE_CLICKED)
	{
		// If this function was left then the game start was canceled
		GameWindow::BootGame(dvdheader ? dvdheader : gameList[gameSelected]);
		// If it returns from that function reload the list
		gameList.FilterList();
		startBtn->ResetState();
	}

	else if (backBtn->GetState() == STATE_CLICKED) //back
	{
		GuiBannerGrid *bannerBrowser = dynamic_cast<GuiBannerGrid *>(browserMenu->GetGameBrowser());
		if(bannerBrowser)
		{
			bannerBrowser->GetIconCoordinates(gameSelected, &AnimPosX, &AnimPosY);
			bannerBrowser->SetPage(gameSelected / 12);
		}
		// activate rendering again
		browserMenu->GetGameBrowser()->SetVisible(true);

		// finish on going animations first
		while(AnimStep < MaxAnimSteps)
			usleep(1000);

		// set new animation for zoom out
		AnimZoomIn = false;
		AnimStep = 0;

		// finish animation
		while(AnimStep < MaxAnimSteps)
			usleep(1000);

		mainWindow->SetState(STATE_DEFAULT);
		returnVal = 0;
	}

	else if(settingsBtn->GetState() == STATE_CLICKED) //settings
	{
		this->SetState(STATE_DISABLED);

		wiilight(0);
		int settret = GameSettingsMenu::Execute(browserMenu, dvdheader ? dvdheader : gameList[gameSelected]);

		this->SetState(STATE_DEFAULT);
		settingsBtn->ResetState();

		// Show the window again or return to browser on uninstall
		if (settret == MENU_DISCLIST)
			returnVal = 1;
	}

	else if (btnRight->GetState() == STATE_CLICKED) //next game
	{
		if(Settings.xflip == XFLIP_YES)
		{
			gameSelected = (gameSelected - 1 + gameList.size()) % gameList.size();
			ChangeGame(true);
		}
		else if(Settings.xflip == XFLIP_SYSMENU)
		{
			gameSelected = (gameSelected + 1) % gameList.size();
			ChangeGame(true);
		}
		else if(Settings.xflip == XFLIP_WTF)
		{
			gameSelected = (gameSelected - 1 + gameList.size()) % gameList.size();
			ChangeGame(true);
		}
		else
		{
			gameSelected = (gameSelected + 1) % gameList.size();
			ChangeGame(true);
		}

		btnRight->ResetState();
	}

	else if (btnLeft->GetState() == STATE_CLICKED) //previous game
	{
		if(Settings.xflip == XFLIP_YES)
		{
			gameSelected = (gameSelected + 1) % gameList.size();
			ChangeGame(true);
		}
		else if(Settings.xflip == XFLIP_SYSMENU)
		{
			gameSelected = (gameSelected - 1 + gameList.size()) % gameList.size();
			ChangeGame(true);
		}
		else if(Settings.xflip == XFLIP_WTF)
		{
			gameSelected = (gameSelected + 1) % gameList.size();
			ChangeGame(true);
		}
		else
		{
			gameSelected = (gameSelected - 1 + gameList.size()) % gameList.size();
			ChangeGame(true);
		}

		btnLeft->ResetState();
	}

	if (reducedVol)
	{
		if (gameSound)
		{
			if (Settings.gamesound == 1 && !gameSound->IsPlaying())
			{
				bgMusic->SetVolume(Settings.volume);
				reducedVol = false;
			}
		}
		else
		{
			bgMusic->SetVolume(Settings.volume);
			reducedVol = false;
		}
	}

	return returnVal;
}
Пример #2
0
int BannerWindow::MainLoop()
{
	if (startBtn->GetState() == STATE_CLICKED)
	{
		debughelper_printf("Started : %.6s\n", gameList[gameSelected]->id);
		// If this function was left then the game start was canceled
		GameWindow::BootGame(dvdheader ? dvdheader : gameList[gameSelected]);
		// If it returns from that function reload the list
		gameList.FilterList();
		startBtn->ResetState();
	}

	else if (backBtn->GetState() == STATE_CLICKED) //back
	{
		GuiBannerGrid *bannerBrowser = dynamic_cast<GuiBannerGrid *>(browserMenu->GetGameBrowser());
		if(bannerBrowser)
		{
			bannerBrowser->GetIconCoordinates(gameSelected, &AnimPosX, &AnimPosY);
			bannerBrowser->SetPage(gameSelected / 12);
		}
		// activate rendering again
		browserMenu->GetGameBrowser()->SetVisible(true);

		// finish on going animations first
		while(AnimStep < MaxAnimSteps)
			usleep(1000);

		// set new animation for zoom out
		AnimZoomIn = false;
		AnimStep = 0;

		// finish animation
		while(AnimStep < MaxAnimSteps)
			usleep(1000);

		mainWindow->SetState(STATE_DEFAULT);
		returnVal = 0;
	}

	else if(settingsBtn->GetState() == STATE_CLICKED) //settings
	{
		this->SetState(STATE_DISABLED);

		wiilight(0);
		int settret = GameSettingsMenu::Execute(browserMenu, dvdheader ? dvdheader : gameList[gameSelected]);

		this->SetState(STATE_DEFAULT);
		settingsBtn->ResetState();

		// Show the window again or return to browser on uninstall
		if (settret == MENU_DISCLIST)
			returnVal = 1;
	}

	else if (btnRight->GetState() == STATE_CLICKED) //next game
	{
		if(Settings.xflip == XFLIP_YES)
		{
			gameSelected = (gameSelected - 1 + gameList.size()) % gameList.size();
			ChangeGame(true);
		}
		else if(Settings.xflip == XFLIP_SYSMENU)
		{
			gameSelected = (gameSelected + 1) % gameList.size();
			ChangeGame(true);
		}
		else if(Settings.xflip == XFLIP_WTF)
		{
			gameSelected = (gameSelected - 1 + gameList.size()) % gameList.size();
			ChangeGame(true);
		}
		else
		{
			gameSelected = (gameSelected + 1) % gameList.size();
			ChangeGame(true);
		}

		btnRight->ResetState();
	}

	else if (btnLeft->GetState() == STATE_CLICKED) //previous game
	{
		if(Settings.xflip == XFLIP_YES)
		{
			gameSelected = (gameSelected + 1) % gameList.size();
			ChangeGame(true);
		}
		else if(Settings.xflip == XFLIP_SYSMENU)
		{
			gameSelected = (gameSelected - 1 + gameList.size()) % gameList.size();
			ChangeGame(true);
		}
		else if(Settings.xflip == XFLIP_WTF)
		{
			gameSelected = (gameSelected + 1) % gameList.size();
			ChangeGame(true);
		}
		else
		{
			gameSelected = (gameSelected - 1 + gameList.size()) % gameList.size();
			ChangeGame(true);
		}

		btnLeft->ResetState();
	}

	if (reducedVol)
	{
		if (gameSound)
		{
			if (Settings.gamesound == 1 && !gameSound->IsPlaying())
			{
				bgMusic->SetVolume(Settings.volume);
				reducedVol = false;
			}
		}
		else
		{
			bgMusic->SetVolume(Settings.volume);
			reducedVol = false;
		}
	}

	for(int i = 0; i < FAVORITE_STARS; ++i)
	{
		if(FavoriteBtn[i]->GetState() == STATE_CLICKED)
		{
			// This button can only be clicked when this is not a dvd header
			struct discHdr * header = gameList[gameSelected];
			int FavoriteRank = (i+1 == GameStatistics.GetFavoriteRank(header->id)) ? 0 : i+1; // Press the current rank to reset the rank

			GameStatistics.SetFavoriteRank(header->id, FavoriteRank);
			GameStatistics.Save();
			for(int j = 0; j < FAVORITE_STARS; ++j)
				FavoriteBtnImg[j]->SetImage(FavoriteRank >= j+1 ? imgFavorite : imgNotFavorite);

			FavoriteBtn[i]->ResetState();
		}
	}

	return returnVal;
}