void RebelleUpgradeScreenGUI::unloadPlayerStats() { Game* game = Game::getSingleton(); GameGraphics *graphics = game->getGraphics(); TextureManager *guiTextureManager = graphics->getGUITextureManager(); unsigned int speedIconTID = guiTextureManager->loadTexture(SPEED_ICON_PATH); unsigned int attackIconTID = guiTextureManager->loadTexture(ATTACK_ICON_PATH); unsigned int defenseIconTID = guiTextureManager->loadTexture(DEFENSE_ICON_PATH); list<OverlayImage*>* overlayImageList = this->getOverlayImageList(); list<OverlayImage*>::iterator it = overlayImageList->begin(); while (it != overlayImageList->end()) { OverlayImage* image = *it; it++; if (image->imageID == speedIconTID || image->imageID == attackIconTID || image->imageID == defenseIconTID) { overlayImageList->remove(image); delete image; } } }
void RebelleUpgradeScreenGUI::loadPlayerStats() { Game* game = Game::getSingleton(); GameStateManager* gsm = game->getGSM(); SpriteManager* spriteMgr = gsm->getSpriteManager(); GameGraphics *graphics = game->getGraphics(); TextureManager *guiTextureManager = graphics->getGUITextureManager(); PlayerSprite *player = spriteMgr->getPlayer(); int speed = player->getSpeed(); int attack = player->getAttack(); int defense = player->getDefense(); unsigned int speedIconTID = guiTextureManager->loadTexture(SPEED_ICON_PATH); unsigned int attackIconTID = guiTextureManager->loadTexture(ATTACK_ICON_PATH); unsigned int defenseIconTID = guiTextureManager->loadTexture(DEFENSE_ICON_PATH); //// - first speed icon will be rendered at 20px right to upgrade button int speedIconY = statListY + statLineHeight + ydistBetweenStats; int nextSpeedIconX = statListX + statTitleWidth + statTitleWidth + upgradeButtonWidth + 20; for (int i = 0; i < speed; i++) { OverlayImage *speedIcon = new OverlayImage(); speedIcon->alpha = 255; speedIcon->width = STAT_ICON_WIDTH; speedIcon->height = STAT_ICON_HEIGHT; speedIcon->x = nextSpeedIconX; speedIcon->y = speedIconY; speedIcon->z = 0; speedIcon->imageID = speedIconTID; this->addOverlayImage(speedIcon); nextSpeedIconX += STAT_ICON_WIDTH + 3; } //// attack icons should be next to Attack stat title and the button. int attackIconY = speedIconY + statLineHeight + ydistBetweenStats; int nextAttackIconX = statListX + statTitleWidth + statTitleWidth + upgradeButtonWidth + 20; for (int i = 0; i < attack; i++) { OverlayImage *attackIcon = new OverlayImage(); attackIcon->alpha = 255; attackIcon->width = STAT_ICON_WIDTH; attackIcon->height = STAT_ICON_HEIGHT; attackIcon->x = nextAttackIconX; attackIcon->y = attackIconY; attackIcon->z = 0; attackIcon->imageID = attackIconTID; this->addOverlayImage(attackIcon); nextAttackIconX += STAT_ICON_WIDTH + 3; } //// defense icons int defenseIconY = attackIconY + statLineHeight + ydistBetweenStats; int nextDefenseIconX = statListX + statTitleWidth + statTitleWidth + upgradeButtonWidth + 20; for (int i = 0; i < attack; i++) { OverlayImage *defenseIcon = new OverlayImage(); defenseIcon->alpha = 255; defenseIcon->width = STAT_ICON_WIDTH; defenseIcon->height = STAT_ICON_HEIGHT; defenseIcon->x = nextDefenseIconX; defenseIcon->y = defenseIconY; defenseIcon->z = 0; defenseIcon->imageID = defenseIconTID; this->addOverlayImage(defenseIcon); nextDefenseIconX += STAT_ICON_WIDTH + 3; } }
/* initWRgui - This method builds a GUI for the Empty Game application. Note that we load all the GUI components from this method, including the ScreenGUI with Buttons and Overlays and the Cursor. */ void initWRgui(Game *game) { GameGraphics *graphics = game->getGraphics(); GameDataLoader *dataLoader = game->getDataLoader(); GameGUI *gui = game->getGUI(); DirectXTextureManager *guiTextureManager = (DirectXTextureManager*)graphics->getGUITextureManager(); // COLOR USED FOR RENDERING TEXT graphics->setFontColor(255, 255, 255); // COLOR KEY - COLOR TO BE IGNORED WHEN LOADING AN IMAGE graphics->setColorKey(96, 128, 224); // SETUP THE CURSOR vector<int> *imageIDs = new vector<int>(); PlayerStatsGui *screenGUI = new PlayerStatsGui(); Player *playerObject = game->getPlayerObject(); OverlayImage *imageToAdd; Button *buttonToAdd; wchar_t *buttonCommand; int normalTextureID; int mouseOverTextureID; int initX; int initY; int initWidth; int initHeight; file = game->getDataLoader()->getGameMenuFile(); using namespace std; wchar_t *value; ifstream inputFile; string lineRead; inputFile.open(file); if (inputFile) { char inputLine[255]; stringstream ss; while (getline(inputFile, lineRead)) { ss<<lineRead; while(getline(ss,lineRead,',')) { if(lineRead.compare("cursor")==0) { getline(ss,lineRead,','); fileName= dataLoader->stringToLCPWSTR(lineRead); imageID = guiTextureManager->loadTexture(fileName); imageIDs->push_back(imageID); Cursor *cursor = new Cursor(); cursor->initCursor( imageIDs, *(imageIDs->begin()), 0, 0, 0, 255, 32, 32); gui->setCursor(cursor); } else if (lineRead.compare("splashScreen")==0) { getline(ss, lineRead, ','); screenGUI = new PlayerStatsGui(); fileName = constructEmptyWCHAR_TArray(dataLoader->stringToLCPWSTR(lineRead)); imageID = guiTextureManager->loadTexture(fileName); imageToAdd = new OverlayImage(); getline(ss, lineRead, ','); imageToAdd->x = atoi(lineRead.c_str()); getline(ss, lineRead, ','); imageToAdd->y = atoi(lineRead.c_str()); imageToAdd->z = 0; imageToAdd->alpha = 200; getline(ss, lineRead, ','); imageToAdd->width = atoi(lineRead.c_str()); getline(ss, lineRead, ','); imageToAdd->height = atoi(lineRead.c_str()); imageToAdd->imageID = imageID; screenGUI->addOverlayImage(imageToAdd); gui->addScreenGUI(screenGUI); } else if (lineRead.compare("exit")==0) { buttonToAdd = new Button(); buttonCommand = constructEmptyWCHAR_TArray(L"Exit"); getline(ss, lineRead, ','); fileName = constructEmptyWCHAR_TArray(dataLoader->stringToLCPWSTR(lineRead)); normalTextureID = guiTextureManager->loadTexture(fileName); getline(ss, lineRead, ','); fileName = constructEmptyWCHAR_TArray(dataLoader->stringToLCPWSTR(lineRead)); mouseOverTextureID = guiTextureManager->loadTexture(fileName); getline(ss, lineRead, ','); initX = atoi(lineRead.c_str()); getline(ss, lineRead, ','); initY = atoi(lineRead.c_str()); getline(ss, lineRead, ','); initWidth = atoi(lineRead.c_str()); getline(ss, lineRead, ','); initHeight = atoi(lineRead.c_str()); buttonToAdd->initButton(normalTextureID, mouseOverTextureID, initX, initY, 0, 255, initWidth, initHeight, false, buttonCommand); screenGUI->addButton(buttonToAdd); } else if (lineRead.compare("startGame")==0) { buttonToAdd = new Button(); buttonCommand = constructEmptyWCHAR_TArray(L"Start"); getline(ss, lineRead, ','); fileName = constructEmptyWCHAR_TArray(dataLoader->stringToLCPWSTR(lineRead)); normalTextureID = guiTextureManager->loadTexture(fileName); getline(ss, lineRead, ','); fileName = constructEmptyWCHAR_TArray(dataLoader->stringToLCPWSTR(lineRead)); mouseOverTextureID = guiTextureManager->loadTexture(fileName); getline(ss, lineRead, ','); initX = atoi(lineRead.c_str()); getline(ss, lineRead, ','); initY = atoi(lineRead.c_str()); getline(ss, lineRead, ','); initWidth = atoi(lineRead.c_str()); getline(ss, lineRead, ','); initHeight = atoi(lineRead.c_str()); buttonToAdd->initButton(normalTextureID, mouseOverTextureID, initX, initY, 0, 255, initWidth, initHeight, false, buttonCommand); screenGUI->addButton(buttonToAdd); } else if (lineRead.compare("about")==0) { buttonToAdd = new Button(); buttonCommand = constructEmptyWCHAR_TArray(L"About"); getline(ss, lineRead, ','); fileName = constructEmptyWCHAR_TArray(dataLoader->stringToLCPWSTR(lineRead)); normalTextureID = guiTextureManager->loadTexture(fileName); getline(ss, lineRead, ','); fileName = constructEmptyWCHAR_TArray(dataLoader->stringToLCPWSTR(lineRead)); mouseOverTextureID = guiTextureManager->loadTexture(fileName); getline(ss, lineRead, ','); initX = atoi(lineRead.c_str()); getline(ss, lineRead, ','); initY = atoi(lineRead.c_str()); getline(ss, lineRead, ','); initWidth = atoi(lineRead.c_str()); getline(ss, lineRead, ','); initHeight = atoi(lineRead.c_str()); buttonToAdd->initButton(normalTextureID, mouseOverTextureID, initX, initY, 0, 255, initWidth, initHeight, false, buttonCommand); screenGUI->addButton(buttonToAdd); } else if (lineRead.compare("controls")==0) { buttonToAdd = new Button(); buttonCommand = constructEmptyWCHAR_TArray(L"Controls"); getline(ss, lineRead, ','); fileName = constructEmptyWCHAR_TArray(dataLoader->stringToLCPWSTR(lineRead)); normalTextureID = guiTextureManager->loadTexture(fileName); getline(ss, lineRead, ','); fileName = constructEmptyWCHAR_TArray(dataLoader->stringToLCPWSTR(lineRead)); mouseOverTextureID = guiTextureManager->loadTexture(fileName); getline(ss, lineRead, ','); initX = atoi(lineRead.c_str()); getline(ss, lineRead, ','); initY = atoi(lineRead.c_str()); getline(ss, lineRead, ','); initWidth = atoi(lineRead.c_str()); getline(ss, lineRead, ','); initHeight = atoi(lineRead.c_str()); buttonToAdd->initButton(normalTextureID, mouseOverTextureID, initX, initY, 0, 255, initWidth, initHeight, false, buttonCommand); screenGUI->addButton(buttonToAdd); } else if (lineRead.compare("help")==0) { buttonToAdd = new Button(); buttonCommand = constructEmptyWCHAR_TArray(L"Help"); getline(ss, lineRead, ','); fileName = constructEmptyWCHAR_TArray(dataLoader->stringToLCPWSTR(lineRead)); normalTextureID = guiTextureManager->loadTexture(fileName); getline(ss, lineRead, ','); fileName = constructEmptyWCHAR_TArray(dataLoader->stringToLCPWSTR(lineRead)); mouseOverTextureID = guiTextureManager->loadTexture(fileName); getline(ss, lineRead, ','); initX = atoi(lineRead.c_str()); getline(ss, lineRead, ','); initY = atoi(lineRead.c_str()); getline(ss, lineRead, ','); initWidth = atoi(lineRead.c_str()); getline(ss, lineRead, ','); initHeight = atoi(lineRead.c_str()); buttonToAdd->initButton(normalTextureID, mouseOverTextureID, initX, initY, 0, 255, initWidth, initHeight, false, buttonCommand); screenGUI->addButton(buttonToAdd); } else if (lineRead.compare("equip")==0) { buttonToAdd = new Button(); buttonCommand = constructEmptyWCHAR_TArray(L"Equip"); getline(ss, lineRead, ','); fileName = constructEmptyWCHAR_TArray(dataLoader->stringToLCPWSTR(lineRead)); normalTextureID = guiTextureManager->loadTexture(fileName); getline(ss, lineRead, ','); fileName = constructEmptyWCHAR_TArray(dataLoader->stringToLCPWSTR(lineRead)); mouseOverTextureID = guiTextureManager->loadTexture(fileName); getline(ss, lineRead, ','); initX = atoi(lineRead.c_str()); getline(ss, lineRead, ','); initY = atoi(lineRead.c_str()); getline(ss, lineRead, ','); initWidth = atoi(lineRead.c_str()); getline(ss, lineRead, ','); initHeight = atoi(lineRead.c_str()); buttonToAdd->initButton(normalTextureID, mouseOverTextureID, initX, initY, 0, 255, initWidth, initHeight, false, buttonCommand); screenGUI->addButton(buttonToAdd); } else if (lineRead.compare("controlsScreen")==0) { getline(ss, lineRead, ','); screenGUI = new PlayerStatsGui(); fileName = constructEmptyWCHAR_TArray(dataLoader->stringToLCPWSTR(lineRead)); imageID = guiTextureManager->loadTexture(fileName); imageToAdd = new OverlayImage(); getline(ss, lineRead, ','); imageToAdd->x = atoi(lineRead.c_str()); getline(ss, lineRead, ','); imageToAdd->y = atoi(lineRead.c_str()); imageToAdd->z = 0; imageToAdd->alpha = 200; getline(ss, lineRead, ','); imageToAdd->width = atoi(lineRead.c_str()); getline(ss, lineRead, ','); imageToAdd->height = atoi(lineRead.c_str()); imageToAdd->imageID = imageID; screenGUI->addOverlayImage(imageToAdd); gui->addScreenGUI(screenGUI); } else if (lineRead.compare("back")==0) { buttonToAdd = new Button(); buttonCommand = constructEmptyWCHAR_TArray(L"Back"); getline(ss, lineRead, ','); fileName = constructEmptyWCHAR_TArray(dataLoader->stringToLCPWSTR(lineRead)); normalTextureID = guiTextureManager->loadTexture(fileName); getline(ss, lineRead, ','); fileName = constructEmptyWCHAR_TArray(dataLoader->stringToLCPWSTR(lineRead)); mouseOverTextureID = guiTextureManager->loadTexture(fileName); getline(ss, lineRead, ','); initX = atoi(lineRead.c_str()); getline(ss, lineRead, ','); initY = atoi(lineRead.c_str()); getline(ss, lineRead, ','); initWidth = atoi(lineRead.c_str()); getline(ss, lineRead, ','); initHeight = atoi(lineRead.c_str()); buttonToAdd->initButton(normalTextureID, mouseOverTextureID, initX, initY, 0, 255, initWidth, initHeight, false, buttonCommand); screenGUI->addButton(buttonToAdd); } else if (lineRead.compare("restart")==0) { buttonToAdd = new Button(); buttonCommand = constructEmptyWCHAR_TArray(L"Restart"); getline(ss, lineRead, ','); fileName = constructEmptyWCHAR_TArray(dataLoader->stringToLCPWSTR(lineRead)); normalTextureID = guiTextureManager->loadTexture(fileName); getline(ss, lineRead, ','); fileName = constructEmptyWCHAR_TArray(dataLoader->stringToLCPWSTR(lineRead)); mouseOverTextureID = guiTextureManager->loadTexture(fileName); getline(ss, lineRead, ','); initX = atoi(lineRead.c_str()); getline(ss, lineRead, ','); initY = atoi(lineRead.c_str()); getline(ss, lineRead, ','); initWidth = atoi(lineRead.c_str()); getline(ss, lineRead, ','); initHeight = atoi(lineRead.c_str()); buttonToAdd->initButton(normalTextureID, mouseOverTextureID, initX, initY, 0, 255, initWidth, initHeight, false, buttonCommand); screenGUI->addButton(buttonToAdd); } else if (lineRead.compare("resume")==0) { buttonToAdd = new Button(); buttonCommand = constructEmptyWCHAR_TArray(L"Resume"); getline(ss, lineRead, ','); fileName = constructEmptyWCHAR_TArray(dataLoader->stringToLCPWSTR(lineRead)); normalTextureID = guiTextureManager->loadTexture(fileName); getline(ss, lineRead, ','); fileName = constructEmptyWCHAR_TArray(dataLoader->stringToLCPWSTR(lineRead)); mouseOverTextureID = guiTextureManager->loadTexture(fileName); getline(ss, lineRead, ','); initX = atoi(lineRead.c_str()); getline(ss, lineRead, ','); initY = atoi(lineRead.c_str()); getline(ss, lineRead, ','); initWidth = atoi(lineRead.c_str()); getline(ss, lineRead, ','); initHeight = atoi(lineRead.c_str()); buttonToAdd->initButton(normalTextureID, mouseOverTextureID, initX, initY, 0, 255, initWidth, initHeight, false, buttonCommand); screenGUI->addButton(buttonToAdd); } else if (lineRead.compare("helpScreen")==0) { getline(ss, lineRead, ','); screenGUI = new PlayerStatsGui(); fileName = constructEmptyWCHAR_TArray(dataLoader->stringToLCPWSTR(lineRead)); imageID = guiTextureManager->loadTexture(fileName); imageToAdd = new OverlayImage(); getline(ss, lineRead, ','); imageToAdd->x = atoi(lineRead.c_str()); getline(ss, lineRead, ','); imageToAdd->y = atoi(lineRead.c_str()); imageToAdd->z = 0; imageToAdd->alpha = 200; getline(ss, lineRead, ','); imageToAdd->width = atoi(lineRead.c_str()); getline(ss, lineRead, ','); imageToAdd->height = atoi(lineRead.c_str()); imageToAdd->imageID = imageID; screenGUI->addOverlayImage(imageToAdd); gui->addScreenGUI(screenGUI); } else if (lineRead.compare("aboutScreen")==0) { getline(ss, lineRead, ','); screenGUI = new PlayerStatsGui(); fileName = constructEmptyWCHAR_TArray(dataLoader->stringToLCPWSTR(lineRead)); imageID = guiTextureManager->loadTexture(fileName); imageToAdd = new OverlayImage(); getline(ss, lineRead, ','); imageToAdd->x = atoi(lineRead.c_str()); getline(ss, lineRead, ','); imageToAdd->y = atoi(lineRead.c_str()); imageToAdd->z = 0; imageToAdd->alpha = 200; getline(ss, lineRead, ','); imageToAdd->width = atoi(lineRead.c_str()); getline(ss, lineRead, ','); imageToAdd->height = atoi(lineRead.c_str()); imageToAdd->imageID = imageID; screenGUI->addOverlayImage(imageToAdd); gui->addScreenGUI(screenGUI); } else if (lineRead.compare("gameOverScreen")==0) { getline(ss, lineRead, ','); screenGUI = new PlayerStatsGui(); fileName = constructEmptyWCHAR_TArray(dataLoader->stringToLCPWSTR(lineRead)); imageID = guiTextureManager->loadTexture(fileName); imageToAdd = new OverlayImage(); getline(ss, lineRead, ','); imageToAdd->x = atoi(lineRead.c_str()); getline(ss, lineRead, ','); imageToAdd->y = atoi(lineRead.c_str()); imageToAdd->z = 0; imageToAdd->alpha = 200; getline(ss, lineRead, ','); imageToAdd->width = atoi(lineRead.c_str()); getline(ss, lineRead, ','); imageToAdd->height = atoi(lineRead.c_str()); imageToAdd->imageID = imageID; screenGUI->addOverlayImage(imageToAdd); gui->addScreenGUI(screenGUI); } else if (lineRead.compare("inGameScreen")==0) { screenGUI = new PlayerStatsGui(); getline(ss, lineRead, ','); fileName = constructEmptyWCHAR_TArray(dataLoader->stringToLCPWSTR(lineRead)); imageID = guiTextureManager->loadTexture(fileName); imageToAdd = new OverlayImage(); getline(ss, lineRead, ','); imageToAdd->x = atoi(lineRead.c_str()); getline(ss, lineRead, ','); imageToAdd->y = atoi(lineRead.c_str()); imageToAdd->z = 0; imageToAdd->alpha = 255; getline(ss, lineRead, ','); imageToAdd->width = atoi(lineRead.c_str()); getline(ss, lineRead, ','); imageToAdd->height = atoi(lineRead.c_str()); imageToAdd->imageID = imageID; screenGUI->addOverlayImage(imageToAdd); //equipBar images fileName = constructEmptyWCHAR_TArray(dataLoader->stringToLCPWSTR("textures/gui/overlays/itemButton.png")); int inventoryButtonID = guiTextureManager->loadTexture(fileName); Item *itemtorender = new Item(); itemtorender->imageID = inventoryButtonID; playerObject->setAtkEquipped(itemtorender); playerObject->setMscEquipped(itemtorender); //initialize inventory empty images dataloader->clearInventory(game); /*for (int i=0; i<15; i++) { playerObject->setInventoryImage(i,inventoryButtonID); }*/ //hp images while(getline(ss, lineRead, ',')) { fileName = constructEmptyWCHAR_TArray(dataLoader->stringToLCPWSTR(lineRead)); imageID = guiTextureManager->loadTexture(fileName); imageToAdd = new OverlayImage(); getline(ss, lineRead, ','); imageToAdd->x = atoi(lineRead.c_str()); getline(ss, lineRead, ','); imageToAdd->y = atoi(lineRead.c_str()); imageToAdd->z = 0; imageToAdd->alpha = 255; getline(ss, lineRead, ','); imageToAdd->width = atoi(lineRead.c_str()); getline(ss, lineRead, ','); imageToAdd->height = atoi(lineRead.c_str()); imageToAdd->imageID = imageID; playerObject->addHPIcon(imageToAdd); playerObject->resetHP(playerObject->getHPImages()); } screenGUI->setHPBar(playerObject->getHPBar()); screenGUI->setEquipBar(playerObject->getEquipBar()); gui->addScreenGUI(screenGUI); } else if (lineRead.compare("pauseScreen")==0) { getline(ss, lineRead, ','); screenGUI = new PlayerStatsGui(); fileName = constructEmptyWCHAR_TArray(dataLoader->stringToLCPWSTR(lineRead)); imageID = guiTextureManager->loadTexture(fileName); imageToAdd = new OverlayImage(); getline(ss, lineRead, ','); imageToAdd->x = atoi(lineRead.c_str()); getline(ss, lineRead, ','); imageToAdd->y = atoi(lineRead.c_str()); imageToAdd->z = 0; imageToAdd->alpha = 200; getline(ss, lineRead, ','); imageToAdd->width = atoi(lineRead.c_str()); getline(ss, lineRead, ','); imageToAdd->height = atoi(lineRead.c_str()); imageToAdd->imageID = imageID; screenGUI->addOverlayImage(imageToAdd); getline(ss, lineRead, ','); fileName = constructEmptyWCHAR_TArray(dataLoader->stringToLCPWSTR(lineRead)); imageID = guiTextureManager->loadTexture(fileName); imageToAdd = new OverlayImage(); getline(ss, lineRead, ','); imageToAdd->x = atoi(lineRead.c_str()); getline(ss, lineRead, ','); imageToAdd->y = atoi(lineRead.c_str()); imageToAdd->z = 0; imageToAdd->alpha = 255; getline(ss, lineRead, ','); imageToAdd->width = atoi(lineRead.c_str()); getline(ss, lineRead, ','); imageToAdd->height = atoi(lineRead.c_str()); imageToAdd->imageID = imageID; screenGUI->addOverlayImage(imageToAdd); screenGUI->setHPBar(playerObject->getHPBar()); screenGUI->setEquipBar(playerObject->getEquipBar()); gui->addScreenGUI(screenGUI); } else if (lineRead.compare("inventory")==0) { getline(ss, lineRead, ','); screenGUI = new PlayerStatsGui(); fileName = constructEmptyWCHAR_TArray(dataLoader->stringToLCPWSTR(lineRead)); imageID = guiTextureManager->loadTexture(fileName); imageToAdd = new OverlayImage(); getline(ss, lineRead, ','); imageToAdd->x = atoi(lineRead.c_str()); getline(ss, lineRead, ','); imageToAdd->y = atoi(lineRead.c_str()); imageToAdd->z = 0; imageToAdd->alpha = 200; getline(ss, lineRead, ','); imageToAdd->width = atoi(lineRead.c_str()); getline(ss, lineRead, ','); imageToAdd->height = atoi(lineRead.c_str()); imageToAdd->imageID = imageID; screenGUI->addOverlayImage(imageToAdd); getline(ss, lineRead, ','); fileName = constructEmptyWCHAR_TArray(dataLoader->stringToLCPWSTR(lineRead)); imageID = guiTextureManager->loadTexture(fileName); imageToAdd = new OverlayImage(); getline(ss, lineRead, ','); imageToAdd->x = atoi(lineRead.c_str()); getline(ss, lineRead, ','); imageToAdd->y = atoi(lineRead.c_str()); imageToAdd->z = 0; imageToAdd->alpha = 255; getline(ss, lineRead, ','); imageToAdd->width = atoi(lineRead.c_str()); getline(ss, lineRead, ','); imageToAdd->height = atoi(lineRead.c_str()); imageToAdd->imageID = imageID; screenGUI->addOverlayImage(imageToAdd); screenGUI->setHPBar(playerObject->getHPBar()); screenGUI->setEquipBar(playerObject->getEquipBar()); playerObject->updateInventoryBar(playerObject->getInventoryImages()); screenGUI->setInventoryBar(playerObject->getInventoryBar()); for (int i = 0; i <15;i++) { buttonToAdd = new Button(); stringstream out; out << i; string buttonName = "item" + out.str(); buttonCommand = constructEmptyWCHAR_TArray(dataLoader->stringToLCPWSTR(buttonName)); fileName = constructEmptyWCHAR_TArray(dataLoader->stringToLCPWSTR("textures/gui/overlays/itemButton.png")); normalTextureID = guiTextureManager->loadTexture(fileName); mouseOverTextureID = guiTextureManager->loadTexture(fileName); initX = (290 + 8 + (i%5)*95); initY = (450 + 8 + (i/5)*90); initWidth = 50; initHeight = 50; buttonToAdd->initButton(normalTextureID, mouseOverTextureID, initX, initY, 0, 255, initWidth, initHeight, false, buttonCommand); screenGUI->addButton(buttonToAdd); } gui->addScreenGUI(screenGUI); } else if (lineRead.compare("inventoryRow")==0) { getline(ss, lineRead, ','); fileName = constructEmptyWCHAR_TArray(dataLoader->stringToLCPWSTR(lineRead)); imageID = guiTextureManager->loadTexture(fileName); imageToAdd = new OverlayImage(); getline(ss, lineRead, ','); imageToAdd->x = atoi(lineRead.c_str()); getline(ss, lineRead, ','); imageToAdd->y = atoi(lineRead.c_str()); imageToAdd->z = 0; imageToAdd->alpha = 255; getline(ss, lineRead, ','); imageToAdd->width = atoi(lineRead.c_str()); getline(ss, lineRead, ','); imageToAdd->height = atoi(lineRead.c_str()); imageToAdd->imageID = imageID; screenGUI->addOverlayImage(imageToAdd); } else if (lineRead.compare("checkScreen")==0) { getline(ss, lineRead, ','); screenGUI = new PlayerStatsGui(); fileName = constructEmptyWCHAR_TArray(dataLoader->stringToLCPWSTR(lineRead)); imageID = guiTextureManager->loadTexture(fileName); imageToAdd = new OverlayImage(); getline(ss, lineRead, ','); imageToAdd->x = atoi(lineRead.c_str()); getline(ss, lineRead, ','); imageToAdd->y = atoi(lineRead.c_str()); imageToAdd->z = 0; imageToAdd->alpha = 200; getline(ss, lineRead, ','); imageToAdd->width = atoi(lineRead.c_str()); getline(ss, lineRead, ','); imageToAdd->height = atoi(lineRead.c_str()); imageToAdd->imageID = imageID; screenGUI->addOverlayImage(imageToAdd); getline(ss, lineRead, ','); fileName = constructEmptyWCHAR_TArray(dataLoader->stringToLCPWSTR(lineRead)); imageID = guiTextureManager->loadTexture(fileName); imageToAdd = new OverlayImage(); getline(ss, lineRead, ','); imageToAdd->x = atoi(lineRead.c_str()); getline(ss, lineRead, ','); imageToAdd->y = atoi(lineRead.c_str()); imageToAdd->z = 0; imageToAdd->alpha = 255; getline(ss, lineRead, ','); imageToAdd->width = atoi(lineRead.c_str()); getline(ss, lineRead, ','); imageToAdd->height = atoi(lineRead.c_str()); imageToAdd->imageID = imageID; screenGUI->addOverlayImage(imageToAdd); screenGUI->setHPBar(playerObject->getHPBar()); screenGUI->setEquipBar(playerObject->getEquipBar()); gui->addScreenGUI(screenGUI); ///////////////////////////// } } ss.clear(); } } }