Exemplo n.º 1
0
void LostState::enter() {
  Input::Instance().m_pMouse->setBuffered(true);
	System::Instance().logMessage("Entering PauseState...");

	OgreBites::SdkTrayManager* trayManager = UserInterface::Instance().m_pTrayMgr;
	trayManager->destroyAllWidgets();
	trayManager->showCursor();
	trayManager->createDecorWidget(
	    OgreBites::TL_CENTER, "youlost", "SdkTrays/Lostthegame");
	trayManager->createButton(
	    OgreBites::TL_CENTER, "RestartGameBtn", "Restart Game", 250);
	trayManager->createButton(
	    OgreBites::TL_CENTER, "BackToMenuBtn", "Return to Menu", 250);
	trayManager->createLabel(OgreBites::TL_TOP, "PauseLbl", "Lost", 250);
	trayManager->showBackdrop("SdkTrays/Shade");
	m_bQuit = false;
}
Exemplo n.º 2
0
void
MenuSystem::createMenu(MENUS menu)
{
	OgreBites::SdkTrayManager* currentTray = 0;
	switch(menu)
	{
	case STARTMENU:
		{
			// Create the Tray Manager
			currentTray = new OgreBites::SdkTrayManager("StartMenu", mWindow, mInputContext, this);

			// Design the tray, Save the buttons if you want to check if they are pressed
			currentTray->createLabel(OgreBites::TL_TOP, "GameTitle", "Juicy Checkers", 500);
			pName = currentTray->createTextBox(OgreBites::TL_CENTER, "pName", "Enter Your Name",300,75);
			int randomNumbers = rand() % 1000;
			char bfr[256];
			char* iden = itoa(randomNumbers, bfr, 10);
			pName->setText(Ogre::String("Player")+iden);
			ip = currentTray->createTextBox(OgreBites::TL_CENTER, "ip", "Enter the Server IP",300,75);
			ip->setText("127.0.0.1");
			startButton = currentTray->createButton(OgreBites::TL_CENTER, "startBtn", "Start Multiplayer");
			exitButton = currentTray->createButton(OgreBites::TL_CENTER, "extBtn", "Exit Game");

			// Add the tray into the tray container.  NOTE: This function is designed to be run from 0 -> MENU.max
			mTrays.push_back(currentTray);
		}
		break;

	case LISTLOBBYMENU:
		{
			// Create the Tray Manager
			currentTray = new OgreBites::SdkTrayManager("ListLobbyMenu", mWindow, mInputContext, this);

			// Design the tray, Save the buttons if you want to check if they are pressed
			// Create the label
			currentTray->createLabel(OgreBites::TL_TOP, "JoinCreateLobby", "Join/Create Lobby", 500);
			createLobbyButton = currentTray->createButton(OgreBites::TL_CENTER, "createLobby", "Create Lobby");
			// Have the option to create a new lobby

			// Below this we will have a listing of lobbys that the user can click on
			selectLobby = currentTray->createLongSelectMenu(OgreBites::TL_CENTER, "selectLobby", Ogre::DisplayString("Select a Lobby"), Ogre::Real(300.0), 12); 
			joinLobby = currentTray->createButton(OgreBites::TL_CENTER, "joinLobby", "Join Lobby");
			refreshLobbyButton = currentTray->createButton(OgreBites::TL_CENTER, "refreshLobby", "Refresh Lobbies");
			lobbyBack = currentTray->createButton(OgreBites::TL_CENTER, "lobbyBack", "Back");
			// Add the tray into the tray container.  NOTE: This function is designed to be run from 0 -> MENU.max
			mTrays.push_back(currentTray);
		}
		break;

	case CREATELOBBYMENU:
		{
			// Create the Tray Manager
			currentTray = new OgreBites::SdkTrayManager("CreateLobbyMenu", mWindow, mInputContext, this);

			// Design the tray, Save the buttons if you want to check if they are pressed
			// Label
			currentTray->createLabel(OgreBites::TL_TOP, "CreateLobby", "Create Lobby", 500);
			lobbyName = currentTray->createTextBox(OgreBites::TL_CENTER, "lobbyName", "Lobby Name", 500 , 300);
			createLobby = currentTray->createButton(OgreBites::TL_CENTER, "createLobbyButton", "Create Lobby");
			createLobbyBack = currentTray->createButton(OgreBites::TL_CENTER, "createLobbyButtonBack", "Back");
			

			// Text area for the name

			// Button to create


			// Add the tray into the tray container.  NOTE: This function is designed to be run from 0 -> MENU.max
			mTrays.push_back(currentTray);
		}
		break;
	case LOBBYMENU:
		{
			// Create the Tray Manager
			currentTray = new OgreBites::SdkTrayManager("LobbyMenu", mWindow, mInputContext, this);
			currentTray->createLabel(OgreBites::TL_TOP, "lobbyMenuTitle", "Lobby Menu", 500);
									
			// List the current players
			currentTray->createLabel(OgreBites::TL_CENTER, "lobbyMenuPlayers", "Players", 300);
			lobbyPlayersTextBox = currentTray->createTextBox(OgreBites::TL_CENTER, "lobbyPlayers", "Players",400,150);

			// Have a (ready) toggle button
			if(isReady)
			{
				lobbyReadyButton = currentTray->createButton(OgreBites::TL_CENTER, "readyButton", "READY");				
				//isReady = !isReady;
			}
			else
			{
				lobbyReadyButton = currentTray->createButton(OgreBites::TL_CENTER, "readyButton", "NOT READY");	
				//isReady = !isReady;
			}

			// Have a chat box 
			lobbyChatBox = currentTray->createTextBox(OgreBites::TL_CENTER, "chatBox", "Chat Window",500,250);
			lobbyChatTextField = currentTray->createTextBox(OgreBites::TL_CENTER, "chatTextField", "Enter Chat Here",500,80);


			// Add the tray into the tray container.  NOTE: This function is designed to be run from 0 -> MENU.max
			mTrays.push_back(currentTray);
		}
		break;

	case MATCHMENU:
		{
			// Create the Tray Manager
			currentTray = new OgreBites::SdkTrayManager("MatchMenu", mWindow, mInputContext, this);

			// Design the tray, Save the buttons if you want to check if they are pressed
			// Here we will have some elements such as labels in certain positions to indicate 
			// the current turn,  timers upgrades etc etc.

			// Indicate whos turn it currently is with a label
			matchTurn = currentTray->createLabel(OgreBites::TL_TOPLEFT, "turnLabel", "Your Turn");

			// Indicate with a label the current powerup credit level
			matchCredits = currentTray->createLabel(OgreBites::TL_TOPLEFT, "powerupLabel", "Powerup Credits:0");
			// Have a button that opens up the upgrade menu

			matchUpgrade = currentTray->createButton(OgreBites::TL_TOPLEFT, "upgradeButton", "Open Upgrades");

			

			// Add the tray into the tray container.  NOTE: This function is designed to be run from 0 -> MENU.max
			mTrays.push_back(currentTray);
		}
		break;
	case UPGRADEMENU:
		{
			// Create the Tray Manager
			currentTray = new OgreBites::SdkTrayManager("UpgradeMenu", mWindow, mInputContext, this);

			matchTurn = currentTray->createLabel(OgreBites::TL_CENTER, "nameLabel", "Powerup Menu");
			matchCredits = currentTray->createLabel(OgreBites::TL_CENTER, "credits", "Credits: 0");
			powerupOne = currentTray->createButton(OgreBites::TL_CENTER, "buyPU1", "Powerup One");
			powerupTwo = currentTray->createButton(OgreBites::TL_CENTER, "buyPU2", "Powerup Two");
			powerupThree = currentTray->createButton(OgreBites::TL_CENTER, "buyPU3", "Powerup Three");
			powerupBack = currentTray->createButton(OgreBites::TL_CENTER, "powerupBack", "Back");

			

			// Add the tray into the tray container.  NOTE: This function is designed to be run from 0 -> MENU.max
			mTrays.push_back(currentTray);
		}
		break;
	case RESULTMENU:
		{
			// Create the Tray Manager
			currentTray = new OgreBites::SdkTrayManager("ResultMenu", mWindow, mInputContext, this);

			// Design the tray, Save the buttons if you want to check if they are pressed
			// Label

			// Label results




			// Add the tray into the tray container.  NOTE: This function is designed to be run from 0 -> MENU.max
			mTrays.push_back(currentTray);
		}
		break;

	}
}