Exemplo n.º 1
0
void StatsPanel::SetUpItemMap(){
	int labelsPosX[] = {5,155,5,165,5,135};
	int labelsPosY[] = {160,160,230,230,300,300};
	std::string labelsString[] = {"Strength","Endure","Technique","Speed","Mining","Woodcutting"};
	for (int x = 0; x < 6; x++){
		Label* element = new Label(labelsPosX[x],labelsPosY[x],"blank.png",Label::Fonts::Game,labelsString[x] + ":");
		Label* valueElement = new Label(labelsPosX[x] + element->GetText()->getLocalBounds().width + 15,labelsPosY[x],"blank.png",Label::Fonts::Game,"null");
		AddItemElement(MyPair(std::to_string(x), element));
		AddItemElement(MyPair(labelsString[x] + "Value",valueElement));
	}
	Button* tempButton = new Button(127.5,15,"attacktextures/background.png","attacktextures/default.png");
	tempButton->SetTarget(this);
	tempButton->SetFunction("none");
	tempButton->CenterForeground();
	AddItemElement(MyPair("Image",tempButton));
	Label* label = new Label(103,110,120,"menubackground.png",Label::Fonts::Game,"null");
	label->CenterText();
	AddItemElement(MyPair("Name",label));
		Drawn* barPlaceHolder = new Drawn("blank.png");
	barPlaceHolder->SetPosition(sf::Vector2f(0,0));
	barPlaceHolder->texturePart.height = 35;
	barPlaceHolder->texturePart.width = GetSize().x;
	barPlaceHolder->SetRotation(0);
	barPlaceHolder->SetZ(2);
	itemMap.insert(MyPair("barPlaceHolder",barPlaceHolder));
};
Exemplo n.º 2
0
void GamePanel::SetUp(){
	std::string tempName = GetName();
	if(tempName != "Text" && tempName != "Game" && tempName != "Inventory" && tempName != "Equipment" && tempName != "Levels" && tempName != "OptionPanel"){
	    Drawn* background  = new Drawn("windows/" + GetName() + "background.png");
	    background->SetPosition(sf::Vector2f(0,0));
	    background->texturePart.height = 35;
	    backgroundElements.insert(MyPair("Background", background));
	}
	if(tempName != "LayeredPanel" && tempName != "Text" && tempName != "Game"){
	    Button* btnLabel = new Button(0,0,tempName);
	    btnLabel->foreground->GetSprite()->setOrigin(0,0);
	    backgroundElements.insert(MyPair("BackgroundLabel",btnLabel));
	}
	Drawn* barPlaceHolder = new Drawn("blank.png");
	barPlaceHolder->SetPosition(sf::Vector2f(0,0));
	barPlaceHolder->texturePart.height = 35;
	barPlaceHolder->texturePart.width = GetSize().x;
	barPlaceHolder->SetRotation(0);
	barPlaceHolder->SetZ(2);
	dynamicElements.insert(MyPair("barPlaceHolder",barPlaceHolder));
}
Exemplo n.º 3
0
void LevelPanel::SetUp(){
	std::string levelNames[] = {"strength","endurance","technique","speed","mining","woodcutting","smithing","crafting"};
	for (int x = 0; x < 8; x++){
		Button* tempButton = new Button(0,x*60,"levelbackground.png","levelButtons/" + levelNames[x] + ".png");
		tempButton->SetTarget(this);
		tempButton->SetFunction(levelNames[x]);
		tempButton->SetMoveOnHover(true);
		tempButton->SetHoverMovePosition(sf::Vector2i(30,0));
		AddDynamicElement(MyPair(levelNames[x], tempButton));
	}
	GamePanel::SetUp();
};
	void inventory::addWeapon(Weapon* aWeapon){
		//Add check for duplicate weapons

		weapons.insert(MyPair(aWeapon->getName(), aWeapon));
	}
