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; } } }
/* updateCursorPosition - This method asks Windows for the position of the cursor in screen coordinates. The cursor position is fixed to account for windows borders. The values are recorded for use and the cursor is updated. */ void WindowsInput::updateCursorPosition(Game *game, WINDOWINFO wi, Cursor *cursor) { GetCursorPos(mousePoint); GameGraphics *graphics = game->getGraphics(); // Fix the mouse location mousePoint->x = mousePoint->x - wi.rcWindow.left - wi.rcClient.left; mousePoint->y = mousePoint->y - wi.rcWindow.top - wi.rcClient.top; if (mousePoint->x < 0) { mousePoint->x = 0; } if (mousePoint->x >= graphics->getScreenWidth()) { mousePoint->x = graphics->getScreenWidth() - 1; } if (mousePoint->y < 0) { mousePoint->y = 0; } if (mousePoint->y >= graphics->getScreenHeight()) { mousePoint->y = graphics->getScreenHeight() - 1; } cursor->setX(mousePoint->x); cursor->setY(mousePoint->y); }
/* addSpriteItemsToRenderList - This method goes through all of the sprites, including the player sprite, and adds the visible ones to the render list. This method should be called each frame. */ void SpriteManager::addSpriteItemsToRenderList() { Game *game = Game::getSingleton(); GameStateManager *gsm = game->getGSM(); GameGUI *gui = game->getGUI(); if (gsm->isWorldRenderable()) { GameGraphics *graphics = game->getGraphics(); RenderList *renderList = graphics->getWorldRenderList(); Viewport *viewport = gui->getViewport(); // ADD THE PLAYER SPRITE, IF THERE IS ONE if (player != nullptr) addSpriteToRenderList(player, renderList, viewport); // NOW ADD THE REST OF THE SPRITES list<Bot*>::iterator botIterator; botIterator = bots.begin(); while (botIterator != bots.end()) { Bot *bot = (*botIterator); addSpriteToRenderList(bot, renderList, viewport); botIterator++; } } }
/* addWorldRenderItemsToRenderList - This method sends the render list and viewport to each of the layers such that they may fill it with RenderItems to draw. */ void World::addWorldRenderItemsToRenderList(Game *game) { GameStateManager *gsm = game->getGSM(); GameGUI *gui = game->getGUI(); if (gsm->isWorldRenderable()) { GameGraphics *graphics = game->getGraphics(); RenderList *renderList = graphics->getWorldRenderList(); Viewport *viewport = gui->getViewport(); for (unsigned int i = 0; i < layers->size(); i++) { layers->at(i)->addRenderItemsToRenderList( renderList, viewport); } } }
/* addSpriteItemsToRenderList - This method goes through all of the sprites, including the player sprite, and adds the visible ones to the render list. This method should be called each frame. */ void SpriteManager::addSpriteItemsToRenderList( Game *game) { GameStateManager *gsm = game->getGSM(); GameGUI *gui = game->getGUI(); if (gsm->isWorldRenderable()) { GameGraphics *graphics = game->getGraphics(); RenderList *renderList = graphics->getWorldRenderList(); Viewport *viewport = gui->getViewport(); // ADD THE PLAYER SPRITE addSpriteToRenderList(&player, renderList, viewport); // NOW ADD THE REST OF THE SPRITES list<AnimatedSprite*>::iterator botIterator; botIterator = enemies.begin(); while (botIterator != enemies.end()) { AnimatedSprite *bot = (*botIterator); addSpriteToRenderList(bot, renderList, viewport); botIterator++; } // NOW ADD THE REST OF THE SPRITES list<AnimatedSprite*>::iterator blockIterator; blockIterator = blocks.begin(); while (blockIterator != blocks.end()) { AnimatedSprite *block = (*blockIterator); addSpriteToRenderList(block, renderList, viewport); blockIterator++; } list<AnimatedSprite*>::iterator exitIt; exitIt = exits.begin(); while (exitIt != exits.end()) { AnimatedSprite *exit = (*exitIt); addSpriteToRenderList(exit, renderList, viewport); exitIt++; } } }
/* addRenderItemsToRenderList - This method cascades this call to the current ScreenGUI. That object will add the appropriate items to the render list. This method should be called once per frame to make sure the current GUI is always rendered. Make sure the mode you provide matches the index of this GUI's screen. If an illegal mode value is provided, an exception is thrown. */ void GameGUI::addRenderItemsToRenderList(Game *game) { GameStateManager *gsm = game->getGSM(); GameState gameState = gsm->getCurrentGameState(); GameGraphics *graphics = game->getGraphics(); RenderList *guiRenderList = graphics->getGUIRenderList(); if (gsm->isAppActive()) { // CASCADE THIS CALL TO THE APPROPRIATE SCREEN screens.at(gameState)->addRenderItemsToRenderList(guiRenderList); } // CASCADE THIS CALL TO THE CURSOR, IF THERE IS ONE if (customCursor != NULL) customCursor->addRenderItemToRenderList(guiRenderList); }
/* addSpriteItemsToRenderList - This method goes through all of the sprites, including the player sprite, and adds the visible ones to the render list. This method should be called each frame. */ void SpriteManager::addSpriteItemsToRenderList( Game *game) { GameStateManager *gsm = game->getGSM(); GameGUI *gui = game->getGUI(); if (gsm->isWorldRenderable()) { GameGraphics *graphics = game->getGraphics(); RenderList *renderList = graphics->getWorldRenderList(); Viewport *viewport = gui->getViewport(); // ADD THE PLAYER SPRITE addSpriteToRenderList(&player, renderList, viewport); /* X = player.getPhysicalProperties() -> getX(); Y = player.getPhysicalProperties() -> getY();*/ //addSpriteToRenderList(&healthBar, renderList, viewport); // NOW ADD THE REST OF THE SPRITES list<Bot*>::iterator botIterator; botIterator = bots.begin(); while (botIterator != bots.end()) { Bot *bot = (*botIterator); if (bot->getCurrentState() == L"DYING" && bot->getRemoval() > 0) bot->setRemoval(bot->getRemoval()-1); if (bot->getRemoval() != 0) { addSpriteToRenderList(bot, renderList, viewport); } if (bot->getRemoval() == 0){ //bot->setCurrentlyCollidable(false); } botIterator++; } } }
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(); } } }