Example #1
0
	ScoreMenu::ScoreMenu(SMenuConfig* menuConfig) :
		title("Score de la partie", TITLEFONT, 100),
		winner("Le joueur i a gagne !", TEXTFONT, 170),
		back("Retour au menu", 550, MAINMENU),
		menuConfig(menuConfig)
	{
		ISkin* skin = PolyBomberApp::getISkin();

		title.setColor(skin->getColor(TITLECOLOR));
		winner.setColor(skin->getColor(TEXTCOLOR));

		back.setSelected(true);

		this->widgets.push_back(&title);
		this->widgets.push_back(&winner);
		this->widgets.push_back(&back);

		for (int i=0; i<4; i++)
		{
			this->pictures[i] = new ImageWidget();
			this->pictures[i]->setPosition(300, 250 + 60*i);				
			this->pictures[i]->setImage(skin->loadImage((EImage)(PLAYER1 + i)));				

			this->names[i] = new TextWidget("", TEXTFONT, 250 + 60*i);
			this->names[i]->setColor(skin->getColor(TEXTCOLOR));

			this->widgets.push_back(this->pictures[i]);
			this->widgets.push_back(this->names[i]);
		}
	}
	GraphicsConfigMenu::GraphicsConfigMenu() :
		title("Configuration graphique", TITLEFONT, 100),
		textFullscreen("Mode plein-ecran : ", TEXTFONT, 200),
		fullscreen(TEXTFONT, 200),
		noFullscreen("Indisponible", ERRORFONT, 200),
		skinText("Skin choisi :", TEXTFONT, 300),
		skinList(TEXTFONT, 350),
		cancel("Annuler", 450, CONFIGMENU),
		save("Valider", 450, CONFIGMENU)
	{
		ISkin* skin = PolyBomberApp::getISkin();
		
		title.setColor(skin->getColor(TITLECOLOR));
		skinText.setColor(skin->getColor(TEXTCOLOR));		
		textFullscreen.setColor(skin->getColor(TEXTCOLOR));

		// Mode plein ecran
		textFullscreen.move(-100, 0);

		fullscreen.push_back("non");
		fullscreen.push_back("oui");
		fullscreen.move(100, 0);

		noFullscreen.setColor(skin->getColor(ERRORCOLOR));
		noFullscreen.move(100, 0);

		// Liste des skins
		std::vector<std::string> skins = skin->getSkinsList();		
		for (unsigned int i=0; i<skins.size(); i++)
			skinList.push_back(skins[i]);

		cancel.move(-100, 0);
		save.move(100, 0);

		cancel.setSelected(true);
		
		fullscreen.setNext(&skinList);
		skinList.setNext(&cancel);
		
		cancel.setPrevious(&skinList);
		cancel.setNext(&save);
			
		save.setPrevious(&skinList);
		save.setNext(&cancel);

		this->widgets.push_back(&title);
		this->widgets.push_back(&textFullscreen);
		this->widgets.push_back(&skinText);
		this->widgets.push_back(&skinList);
		this->widgets.push_back(&cancel);
		this->widgets.push_back(&save);

		this->window = NULL;
	}
	GameOptionsMenu::GameOptionsMenu(SMenuConfig* menuConfig) :
		title("Options de la partie", TITLEFONT, 30),
		category(TITLEFONT, 100),		
		cancel("Annuler", 550, CREATEGAMEMENU),
		save("Valider", 550, CREATEGAMEMENU),
		menuConfig(menuConfig)
	{
		ISkin* skin = PolyBomberApp::getISkin();
		
		title.setColor(skin->getColor(TITLECOLOR));

		category.push_back("Bonus de bombe");
		category.push_back("Bonus de personnage");
		category.push_back("Infections");

		cancel.move(-100, 0);
		save.move(100, 0);

		cancel.setSelected(true);
		
		cancel.setNext(&save);			
		save.setNext(&cancel);

		this->widgets.push_back(&title);
		this->widgets.push_back(&category);
		this->widgets.push_back(&cancel);
		this->widgets.push_back(&save);

		initBonus();
	}
	ControllersConfigMenu::ControllersConfigMenu() :
		title("Configuration des controleurs", TITLEFONT, 100),
		error("Aucun controleur detecte", TEXTFONT, 200),
		cancel("Retour", 500, CONFIGMENU)
	{
		ISkin* skin = PolyBomberApp::getISkin();	
		title.setColor(skin->getColor(TITLECOLOR));
		error.setColor(skin->getColor(ERRORCOLOR));

		this->widgets.push_back(&title);
		this->widgets.push_back(&error);
		this->widgets.push_back(&cancel);

		error.setVisible(false);

		for (int i=0; i<4; i++)
		{
			std::ostringstream text;
			text << "Joueur " << i+1 << " : ";
			playerText[i] = new TextWidget(text.str(), TEXTFONT, 250 + 50*i);
			playerText[i]->setColor(skin->getColor(TEXTCOLOR));
			playerText[i]->move(-100, 0);

			playerController[i] = new SelectionWidget(LINKFONT, 250 + 50*i);

			playerController[i]->push_back("Gamepad");
			playerController[i]->push_back("Clavier");
			playerController[i]->push_back("Wii");

			playerController[i]->move(100, 0);

			if (i > 0)
				playerController[i]->setPrevious(playerController[i-1]);			

			this->widgets.push_back(playerText[i]);
			this->widgets.push_back(playerController[i]);
		}

		playerController[0]->setNext(playerController[1]);
		playerController[1]->setNext(playerController[2]);
		playerController[2]->setNext(playerController[3]);
		playerController[3]->setNext(&cancel);

		cancel.setPrevious(playerController[3]);
		cancel.setSelected(true);
	}