Exemplo n.º 5
0
void OptionPanel::SetUp(){
	sf::RenderWindow* window = Drawn::gameWindow;
	Drawn* background = new Drawn("options_menu.png");
	staticElements.insert(MyPair("00", background));
	Button* tempButton = new Button(570,736,SlicedSprite::SpriteStyle::WoodPanel,"Cancel");
	tempButton->SetTarget(this);
	tempButton->SetFunction("cancel");
	AddDynamicElement(MyPair("cancel",tempButton));
	tempButton = new Button(690,736, SlicedSprite::SpriteStyle::WoodPanel,"Accept");
	tempButton->SetTarget(this);
	tempButton->SetFunction("accept");
	AddDynamicElement(MyPair("accept",tempButton));
	tempButton = new Button(15,736,SlicedSprite::SpriteStyle::WoodPanel,"Main Menu");
	tempButton->SetTarget(this);
	tempButton->SetFunction("main menu");
    	AddDynamicElement(MyPair("main menu",tempButton));
	tempButton = new Button(195,736,SlicedSprite::SpriteStyle::WoodPanel,"Exit");
	tempButton->SetTarget(this);
	tempButton->SetFunction("exit");
	AddDynamicElement(MyPair("exit",tempButton));
	AddDynamicElement(MyPair("fullscreen",new CheckBox(&(Game::fullscreen),262,167)));
	AddDynamicElement(MyPair("vsync",new CheckBox(&(Game::verticleSync),262,265)));
	AddDynamicElement(MyPair("brightness",new ScrollBar(262,317,300,&(Game::brightness))));
	
	AddDynamicElement(MyPair("masterVolume",new ScrollBar(262,483,300,&(Game::masterVolume))));
	AddDynamicElement(MyPair("musicVolume",new ScrollBar(262,602,300,&(Game::musicVolume))));
	AddDynamicElement(MyPair("effectVolume",new ScrollBar(262,542,300,&(Game::effectVolume))));
	AddDynamicElement(MyPair("mute",new CheckBox(&(Game::mute),262,657)));
};
Exemplo n.º 6
0
void StatsPanel::SetUpLevelMap(){
	mainLevelPercent = 0.5;
	subLevelPercents.push_back(0.5);
	subLevelPercents.push_back(0.5);
	Drawn* levelHeadline = new Drawn("levelButtons/strength.png");
	ProgressBar* mainLevelProgBar = new ProgressBar(8,100,310,&mainLevelPercent);
	Label* mainLevelBottomXP = new Label(8,75,"blank.png",Label::Fonts::Game,"0");
	Label* mainLevelCurrentXP = new Label(140,75,"blank.png",Label::Fonts::Game,"50");
	Label* mainLevelTopXP = new Label(245,75,"blank.png",Label::Fonts::Game,"100");
	Label* spendXPLabel = new Label(8,362,"blank.png",Label::Fonts::Game,"Spend XP:");
	Label* spendXPValue = new Label(100,362,"blank.png",Label::Fonts::Game,"100");
	AddLevelElement(MyPair("spendXPLabel",spendXPLabel));
	AddLevelElement(MyPair("spendXPValue",spendXPValue));
	AddLevelElement(MyPair("levelHeadline",levelHeadline));
	AddLevelElement(MyPair("mainLevelProgBar",mainLevelProgBar));
	AddLevelElement(MyPair("mainLevelBottomXP",mainLevelBottomXP));
	AddLevelElement(MyPair("mainLevelTopXP",mainLevelTopXP));
	AddLevelElement(MyPair("mainLevelCurrentXP",mainLevelCurrentXP));
	for(int x = 0; x < 2; x++){
		int displacement = 140;
		int displacement2 = 115;
		Label* subLevelTitle = new Label(8,(x*displacement2)+displacement,"blank.png",Label::Fonts::Game,"SubLevel:" + x);
		Label* subLevelDescription = new Label(8,(x*displacement2)+displacement + 20,"blank.png",Label::Fonts::Game,"SubLevel Description Text.");
		ProgressBar* subLevelProgBar = new ProgressBar(8,(x*displacement2) + displacement + 50,310,&subLevelPercents[x]);
		Label* subLevelBottomXP = new Label(8,(x*displacement2)+displacement + 75,"blank.png",Label::Fonts::Game,"0");
		Label* subLevelCurrentXP = new Label(140,(x*displacement2)+displacement + 75,"blank.png",Label::Fonts::Game,"50");
		Label* subLevelTopXP = new Label(245,(x*displacement2)+displacement + 75,"blank.png",Label::Fonts::Game,"100");
		Button* subLevelPlusButton = new Button(290,(x*displacement2) + displacement + 45,"buttonImages/plusButton.png","blank.png");
		subLevelPlusButton->SetTarget(this);
		subLevelPlusButton->SetFunction("plusButton" + std::to_string(x));
		AddLevelElement(MyPair("asubLevelProgBar" + std::to_string(x),subLevelProgBar));
		AddLevelElement(MyPair("subLevelPlusButton" + std::to_string(x),subLevelPlusButton));
		AddLevelElement(MyPair("subLevelTitle" + std::to_string(x),subLevelTitle));
		AddLevelElement(MyPair("subLevelDescription" + std::to_string(x),subLevelDescription));
		AddLevelElement(MyPair("subLevelCurrentXP" + std::to_string(x),subLevelCurrentXP));
		AddLevelElement(MyPair("subLevelBottomXP" + std::to_string(x),subLevelBottomXP));
		AddLevelElement(MyPair("subLevelTopXP" + std::to_string(x),subLevelTopXP));
	}
    	Drawn* barPlaceHolder = new Drawn("blank.png");
	barPlaceHolder->SetPosition(sf::Vector2f(0,0));
	barPlaceHolder->texturePart.height = 35;
	barPlaceHolder->texturePart.width = GetSize().x;
	barPlaceHolder->SetRotation(0);
	barPlaceHolder->SetZ(2);
	levelMap.insert(MyPair("barPlaceHolder",barPlaceHolder));
};