Example #5
0
	WaitingMenu::WaitingMenu(SMenuConfig* menuConfig) :
		title("Resume de la partie", TITLEFONT, 50),
		ip("Adresse IP du serveur : ", TEXTFONT, 150),
		cancel("Annuler", 500, GAMEMENU),
		start("Jouer !", 500, RUNGAME),
		menuConfig(menuConfig)
	{
		ISkin* skin = PolyBomberApp::getISkin();
		
		title.setColor(skin->getColor(TITLECOLOR));
		ip.setColor(skin->getColor(TEXTCOLOR));

		this->network = PolyBomberApp::getINetworkToMenu();
		ip.setString(ip.getString() + this->network->getIpAddress());
		
		ip.move(-80, 0);
		
		cancel.move(-100, 0);
		start.move(100, 0);

		cancel.setSelected(true);
		cancel.setNext(&start);
		start.setNext(&cancel);

		this->widgets.push_back(&title);
		this->widgets.push_back(&ip);
		this->widgets.push_back(&cancel);
		this->widgets.push_back(&start);

		for (int i=0; i<4; i++)
		{
			this->pictures[i] = new ImageWidget();
			this->pictures[i]->setPosition(300, 200 + 60*i);				
			this->pictures[i]->setImage(skin->loadImage((EImage)(PLAYER1 + i)));				

			this->names[i] = new TextWidget("...", TEXTFONT, 210 + 60*i);
			this->names[i]->setColor(skin->getColor(TEXTCOLOR));
			this->names[i]->move(100, 0);

			this->widgets.push_back(this->pictures[i]);
			this->widgets.push_back(this->names[i]);
		}
	}
Example #6
0
	InputWidget::InputWidget(ETextFont font, unsigned int y, ETextPosition position, unsigned int width) :
		ClickableWidget(),
		text("", font, 0, LEFT),
		maxLength(10),
		WIDTH(800)
	{
		ISkin* skin = PolyBomberApp::getISkin();
		
		area.setSize(sf::Vector2f(width, 35));
		area.setFillColor(skin->getColor(BGCOLOR));
		area.setOutlineColor(skin->getColor(TEXTCOLOR));
		area.setOutlineThickness(3);

		text.setPosition(5, 5);
		text.setColor(skin->getColor(TEXTCOLOR));

		if (position == RIGHT)
			setPosition(this->WIDTH - width, y);
		else if (position == CENTER)
			setPosition(this->WIDTH/2 - (width)/2, y);
	}
	SelectSlotsMenu::SelectSlotsMenu(SMenuConfig* menuConfig) :
		title("Creation d'une partie", TITLEFONT, 100),
		error("Pas assez de place sur le serveur", TEXTFONT, 300),
		nbPlayersText("Nombre de joueurs sur cet ordinateur :", TEXTFONT, 250),
		nbPlayers(TEXTFONT, 300),
		cancel("Annuler", 450, GAMEMENU),
		next("Valider", 450, SELECTNAMEMENU),
		menuConfig(menuConfig)
	{
		ISkin* skin = PolyBomberApp::getISkin();
		
		title.setColor(skin->getColor(TITLECOLOR));
		error.setColor(skin->getColor(ERRORCOLOR));
		nbPlayersText.setColor(skin->getColor(TEXTCOLOR));

		cancel.move(-100, 0);
		next.move(100, 0);

		nbPlayers.push_back("1");
		nbPlayers.setCurrentItem(0);

		error.setVisible(false);

		cancel.setSelected(true);

		nbPlayers.setNext(&cancel);
		cancel.setPrevious(&nbPlayers);
		next.setPrevious(&nbPlayers);
		cancel.setNext(&next);
		next.setNext(&cancel);

		this->widgets.push_back(&title);
		this->widgets.push_back(&error);
		this->widgets.push_back(&nbPlayersText);
		this->widgets.push_back(&nbPlayers);
		this->widgets.push_back(&cancel);
		this->widgets.push_back(&next);

		this->network = PolyBomberApp::getINetworkToMenu();
	}
Example #8
0
	void InputWidget::setSelected(bool selected)
	{
		ISkin* skin = PolyBomberApp::getISkin();
		ClickableWidget::setSelected(selected);

		if (selected)
		{
			area.setFillColor(skin->getColor(SELECTEDBGCOLOR));
			area.setOutlineColor(skin->getColor(SELECTEDCOLOR));
			text.setColor(skin->getColor(SELECTEDCOLOR));
		}
		else
		{
			area.setFillColor(skin->getColor(BGCOLOR));
			area.setOutlineColor(skin->getColor(TEXTCOLOR));
			text.setColor(skin->getColor(TEXTCOLOR));
		}
	}
	KeyAssignMenu::KeyAssignMenu(unsigned int player) :
		title("Configuration des touches", TITLEFONT, 50),
		subtitle("Joueur 1", TITLEFONT, 100),
		errorKey("La touche est deja utilisee", TEXTFONT, 170),
		cancel("Annuler", 550, CONTROLLERSCONFIGMENU),
		save("Valider", 550, CONTROLLERSCONFIGMENU),
		player(player)
	{
		ISkin* skin = PolyBomberApp::getISkin();	
		title.setColor(skin->getColor(TITLECOLOR));
		subtitle.setColor(skin->getColor(TEXTCOLOR));
		errorKey.setColor(skin->getColor(ERRORCOLOR));

		std::ostringstream text;
		text << "Joueur " << player;

		subtitle.setString(text.str());

		errorKey.setVisible(false);

		this->widgets.push_back(&title);
		this->widgets.push_back(&subtitle);
		this->widgets.push_back(&errorKey);
		this->widgets.push_back(&cancel);
		this->widgets.push_back(&save);

		std::string actions[7] = {"Haut :", "Bas :", "Gauche :", "Droite :",
								  "Action 1 :", "Action 2 :", "Pause :"};

		for (int i=0; i<7; i++)
		{
			actionText[i] = new TextWidget(actions[i], TEXTFONT, 220 + 45*i, RIGHT);
			actionText[i]->setColor(skin->getColor(TEXTCOLOR));	
			actionText[i]->move(-420, 0);

			keyText[i] = new LinkWidget("touche", 220 + 45*i, NONEMENU);
			keyText[i]->move(70, 0);

			if (i > 0)
				keyText[i]->setPrevious(keyText[i-1]);
			
			this->widgets.push_back(actionText[i]);
			this->widgets.push_back(keyText[i]);
		}

		cancel.move(-100, 0);
		save.move(100, 0);

		for (int i=0; i<6; i++)
			keyText[i]->setNext(keyText[i+1]);

		keyText[6]->setNext(&cancel);		

		cancel.setPrevious(keyText[6]);
		cancel.setNext(&save);
			
		save.setPrevious(keyText[6]);
		save.setNext(&cancel);

		cancel.setSelected(true);

		this->window = NULL;
	}