Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /***********************************************
- * Filename: UIManager.cpp
- * Author: Jason Rhode
- ************************************************/
- #include "stdafx.h"
- #include "UIManager.h"
- #include "..\Entities\Player\Player.h"
- #include "..\Entities\AI\AIManager.h"
- #include "..\States\StateManager.h"
- #include "..\States\GameplayState.h"
- #include "..\Entities\Orb.h"
- #include "UIObject.h"
- #include "..\Entities\EntityManager.h"
- #include "..\Entities\Score.h"
- #include "../Engine/AssetManager.h"
- #include "../Engine/GameSave.h"
- #include "../Engine/Renderer/C3DManager.h"
- #include "../Entities/Fountain.h"
- #include "../Entities/FountainInfluence.h"
- CUIManager::CUIManager()
- {
- eCurrentState = STATE_MENU;
- fInstrFS = 0.0f;
- }
- CUIManager::~CUIManager()
- {
- }
- bool CUIManager::Initialize( void )
- {
- m_cInput = &CStateManager::GetInstance()->m_cInput;
- Shutdown();
- TiXmlDocument tDoc;
- if(tDoc.LoadFile("..\\Core\\Game\\Scripts\\ResolutionChange.xml") == false)
- {
- return false;
- }
- TiXmlElement* tRoot = tDoc.RootElement(); // Resolution
- if(tRoot == nullptr )
- {
- return false;
- }
- TiXmlElement* tSizeOne = tRoot->FirstChildElement("Size");
- int nUIWidth, nUIHeight;
- tSizeOne->Attribute("Width", &nUIWidth);
- tSizeOne->Attribute("Height", &nUIHeight);
- TiXmlElement* tSize = nullptr;
- // Res is 1024 x 768
- if( nUIWidth != CStateManager::GetInstance()->GetWindowWidth() && nUIHeight != CStateManager::GetInstance()->GetWindowHeight() )
- {
- TiXmlElement* tSizeTwo = tSizeOne->NextSiblingElement("Size");
- tSize = tSizeTwo;
- }
- else
- {
- tSize = tSizeOne;
- }
- TiXmlElement* tPrimaryScreen = tSize->FirstChildElement("Screen");
- int nNumButtons, nValue, nNameCount;
- double dValue;
- TiXmlElement* tPrimary;
- TiXmlElement* tSecondary;
- std::string szScreen;
- float fTempScale;
- RECT tLoad;
- // Load in button info for all buttons on all screens.
- RECT rBGRect;
- if(CStateManager::GetInstance()->GetWindowWidth() == 1024)
- {
- fInstrFS = .35f;
- fTempScale = .45f;
- RECT rSize = { 0, 0, 1024, 768 };
- rBGRect = rSize;
- }
- else
- {
- fInstrFS = .5f;
- fTempScale = .65f;
- RECT rSize = { 0, 0, 1920, 1080 };
- rBGRect = rSize;
- }
- // Main Menu
- tButton tMenuButton;
- szScreen = tPrimaryScreen->Attribute("Title");
- tPrimaryScreen->Attribute("Num", &nNumButtons);
- tMenuButton.m_szFunction = szScreen;
- tMenuButton.m_nButtonNum = MM_PLAY;
- tMenuButton.m_nTotalButtons = nNumButtons;
- tMenuButton.m_bHidden = false;
- tMenuButton.m_nParentButton = 0;
- tPrimary = tPrimaryScreen->FirstChildElement("Rect");
- tMenuButton.m_tClickArea = LoadRECT(tPrimary);
- tPrimary = tPrimary->NextSiblingElement("Pos");
- tPrimary->Attribute("X", &nValue);
- tMenuButton.m_tPos.x = (float)nValue;
- tPrimary->Attribute("Y", &nValue);
- tMenuButton.m_tPos.y = (float)nValue;
- tLoad.left = 0;
- tLoad.right = 295;
- tLoad.top = 0;
- tLoad.bottom = 54;
- tPrimary = tPrimary->NextSiblingElement("Other");
- tPrimary->Attribute("Incr", &dValue);
- tMenuButton.m_fIncrement = (float)dValue;
- tMenuButton.m_ButtonWidth = static_cast<float>(tMenuButton.m_tClickArea.bottom - tMenuButton.m_tClickArea.top);
- tMenuButton.m_cBackgroundImg.Create(rBGRect, CStateManager::GetInstance()->GetAssetManagerHandle()->tUI[STATE_MENU]->m_tImages[UI_BG], 0.8f);
- tMenuButton.m_cButtonImg.Create(tLoad, CStateManager::GetInstance()->GetAssetManagerHandle()->tUI[STATE_MENU]->m_tImages[UI_SELECT], 0.7f);
- tPrimary = tPrimary->NextSiblingElement("Label");
- tPrimary->Attribute("Num", &nNameCount);
- tPrimary = tPrimary->FirstChildElement("Name");
- for (int i = 0; i < nNameCount; i++)
- {
- tText tNewLabel;
- int nValue = 0;
- tNewLabel.m_szLabel = tPrimary->Attribute("Text");
- tPrimary->Attribute("XOffset", &nValue);
- tNewLabel.m_tTexPos.x = tMenuButton.m_tPos.x + 50 + nValue;
- tPrimary->Attribute("YOffset", &nValue);
- tNewLabel.m_tTexPos.y = ( tMenuButton.m_tPos.y + ( tMenuButton.m_ButtonWidth + tMenuButton.m_fIncrement ) * i ) + nValue;
- tNewLabel.m_fScale = fTempScale;
- tMenuButton.m_tButtonNames.push_back(tNewLabel);
- tPrimary = tPrimary->NextSiblingElement("Name");
- }
- UpdateButton(&tMenuButton);
- tButtonCollection[STATE_MENU] = new tButton(tMenuButton);
- /// Main Menu
- // Options
- tPrimaryScreen = tPrimaryScreen->NextSiblingElement("Screen");
- tButton tOptionsButton;
- szScreen = tPrimaryScreen->Attribute("Title");
- tPrimaryScreen->Attribute("Num", &nNumButtons);
- tOptionsButton.m_szFunction = szScreen;
- tOptionsButton.m_nButtonNum = OPT_CONTROLS;
- tOptionsButton.m_nTotalButtons = nNumButtons;
- tOptionsButton.m_bHidden = false;
- tOptionsButton.m_nParentButton = 0;
- tOptionsButton.m_nCurrentAttached = 0;
- tPrimary = tPrimaryScreen->FirstChildElement("Rect");
- tOptionsButton.m_tClickArea = LoadRECT(tPrimary);
- tPrimary = tPrimary->NextSiblingElement("Pos");
- tPrimary->Attribute("X", &nValue);
- tOptionsButton.m_tPos.x = (float)nValue;
- tPrimary->Attribute("Y", &nValue);
- tOptionsButton.m_tPos.y = (float)nValue;
- tLoad.left = 0;
- tLoad.right = 295;
- tLoad.top = 0;
- tLoad.bottom = 54;
- tPrimary = tPrimary->NextSiblingElement("Other");
- tPrimary->Attribute("Incr", &dValue);
- tOptionsButton.m_fIncrement = (float)dValue;
- tOptionsButton.m_ButtonWidth = static_cast<float>(tOptionsButton.m_tClickArea.bottom - tOptionsButton.m_tClickArea.top);
- tOptionsButton.m_cBackgroundImg.Create(rBGRect, CStateManager::GetInstance()->GetAssetManagerHandle()->tUI[STATE_OPTIONS]->m_tImages[UI_CON], 0.8f);
- tOptionsButton.m_cButtonImg.Create(tLoad, CStateManager::GetInstance()->GetAssetManagerHandle()->tUI[STATE_OPTIONS]->m_tImages[UI_SELECT], 0.7f);
- tPrimary = tPrimary->NextSiblingElement("Label");
- tPrimary->Attribute("Num", &nNameCount);
- tSecondary = tPrimary->FirstChildElement("Name");
- for (int i = 0; i < nNameCount; i++)
- {
- tText tNewLabel;
- int nValue = 0;
- tNewLabel.m_szLabel = tSecondary->Attribute("Text");
- tSecondary->Attribute("XOffset", &nValue);
- tNewLabel.m_tTexPos.x = tOptionsButton.m_tPos.x + 50 + nValue;
- tSecondary->Attribute("YOffset", &nValue);
- tNewLabel.m_tTexPos.y = ( tOptionsButton.m_tPos.y + ( tOptionsButton.m_ButtonWidth + tOptionsButton.m_fIncrement ) * i ) + nValue;
- tNewLabel.m_fScale = fTempScale;
- tOptionsButton.m_tButtonNames.push_back(tNewLabel);
- tSecondary = tSecondary->NextSiblingElement("Name");
- }
- UpdateButton(&tOptionsButton);
- tSecondary = tPrimary->NextSiblingElement("Additional");
- for (int i = 0; i < 8; i++)
- {
- szScreen = tSecondary->Attribute("Title");
- tSecondary->Attribute("Num", &nNumButtons);
- tButton tNewButton;
- tNewButton.m_szFunction = szScreen;
- tNewButton.m_nButtonNum = i;
- if( i < 3 )
- tNewButton.m_nTotalButtons = 1;
- else
- tNewButton.m_nTotalButtons = 1;
- tNewButton.m_bHidden = false;
- if(i < 3)
- tNewButton.m_nParentButton = OPT_AUDIO;
- else
- tNewButton.m_nParentButton = OPT_VIDEO;
- TiXmlElement* Additional = tSecondary->FirstChildElement("Rect");
- tNewButton.m_tClickArea = LoadRECT(Additional);
- int nPos = 0;
- Additional = Additional->NextSiblingElement("Pos");
- Additional->Attribute("X", &nPos);
- tNewButton.m_tPos.x = (float)nPos;
- Additional->Attribute("Y", &nPos);
- tNewButton.m_tPos.y = (float)nPos;
- tNewButton.m_ButtonWidth = static_cast<float>(tNewButton.m_tClickArea.bottom - tNewButton.m_tClickArea.top);
- if(i < 4)
- {
- tSlider tNewS;
- tNewS.bMoving = false;
- Additional = Additional->NextSiblingElement("Slider");
- XMFLOAT2 tLine;
- Additional->Attribute("XOne", &nValue );
- tLine.x = static_cast<float> (nValue);
- Additional->Attribute("XTwo", &nValue );
- tLine.y = static_cast<float> (nValue);
- tNewS.tSBoundry = tLine;
- if( i == AUD_MASTER)
- tNewS.tSPos.x = DeterminePosition(tLine, CStateManager::GetInstance()->GetGameSave()->GetMasterVolume() );
- if( i == AUD_MUSIC)
- tNewS.tSPos.x = DeterminePosition(tLine, CStateManager::GetInstance()->GetGameSave()->GetMusicVolume() );
- if( i == AUD_SFX)
- tNewS.tSPos.x = DeterminePosition(tLine, CStateManager::GetInstance()->GetGameSave()->GetSFXVolume() );
- if( i == VID_GAMMA)
- tNewS.tSPos.x = DeterminePosition(tLine, CStateManager::GetInstance()->GetGammaLevel() );
- Additional->Attribute("Y", &nValue );
- tNewS.tSPos.y = static_cast<float> (nValue);
- tNewButton.m_tPos = tNewS.tSPos;
- m_tSliders[i] = new tSlider(tNewS);
- tLoad.left = 0;
- tLoad.right = 41;
- tLoad.top = 0;
- tLoad.bottom = 41;
- tNewButton.m_cButtonImg.Create(tLoad, CStateManager::GetInstance()->GetAssetManagerHandle()->tUI[STATE_OPTIONS]->m_tImages[UI_MOD], 0.6f);
- }
- else if(i < 6)
- {
- tLoad.left = 0;
- tLoad.right = 103;
- tLoad.top = 0;
- tLoad.bottom = 87;
- tNewButton.m_cButtonImg.Create(tLoad, CStateManager::GetInstance()->GetAssetManagerHandle()->tUI[STATE_OPTIONS]->m_tImages[UI_CIRCLE], 0.6f);
- }
- else if( i < 8 )
- {
- tLoad.left = 0;
- tLoad.right = 21;
- tLoad.top = 0;
- tLoad.bottom = 19;
- if(i == 6)
- tNewButton.m_cButtonImg.Create(tLoad, CStateManager::GetInstance()->GetAssetManagerHandle()->tUI[STATE_OPTIONS]->m_tImages[UI_LEFT], 0.6f);
- else
- tNewButton.m_cButtonImg.Create(tLoad, CStateManager::GetInstance()->GetAssetManagerHandle()->tUI[STATE_OPTIONS]->m_tImages[UI_RIGHT], 0.6f);
- }
- //tSecondary = tSecondary->NextSiblingElement("Label");
- //tSecondary->Attribute("Num", &nNameCount);
- //TiXmlElement = tSecondary->FirstChildElement("Name");
- //tText tNewLabel;
- //int nValue2 = 0;
- //tNewLabel.m_szLabel = tSecondary->Attribute("Text");
- //tSecondary->Attribute("XOffset", &nValue2);
- //tNewLabel.m_tTexPos.x = tNewButton.m_tPos.x + 50 + nValue2;
- //tSecondary->Attribute("YOffset", &nValue2);
- //tNewLabel.m_tTexPos.y = tNewButton.m_tPos.y - nValue2;
- //tNewLabel.m_fScale = fTempScale;
- //tNewButton.m_tButtonNames.push_back(tNewLabel);
- UpdateButton(&tNewButton);
- tOptionsButton.m_tAttachedButtons[i] = new tButton(tNewButton);
- tSecondary = tSecondary->NextSiblingElement("Additional");
- }
- tButtonCollection[STATE_OPTIONS] = new tButton(tOptionsButton);
- /// Options
- // Game Select
- tPrimaryScreen = tPrimaryScreen->NextSiblingElement("Screen");
- tButton tGameSelectButton;
- szScreen = tPrimaryScreen->Attribute("Title");
- tPrimaryScreen->Attribute("Num", &nNumButtons);
- tGameSelectButton.m_szFunction = szScreen;
- tGameSelectButton.m_nButtonNum = GS_SOLO;
- tGameSelectButton.m_nTotalButtons = nNumButtons;
- tGameSelectButton.m_bHidden = false;
- tGameSelectButton.m_nParentButton = 0;
- tPrimary = tPrimaryScreen->FirstChildElement("Rect");
- tGameSelectButton.m_tClickArea = LoadRECT(tPrimary);
- tPrimary = tPrimary->NextSiblingElement("Pos");
- tPrimary->Attribute("X", &nValue);
- tGameSelectButton.m_tPos.x = (float)nValue;
- tPrimary->Attribute("Y", &nValue);
- tGameSelectButton.m_tPos.y = (float)nValue;
- tLoad.left = 0;
- tLoad.right = 295;
- tLoad.top = 0;
- tLoad.bottom = 54;
- tPrimary = tPrimary->NextSiblingElement("Other");
- tPrimary->Attribute("Incr", &dValue);
- tGameSelectButton.m_fIncrement = (float)dValue;
- tGameSelectButton.m_ButtonWidth = static_cast<float>(tGameSelectButton.m_tClickArea.bottom - tGameSelectButton.m_tClickArea.top);
- tGameSelectButton.m_cBackgroundImg.Create(rBGRect, CStateManager::GetInstance()->GetAssetManagerHandle()->tUI[STATE_GAME_SELECT]->m_tImages[UI_BG], 0.8f);
- tGameSelectButton.m_cButtonImg.Create(tLoad, CStateManager::GetInstance()->GetAssetManagerHandle()->tUI[STATE_GAME_SELECT]->m_tImages[UI_SELECT], 0.7f);
- tPrimary = tPrimary->NextSiblingElement("Label");
- tPrimary->Attribute("Num", &nNameCount);
- tPrimary = tPrimary->FirstChildElement("Name");
- for (int i = 0; i < nNameCount; i++)
- {
- tText tNewLabel;
- int nValue = 0;
- tNewLabel.m_szLabel = tPrimary->Attribute("Text");
- tPrimary->Attribute("XOffset", &nValue);
- tNewLabel.m_tTexPos.x = tGameSelectButton.m_tPos.x + 50 + nValue;
- tPrimary->Attribute("YOffset", &nValue);
- tNewLabel.m_tTexPos.y = ( tGameSelectButton.m_tPos.y + ( tGameSelectButton.m_ButtonWidth + tGameSelectButton.m_fIncrement ) * i ) + nValue;
- tNewLabel.m_fScale = fTempScale;
- tGameSelectButton.m_tButtonNames.push_back(tNewLabel);
- tPrimary = tPrimary->NextSiblingElement("Name");
- }
- UpdateButton(&tGameSelectButton);
- tButtonCollection[STATE_GAME_SELECT] = new tButton(tGameSelectButton);
- /// Game Select
- // Level Select
- tPrimaryScreen = tPrimaryScreen->NextSiblingElement("Screen");
- tButton tLevelSelectButton;
- szScreen = tPrimaryScreen->Attribute("Title");
- tPrimaryScreen->Attribute("Num", &nNumButtons);
- tLevelSelectButton.m_szFunction = szScreen;
- tLevelSelectButton.m_nButtonNum = LS_PLAY;
- tLevelSelectButton.m_nTotalButtons = nNumButtons;
- tLevelSelectButton.m_bHidden = false;
- tLevelSelectButton.m_nParentButton = 0;
- tLevelSelectButton.m_nCurrentAttached = LS_ONE;
- tPrimary = tPrimaryScreen->FirstChildElement("Rect");
- tLevelSelectButton.m_tClickArea = LoadRECT(tPrimary);
- tPrimary = tPrimary->NextSiblingElement("Pos");
- tPrimary->Attribute("X", &nValue);
- tLevelSelectButton.m_tPos.x = (float)nValue;
- tPrimary->Attribute("Y", &nValue);
- tLevelSelectButton.m_tPos.y = (float)nValue;
- tLoad.left = 0;
- tLoad.right = 295;
- tLoad.top = 0;
- tLoad.bottom = 54;
- tPrimary = tPrimary->NextSiblingElement("Other");
- tPrimary->Attribute("Incr", &dValue);
- tLevelSelectButton.m_fIncrement = (float)dValue;
- tLevelSelectButton.m_ButtonWidth = static_cast<float>(tLevelSelectButton.m_tClickArea.bottom - tLevelSelectButton.m_tClickArea.top);
- tLevelSelectButton.m_cBackgroundImg.Create(rBGRect, CStateManager::GetInstance()->GetAssetManagerHandle()->tUI[STATE_LEVEL_SELECT]->m_tImages[UI_BG], 0.8f);
- tLevelSelectButton.m_cButtonImg.Create(tLoad, CStateManager::GetInstance()->GetAssetManagerHandle()->tUI[STATE_LEVEL_SELECT]->m_tImages[UI_SELECT], 0.7f);
- tPrimary = tPrimary->NextSiblingElement("Label");
- tPrimary->Attribute("Num", &nNameCount);
- tSecondary = tPrimary->FirstChildElement("Name");
- for (int i = 0; i < nNameCount; i++)
- {
- tText tNewLabel;
- int nValue = 0;
- tNewLabel.m_szLabel = tSecondary->Attribute("Text");
- tSecondary->Attribute("XOffset", &nValue);
- tNewLabel.m_tTexPos.x = tLevelSelectButton.m_tPos.x + 50 + nValue;
- tSecondary->Attribute("YOffset", &nValue);
- tNewLabel.m_tTexPos.y = ( tLevelSelectButton.m_tPos.y + ( tLevelSelectButton.m_ButtonWidth + tLevelSelectButton.m_fIncrement ) * i ) + nValue;
- tNewLabel.m_fScale = fTempScale;
- tLevelSelectButton.m_tButtonNames.push_back(tNewLabel);
- tSecondary = tSecondary->NextSiblingElement("Name");
- }
- UpdateButton(&tLevelSelectButton);
- tSecondary = tPrimary->NextSiblingElement("Additional");
- for (int i = 0; i < 3; i++)
- {
- szScreen = tSecondary->Attribute("Title");
- tSecondary->Attribute("Num", &nNumButtons);
- tButton tNewButton;
- tNewButton.m_szFunction = szScreen;
- tNewButton.m_nButtonNum = i;
- tNewButton.m_nTotalButtons = 1;
- if(i == 0)
- tNewButton.m_bHidden = false;
- else
- tNewButton.m_bHidden = true;
- tNewButton.m_nParentButton = LS_PLAY;
- TiXmlElement* Additional = tSecondary->FirstChildElement("Rect");
- tNewButton.m_tClickArea = LoadRECT(Additional);
- int nPos = 0;
- Additional = Additional->NextSiblingElement("Pos");
- Additional->Attribute("X", &nPos);
- tNewButton.m_tPos.x = (float)nPos;
- Additional->Attribute("Y", &nPos);
- tNewButton.m_tPos.y = (float)nPos;
- tLoad.left = 0;
- tLoad.right = 534;
- tLoad.top = 0;
- tLoad.bottom = 330;
- tNewButton.m_ButtonWidth = static_cast<float>(tNewButton.m_tClickArea.bottom - tNewButton.m_tClickArea.top);
- tNewButton.m_cButtonImg.Create(tLoad, CStateManager::GetInstance()->GetAssetManagerHandle()->tUI[STATE_LEVEL_SELECT]->m_tImages[UI_LSELECT], 0.6f);
- //tSecondary = tSecondary->NextSiblingElement("Label");
- //tSecondary->Attribute("Num", &nNameCount);
- //TiXmlElement = tSecondary->FirstChildElement("Name");
- //tText tNewLabel;
- //int nValue2 = 0;
- //tNewLabel.m_szLabel = tSecondary->Attribute("Text");
- //tSecondary->Attribute("XOffset", &nValue2);
- //tNewLabel.m_tTexPos.x = tNewButton.m_tPos.x + 50 + nValue2;
- //tSecondary->Attribute("YOffset", &nValue2);
- //tNewLabel.m_tTexPos.y = tNewButton.m_tPos.y - nValue2;
- //tNewLabel.m_fScale = fTempScale;
- //tNewButton.m_tButtonNames.push_back(tNewLabel);
- UpdateButton(&tNewButton);
- tLevelSelectButton.m_tAttachedButtons[i] = new tButton(tNewButton);
- tSecondary = tSecondary->NextSiblingElement("Additional");
- }
- tButtonCollection[STATE_LEVEL_SELECT] = new tButton(tLevelSelectButton);
- /// Level Select
- // Pause
- tPrimaryScreen = tPrimaryScreen->NextSiblingElement("Screen");
- tButton tPauseButton;
- szScreen = tPrimaryScreen->Attribute("Title");
- tPrimaryScreen->Attribute("Num", &nNumButtons);
- tPauseButton.m_szFunction = szScreen;
- tPauseButton.m_nButtonNum = PAUSE_RESUME;
- tPauseButton.m_nTotalButtons = nNumButtons;
- tPauseButton.m_bHidden = false;
- tPauseButton.m_nParentButton = 0;
- tPrimary = tPrimaryScreen->FirstChildElement("Rect");
- tPauseButton.m_tClickArea = LoadRECT(tPrimary);
- tPrimary = tPrimary->NextSiblingElement("Pos");
- tPrimary->Attribute("X", &nValue);
- tPauseButton.m_tPos.x = (float)nValue;
- tPrimary->Attribute("Y", &nValue);
- tPauseButton.m_tPos.y = (float)nValue;
- tLoad.left = 0;
- tLoad.right = 295;
- tLoad.top = 0;
- tLoad.bottom = 54;
- tPrimary = tPrimary->NextSiblingElement("Other");
- tPrimary->Attribute("Incr", &dValue);
- tPauseButton.m_fIncrement = (float)dValue;
- tPauseButton.m_ButtonWidth = static_cast<float>(tPauseButton.m_tClickArea.bottom - tPauseButton.m_tClickArea.top);
- tPauseButton.m_cBackgroundImg.Create(rBGRect, CStateManager::GetInstance()->GetAssetManagerHandle()->tUI[STATE_PAUSE]->m_tImages[UI_BG], 0.8f);
- tPauseButton.m_cButtonImg.Create(tLoad, CStateManager::GetInstance()->GetAssetManagerHandle()->tUI[STATE_PAUSE]->m_tImages[UI_SELECT], 0.7f);
- tPrimary = tPrimary->NextSiblingElement("Label");
- tPrimary->Attribute("Num", &nNameCount);
- tPrimary = tPrimary->FirstChildElement("Name");
- for (int i = 0; i < nNameCount; i++)
- {
- tText tNewLabel;
- int nValue = 0;
- tNewLabel.m_szLabel = tPrimary->Attribute("Text");
- tPrimary->Attribute("XOffset", &nValue);
- tNewLabel.m_tTexPos.x = tPauseButton.m_tPos.x + 50 + nValue;
- tPrimary->Attribute("YOffset", &nValue);
- tNewLabel.m_tTexPos.y = ( tPauseButton.m_tPos.y + ( tPauseButton.m_ButtonWidth + tPauseButton.m_fIncrement ) * i ) + nValue;
- tNewLabel.m_fScale = fTempScale;
- tPauseButton.m_tButtonNames.push_back(tNewLabel);
- tPrimary = tPrimary->NextSiblingElement("Name");
- }
- UpdateButton(&tPauseButton);
- tButtonCollection[STATE_PAUSE] = new tButton(tPauseButton);
- /// Pause
- // HUD - Solo
- tPrimaryScreen = tPrimaryScreen->NextSiblingElement("Screen");
- tButton tSoloButton;
- szScreen = tPrimaryScreen->Attribute("Title");
- tPrimaryScreen->Attribute("Num", &nNumButtons);
- tSoloButton.m_szFunction = szScreen;
- tSoloButton.m_nTotalButtons = 9;
- tPrimary = tPrimaryScreen->FirstChildElement("Additional");
- for (int i = 0; i < nNumButtons; i++)
- {
- tButton tNewButton;
- tSecondary = tPrimary->FirstChildElement("Rect");
- tNewButton.m_tClickArea = LoadRECT(tSecondary);
- tSecondary = tSecondary->NextSiblingElement("Pos");
- int nPos = 0;
- tSecondary->Attribute("X", &nPos);
- tNewButton.m_tPos.x = (float)nPos;
- tSecondary->Attribute("Y", &nPos);
- tNewButton.m_tPos.y = (float)nPos;
- tNewButton.m_ButtonWidth = static_cast<float>(tNewButton.m_tClickArea.bottom - tNewButton.m_tClickArea.top);
- if( i < 2 )
- {
- if(i == 0)
- {
- tLoad.left = 0;
- tLoad.right = 355;
- tLoad.top = 0;
- tLoad.bottom = 26;
- }
- else
- {
- tLoad.left = 0;
- tLoad.right = 343;
- tLoad.top = 0;
- tLoad.bottom = 14;
- }
- tNewButton.m_ButtonWidth = static_cast<float>(tNewButton.m_tClickArea.right - tNewButton.m_tClickArea.left);
- tNewButton.m_cButtonImg.Create(tLoad, CStateManager::GetInstance()->GetAssetManagerHandle()->tUI[STATE_GAMEPLAY]->m_tImages[UI_HEALTH_BAR + (i)], 0.8f);
- }
- else if(i < 5)
- {
- tLoad.left = 0;
- tLoad.right = 64;
- tLoad.top = 0;
- tLoad.bottom = 64;
- tNewButton.m_bHidden = true;
- tNewButton.m_cButtonImg.Create(tLoad, CStateManager::GetInstance()->GetAssetManagerHandle()->tUI[STATE_GAMEPLAY]->m_tImages[UI_FIRE], 0.8f);
- }
- else if(i == 5)
- {
- tLoad.left = 0;
- tLoad.right = 99;
- tLoad.top = 0;
- tLoad.bottom = 99;
- tNewButton.m_cButtonImg.Create(tLoad, CStateManager::GetInstance()->GetAssetManagerHandle()->tUI[STATE_GAMEPLAY]->m_tImages[UI_ACTIVE_SLOT], 0.9f);
- }
- else if( i < 8 )
- {
- tLoad.left = 0;
- tLoad.right = 99;
- tLoad.top = 0;
- tLoad.bottom = 99;
- tNewButton.m_cButtonImg.Create(tLoad, CStateManager::GetInstance()->GetAssetManagerHandle()->tUI[STATE_GAMEPLAY]->m_tImages[UI_INACTIVE_SLOT], 0.9f);
- }
- else if(i == 8)
- {
- tLoad.left = 0;
- tLoad.right = 411;
- tLoad.top = 0;
- tLoad.bottom = 90;
- tNewButton.m_cButtonImg.Create(tLoad, CStateManager::GetInstance()->GetAssetManagerHandle()->tUI[STATE_GAMEPLAY]->m_tImages[UI_HS_CASE], 0.9f);
- }
- UpdateButton(&tNewButton);
- tSoloButton.m_tAttachedButtons[i] = new tButton(tNewButton);
- tPrimary = tPrimary->NextSiblingElement("Additional");
- }
- tButtonCollection[STATE_SOLO] = new tButton(tSoloButton);
- /// HUD
- // HUD - Multi
- tPrimaryScreen = tPrimaryScreen->NextSiblingElement("Screen");
- tButton tMultiButton;
- szScreen = tPrimaryScreen->Attribute("Title");
- tPrimaryScreen->Attribute("Num", &nNumButtons);
- tMultiButton.m_szFunction = szScreen;
- tMultiButton.m_nTotalButtons = 9;
- tPrimary = tPrimaryScreen->FirstChildElement("Additional");
- for (int i = 0; i < nNumButtons; i++)
- {
- tButton tNewButton;
- tSecondary = tPrimary->FirstChildElement("Rect");
- tNewButton.m_tClickArea = LoadRECT(tSecondary);
- tSecondary = tSecondary->NextSiblingElement("Pos");
- int nPos = 0;
- tSecondary->Attribute("X", &nPos);
- tNewButton.m_tPos.x = (float)nPos;
- tSecondary->Attribute("Y", &nPos);
- tNewButton.m_tPos.y = (float)nPos;
- tNewButton.m_ButtonWidth = static_cast<float>(tNewButton.m_tClickArea.bottom - tNewButton.m_tClickArea.top);
- if( i < 2 )
- {
- if(i == 0)
- {
- tLoad.left = 0;
- tLoad.right = 355;
- tLoad.top = 0;
- tLoad.bottom = 26;
- }
- else
- {
- tLoad.left = 0;
- tLoad.right = 343;
- tLoad.top = 0;
- tLoad.bottom = 14;
- }
- tNewButton.m_ButtonWidth = static_cast<float>(tNewButton.m_tClickArea.right - tNewButton.m_tClickArea.left);
- tNewButton.m_cButtonImg.Create(tLoad, CStateManager::GetInstance()->GetAssetManagerHandle()->tUI[STATE_GAMEPLAY]->m_tImages[UI_HEALTH_BAR + (i)], 0.8f);
- }
- else if(i < 5)
- {
- tLoad.left = 0;
- tLoad.right = 64;
- tLoad.top = 0;
- tLoad.bottom = 64;
- tNewButton.m_bHidden = true;
- tNewButton.m_cButtonImg.Create(tLoad, CStateManager::GetInstance()->GetAssetManagerHandle()->tUI[STATE_GAMEPLAY]->m_tImages[UI_FIRE], 0.8f);
- }
- else if(i == 5)
- {
- tLoad.left = 0;
- tLoad.right = 99;
- tLoad.top = 0;
- tLoad.bottom = 99;
- tNewButton.m_cButtonImg.Create(tLoad, CStateManager::GetInstance()->GetAssetManagerHandle()->tUI[STATE_GAMEPLAY]->m_tImages[UI_ACTIVE_SLOT], 0.9f);
- }
- else if( i < 8 )
- {
- tLoad.left = 0;
- tLoad.right = 99;
- tLoad.top = 0;
- tLoad.bottom = 99;
- tNewButton.m_cButtonImg.Create(tLoad, CStateManager::GetInstance()->GetAssetManagerHandle()->tUI[STATE_GAMEPLAY]->m_tImages[UI_INACTIVE_SLOT], 0.9f);
- }
- else if(i == 8)
- {
- tLoad.left = 0;
- tLoad.right = 411;
- tLoad.top = 0;
- tLoad.bottom = 90;
- tNewButton.m_cButtonImg.Create(tLoad, CStateManager::GetInstance()->GetAssetManagerHandle()->tUI[STATE_GAMEPLAY]->m_tImages[UI_HS_CASE], 0.9f);
- }
- UpdateButton(&tNewButton);
- tMultiButton.m_tAttachedButtons[i] = new tButton(tNewButton);
- tPrimary = tPrimary->NextSiblingElement("Additional");
- }
- tButtonCollection[STATE_MULTI] = new tButton(tMultiButton);
- /// HUD
- // Lose
- tButton tLoseButton;
- tPrimaryScreen = tPrimaryScreen->NextSiblingElement("Screen");
- szScreen = tPrimaryScreen->Attribute("Title");
- tPrimaryScreen->Attribute("Num", &nNumButtons);
- tLoseButton.m_szFunction = szScreen;
- tLoseButton.m_nButtonNum = GOL_RESPAWN;
- tLoseButton.m_nTotalButtons = nNumButtons;
- tLoseButton.m_bHidden = false;
- tLoseButton.m_nParentButton = 0;
- tPrimary = tPrimaryScreen->FirstChildElement("Rect");
- tLoseButton.m_tClickArea = LoadRECT(tPrimary);
- tPrimary = tPrimary->NextSiblingElement("Pos");
- tPrimary->Attribute("X", &nValue);
- tLoseButton.m_tPos.x = (float)nValue;
- tPrimary->Attribute("Y", &nValue);
- tLoseButton.m_tPos.y = (float)nValue;
- tLoad.left = 0;
- tLoad.right = 295;
- tLoad.top = 0;
- tLoad.bottom = 54;
- tPrimary = tPrimary->NextSiblingElement("Other");
- tPrimary->Attribute("Incr", &dValue);
- tLoseButton.m_fIncrement = (float)dValue;
- tLoseButton.m_ButtonWidth = static_cast<float>(tLoseButton.m_tClickArea.bottom - tLoseButton.m_tClickArea.top);
- tLoseButton.m_cBackgroundImg.Create(rBGRect, CStateManager::GetInstance()->GetAssetManagerHandle()->tUI[STATE_GAMEOVER_LOSE]->m_tImages[UI_BG], 0.8f);
- tLoseButton.m_cButtonImg.Create(tLoad, CStateManager::GetInstance()->GetAssetManagerHandle()->tUI[STATE_GAMEOVER_LOSE]->m_tImages[UI_SELECT], 0.7f);
- tPrimary = tPrimary->NextSiblingElement("Label");
- tPrimary->Attribute("Num", &nNameCount);
- tPrimary = tPrimary->FirstChildElement("Name");
- for (int i = 0; i < nNameCount; i++)
- {
- tText tNewLabel;
- int nValue = 0;
- tNewLabel.m_szLabel = tPrimary->Attribute("Text");
- tPrimary->Attribute("XOffset", &nValue);
- tNewLabel.m_tTexPos.x = tLoseButton.m_tPos.x + 50 + nValue;
- tPrimary->Attribute("YOffset", &nValue);
- tNewLabel.m_tTexPos.y = ( tLoseButton.m_tPos.y + ( tLoseButton.m_ButtonWidth + tLoseButton.m_fIncrement ) * i ) + nValue;
- tNewLabel.m_fScale = fTempScale;
- tLoseButton.m_tButtonNames.push_back(tNewLabel);
- tPrimary = tPrimary->NextSiblingElement("Name");
- }
- UpdateButton(&tLoseButton);
- tButtonCollection[STATE_GAMEOVER_LOSE] = new tButton(tLoseButton);
- /// Lose
- // Win
- tButton tWinButton;
- tPrimaryScreen = tPrimaryScreen->NextSiblingElement("Screen");
- szScreen = tPrimaryScreen->Attribute("Title");
- tPrimaryScreen->Attribute("Num", &nNumButtons);
- tWinButton.m_szFunction = szScreen;
- tWinButton.m_nButtonNum = GOW_CONTINUE;
- tWinButton.m_nTotalButtons = nNumButtons;
- tWinButton.m_bHidden = false;
- tWinButton.m_nParentButton = 0;
- tPrimary = tPrimaryScreen->FirstChildElement("Rect");
- tWinButton.m_tClickArea = LoadRECT(tPrimary);
- tPrimary = tPrimary->NextSiblingElement("Pos");
- tPrimary->Attribute("X", &nValue);
- tWinButton.m_tPos.x = (float)nValue;
- tPrimary->Attribute("Y", &nValue);
- tWinButton.m_tPos.y = (float)nValue;
- tLoad.left = 0;
- tLoad.right = 295;
- tLoad.top = 0;
- tLoad.bottom = 54;
- tPrimary = tPrimary->NextSiblingElement("Other");
- tPrimary->Attribute("Incr", &dValue);
- tWinButton.m_fIncrement = (float)dValue;
- tWinButton.m_ButtonWidth = static_cast<float>(tWinButton.m_tClickArea.bottom - tWinButton.m_tClickArea.top);
- tWinButton.m_cBackgroundImg.Create(rBGRect, CStateManager::GetInstance()->GetAssetManagerHandle()->tUI[STATE_LEVEL_COMPLETE]->m_tImages[UI_BG], 0.8f);
- tWinButton.m_cButtonImg.Create(tLoad, CStateManager::GetInstance()->GetAssetManagerHandle()->tUI[STATE_LEVEL_COMPLETE]->m_tImages[UI_SELECT], 0.7f);
- tPrimary = tPrimary->NextSiblingElement("Label");
- tPrimary->Attribute("Num", &nNameCount);
- tPrimary = tPrimary->FirstChildElement("Name");
- for (int i = 0; i < nNameCount; i++)
- {
- tText tNewLabel;
- int nValue = 0;
- tNewLabel.m_szLabel = tPrimary->Attribute("Text");
- tPrimary->Attribute("XOffset", &nValue);
- tNewLabel.m_tTexPos.x = tWinButton.m_tPos.x + 50 + nValue;
- tPrimary->Attribute("YOffset", &nValue);
- tNewLabel.m_tTexPos.y = ( tWinButton.m_tPos.y + ( tWinButton.m_ButtonWidth + tWinButton.m_fIncrement ) * i ) + nValue;
- tNewLabel.m_fScale = fTempScale;
- tWinButton.m_tButtonNames.push_back(tNewLabel);
- tPrimary = tPrimary->NextSiblingElement("Name");
- }
- UpdateButton(&tWinButton);
- tButtonCollection[STATE_LEVEL_COMPLETE] = new tButton(tWinButton);
- /// Win
- // Make this resolution-adjusted
- RECT rLoadingIcon = { 5, (int)(CStateManager::GetInstance()->GetWindowHeight()-170), 160, (int)(CStateManager::GetInstance()->GetWindowHeight()-15) };
- m_cLoadingIcon.Create(rLoadingIcon, CStateManager::GetInstance()->GetAssetManagerHandle()->tTextures["Sigil_Y.dds"]->tTexture, 0.2f);
- m_cLoadingIcon.SetColor(XMFLOAT4(1.0f, 1.0f, 0.4f, 1.0f));
- return true;
- }
- void CUIManager::Update( float fElapsedTime )
- {
- CGameplayState* pGPState = (CGameplayState*)(CStateManager::GetInstance()->GetGameplayStateHandle());
- if(!CStateManager::GetInstance()->IsDoneLoading())
- {
- m_cLoadingIcon.SetRotation(m_cLoadingIcon.GetRotation() - fElapsedTime);
- }
- else if(CStateManager::GetInstance()->IsDoneLoading() && m_cLoadingIcon.GetScale().x > 0.0f)
- {
- m_cLoadingIcon.SetRotation(m_cLoadingIcon.GetRotation() - fElapsedTime);
- m_cLoadingIcon.SetScale(XMFLOAT2(m_cLoadingIcon.GetScale().x - fElapsedTime/2.25f, m_cLoadingIcon.GetScale().y - fElapsedTime/2.25f));
- XMFLOAT3 vPos = m_cLoadingIcon.GetPosition();
- m_cLoadingIcon.SetPosition(XMFLOAT3(vPos.x + fElapsedTime/2.5f, vPos.y + fElapsedTime/1.75f, vPos.z));
- }
- if(m_tCurrentButton->m_nTotalButtons == 0)
- return;
- switch(eCurrentState)
- {
- case STATE_GAMEPLAY:
- {
- GameplayUpdate();
- }
- break;
- case STATE_OPTIONS:
- {
- if(m_cInput->GetKeyPressed(VK_DOWN) || m_cInput->GetKeyPressed('S') || m_cInput->GamepadPressed(GAMEPAD_DPAD_DOWN))
- {
- if(m_tCurrentButton->m_nButtonNum != m_tCurrentButton->m_nTotalButtons - 1)
- {
- CStateManager::GetInstance()->m_cAudioManager.PostEvent(AK::EVENTS::PLAY_HA_SFX_MENUNAVIGATE);
- int nNum = m_tCurrentButton->m_nButtonNum;
- m_tCurrentButton->m_nButtonNum++;
- UpdateButton(nNum);
- if(m_tCurrentButton->m_nButtonNum == LS_PLAY)
- {
- m_tCurrentButton->m_tAttachedButtons[LS_ONE]->m_bHidden = false;
- m_tCurrentButton->m_nCurrentAttached = LS_ONE;
- }
- }
- }
- else if(m_cInput->GetKeyPressed(VK_UP) || m_cInput->GetKeyPressed('W') || m_cInput->GamepadPressed(GAMEPAD_DPAD_UP))
- {
- if(m_tCurrentButton->m_nButtonNum != 0)
- {
- CStateManager::GetInstance()->m_cAudioManager.PostEvent(AK::EVENTS::PLAY_HA_SFX_MENUNAVIGATE);
- int nNum = m_tCurrentButton->m_nButtonNum;
- m_tCurrentButton->m_nButtonNum--;
- UpdateButton(nNum);
- if(m_tCurrentButton->m_nButtonNum == LS_PLAY)
- {
- m_tCurrentButton->m_tAttachedButtons[LS_ONE]->m_bHidden = false;
- m_tCurrentButton->m_nCurrentAttached = LS_ONE;
- }
- }
- }
- int nButton = MouseIntersect(m_tCurrentButton, true);
- if( nButton != -1)
- {
- int nNum = m_tCurrentButton->m_nButtonNum;
- m_tCurrentButton->m_nButtonNum = nButton;
- UpdateButton(nNum);
- }
- else if( m_tCurrentButton->m_nButtonNum == OPT_AUDIO )
- {
- bool bCheck = false;
- if(m_cInput->GetLButtonDown())
- {
- for (unsigned int i = 0; i < m_tSliders.size() - 1; i++)
- {
- for (unsigned int j = 0; j < m_tSliders.size() - 1; j++)
- {
- if(m_tSliders[j]->bMoving == true)
- {
- bCheck = true;
- break;
- }
- }
- if(!bCheck)
- {
- if(MouseIntersect(true, m_tCurrentButton->m_tAttachedButtons[i]) && m_tSliders[i]->bMoving == false)
- {
- m_tSliders[i]->bMoving = true;
- bCheck = true;
- }
- }
- }
- }
- else
- {
- for (unsigned int i = 0; i < m_tSliders.size() - 1; i++)
- {
- m_tSliders[i]->bMoving = false;
- }
- }
- //
- for (unsigned int i = 0; i < m_tSliders.size() - 1; i++)
- {
- if(m_tSliders[i]->bMoving)
- {
- POINT tMouse_Pos = m_cInput->GetCursorPos();
- int nVolumeChange = 0;
- if(tMouse_Pos.x > m_tCurrentButton->m_tAttachedButtons[i]->m_tPos.x && tMouse_Pos.x <= m_tSliders[i]->tSBoundry.y)
- {
- m_tCurrentButton->m_tAttachedButtons[i]->m_tPos.x += tMouse_Pos.x - m_tCurrentButton->m_tAttachedButtons[i]->m_tPos.x;
- nVolumeChange = DetermineVolume( m_tCurrentButton->m_tAttachedButtons[i]->m_tPos.x - m_tSliders[i]->tSBoundry.x, m_tSliders[i]->tSBoundry.y - m_tSliders[i]->tSBoundry.x);
- nVolumeChange = nVolumeChange;
- }
- else if( tMouse_Pos.x < m_tCurrentButton->m_tAttachedButtons[i]->m_tPos.x && tMouse_Pos.x >= m_tSliders[i]->tSBoundry.x)
- {
- m_tCurrentButton->m_tAttachedButtons[i]->m_tPos.x -= m_tCurrentButton->m_tAttachedButtons[i]->m_tPos.x - tMouse_Pos.x;
- nVolumeChange = DetermineVolume( m_tCurrentButton->m_tAttachedButtons[i]->m_tPos.x - m_tSliders[i]->tSBoundry.x, m_tSliders[i]->tSBoundry.y - m_tSliders[i]->tSBoundry.x);
- if( i == AUD_MASTER)
- nVolumeChange = nVolumeChange - CStateManager::GetInstance()->GetGameSave()->GetMasterVolume();
- if( i == AUD_MUSIC)
- nVolumeChange = nVolumeChange - CStateManager::GetInstance()->GetGameSave()->GetMusicVolume();
- if( i == AUD_SFX)
- nVolumeChange = nVolumeChange - CStateManager::GetInstance()->GetGameSave()->GetSFXVolume();
- }
- if( i == AUD_MASTER)
- CStateManager::GetInstance()->AlterMASTERVolume((float)nVolumeChange);
- if( i == AUD_MUSIC)
- CStateManager::GetInstance()->AlterMUSICVolume((float)nVolumeChange);
- if( i == AUD_SFX)
- CStateManager::GetInstance()->AlterSFXVolume((float)nVolumeChange);
- UpdateButton(m_tCurrentButton->m_tAttachedButtons[i]);
- }
- }
- }
- };
- break;
- case STATE_LEVEL_SELECT:
- {
- if(m_cInput->GetKeyPressed(VK_DOWN) || m_cInput->GetKeyPressed('S') || m_cInput->GamepadPressed(GAMEPAD_DPAD_DOWN))
- {
- if(m_tCurrentButton->m_nButtonNum != m_tCurrentButton->m_nTotalButtons - 1)
- {
- CStateManager::GetInstance()->m_cAudioManager.PostEvent(AK::EVENTS::PLAY_HA_SFX_MENUNAVIGATE);
- int nNum = m_tCurrentButton->m_nButtonNum;
- m_tCurrentButton->m_nButtonNum++;
- UpdateButton(nNum);
- if(m_tCurrentButton->m_nButtonNum == LS_PLAY)
- {
- m_tCurrentButton->m_tAttachedButtons[LS_ONE]->m_bHidden = false;
- m_tCurrentButton->m_nCurrentAttached = LS_ONE;
- }
- }
- }
- else if(m_cInput->GetKeyPressed(VK_UP) || m_cInput->GetKeyPressed('W') || m_cInput->GamepadPressed(GAMEPAD_DPAD_UP))
- {
- if(m_tCurrentButton->m_nButtonNum != 0)
- {
- CStateManager::GetInstance()->m_cAudioManager.PostEvent(AK::EVENTS::PLAY_HA_SFX_MENUNAVIGATE);
- int nNum = m_tCurrentButton->m_nButtonNum;
- m_tCurrentButton->m_nButtonNum--;
- UpdateButton(nNum);
- if(m_tCurrentButton->m_nButtonNum == LS_PLAY)
- {
- m_tCurrentButton->m_tAttachedButtons[LS_ONE]->m_bHidden = false;
- m_tCurrentButton->m_nCurrentAttached = LS_ONE;
- }
- }
- }
- if(m_tCurrentButton->m_nButtonNum == LS_PLAY)
- {
- if(m_cInput->GetKeyPressed(VK_RIGHT) || m_cInput->GetKeyPressed('D') || m_cInput->GamepadPressed(GAMEPAD_DPAD_RIGHT))
- {
- CStateManager::GetInstance()->m_cAudioManager.PostEvent(AK::EVENTS::PLAY_HA_SFX_MENUNAVIGATE);
- m_tCurrentButton->m_tAttachedButtons[m_tCurrentButton->m_nCurrentAttached]->m_bHidden = true;
- m_tCurrentButton->m_nCurrentAttached++;
- if(m_tCurrentButton->m_nCurrentAttached > 2)
- m_tCurrentButton->m_nCurrentAttached = 0;
- m_tCurrentButton->m_tAttachedButtons[m_tCurrentButton->m_nCurrentAttached]->m_bHidden = false;
- }
- else if(m_cInput->GetKeyPressed(VK_LEFT) || m_cInput->GetKeyPressed('A') || m_cInput->GamepadPressed(GAMEPAD_DPAD_LEFT))
- {
- CStateManager::GetInstance()->m_cAudioManager.PostEvent(AK::EVENTS::PLAY_HA_SFX_MENUNAVIGATE);
- m_tCurrentButton->m_tAttachedButtons[m_tCurrentButton->m_nCurrentAttached]->m_bHidden = true;
- m_tCurrentButton->m_nCurrentAttached--;
- if(m_tCurrentButton->m_nCurrentAttached < 0)
- m_tCurrentButton->m_nCurrentAttached = 2;
- m_tCurrentButton->m_tAttachedButtons[m_tCurrentButton->m_nCurrentAttached]->m_bHidden = false;
- }
- }
- else
- {
- for (unsigned int i = 0; i < m_tCurrentButton->m_tAttachedButtons.size(); i++)
- {
- m_tCurrentButton->m_tAttachedButtons[i]->m_bHidden = true;
- }
- }
- int nButton = MouseIntersect(m_tCurrentButton, true);
- if( nButton != -1)
- {
- int nNum = m_tCurrentButton->m_nButtonNum;
- m_tCurrentButton->m_nButtonNum = nButton;
- if(nButton == 0)
- {
- m_tCurrentButton->m_tAttachedButtons[m_tCurrentButton->m_nCurrentAttached]->m_bHidden = false;
- }
- UpdateButton(nNum);
- }
- if(MouseIntersect(m_tCurrentButton->m_tAttachedButtons[LS_ONE], false))
- {
- m_tCurrentButton->m_tAttachedButtons[LS_ONE]->m_bHidden = false;
- m_tCurrentButton->m_nCurrentAttached = LS_ONE;
- m_tCurrentButton->m_nButtonNum = LS_PLAY;
- }
- else if(MouseIntersect(m_tCurrentButton->m_tAttachedButtons[LS_TWO], false))
- {
- m_tCurrentButton->m_tAttachedButtons[LS_TWO]->m_bHidden = false;
- m_tCurrentButton->m_nCurrentAttached = LS_TWO;
- m_tCurrentButton->m_nButtonNum = LS_PLAY;
- }
- else if(MouseIntersect(m_tCurrentButton->m_tAttachedButtons[LS_THREE], false))
- {
- m_tCurrentButton->m_tAttachedButtons[LS_THREE]->m_bHidden = false;
- m_tCurrentButton->m_nCurrentAttached = LS_THREE;
- m_tCurrentButton->m_nButtonNum = LS_PLAY;
- }
- };
- break;
- default:
- {
- if(m_cInput->GetKeyPressed(VK_DOWN) || m_cInput->GetKeyPressed('S') || m_cInput->GamepadPressed(GAMEPAD_DPAD_DOWN))
- {
- if(m_tCurrentButton->m_nButtonNum != m_tCurrentButton->m_nTotalButtons - 1)
- {
- CStateManager::GetInstance()->m_cAudioManager.PostEvent(AK::EVENTS::PLAY_HA_SFX_MENUNAVIGATE);
- int nNum = m_tCurrentButton->m_nButtonNum;
- m_tCurrentButton->m_nButtonNum++;
- UpdateButton(nNum);
- }
- }
- else if(m_cInput->GetKeyPressed(VK_UP) || m_cInput->GetKeyPressed('W') || m_cInput->GamepadPressed(GAMEPAD_DPAD_UP))
- {
- if(m_tCurrentButton->m_nButtonNum != 0)
- {
- CStateManager::GetInstance()->m_cAudioManager.PostEvent(AK::EVENTS::PLAY_HA_SFX_MENUNAVIGATE);
- int nNum = m_tCurrentButton->m_nButtonNum;
- m_tCurrentButton->m_nButtonNum--;
- UpdateButton(nNum);
- }
- }
- int nButton = MouseIntersect(m_tCurrentButton, true);
- if( nButton != -1)
- {
- int nNum = m_tCurrentButton->m_nButtonNum;
- m_tCurrentButton->m_nButtonNum = nButton;
- UpdateButton(nNum);
- }
- }
- break;
- };
- }
- void CUIManager::Render( void )
- {
- CGameplayState* pGPState = (CGameplayState*)(CStateManager::GetInstance()->GetGameplayStateHandle());
- C3DManager& renderer = C3DManager::GetInstance();
- renderer.Begin2DRendering();
- if( eCurrentState != STATE_GAMEPLAY && eCurrentState != STATE_PAUSE && eCurrentState != STATE_OPTIONS && eCurrentState != STATE_GAMEOVER_LOSE && eCurrentState != STATE_LEVEL_COMPLETE )
- {
- CStateManager::GetInstance()->m_cBitmapFont.SetColor(XMFLOAT4(0.0f, 0.0f, 0.0f, 1.0f));
- if( CStateManager::GetInstance()->m_cInput.GetIsConnected() ) // Render controller instructions if controller connected, otherwise render keyboard instructions
- {
- CStateManager::GetInstance()->m_cBitmapFont.Draw("Use D-Pad to navigate menu \nand A button to select ",
- CStateManager::GetInstance()->GetWindowWidth() - (int)(CStateManager::GetInstance()->GetWindowWidth()*0.24f ),
- CStateManager::GetInstance()->GetWindowHeight() - (int)(CStateManager::GetInstance()->GetWindowHeight()*0.35f), fInstrFS);
- }
- else
- {
- CStateManager::GetInstance()->m_cBitmapFont.Draw("Use Arrow keys to navigate \nmenu and Enter to select ",
- CStateManager::GetInstance()->GetWindowWidth() - (int)(CStateManager::GetInstance()->GetWindowWidth()*0.24f ),
- CStateManager::GetInstance()->GetWindowHeight() - (int)(CStateManager::GetInstance()->GetWindowHeight()*0.35f), fInstrFS);
- }
- CStateManager::GetInstance()->m_cBitmapFont.SetColor(XMFLOAT4(1.0f, 1.0f, 1.0f, 1.0f));
- }
- // Loading sigil icon
- if(!CStateManager::GetInstance()->IsDoneLoading())
- {
- CStateManager::GetInstance()->m_cBitmapFont.SetColor(XMFLOAT4(0.0f, 0.0f, 0.0f, 1.0f));
- // Scrolling ellipsis
- if(GetTickCount() % 1000 < 250)
- CStateManager::GetInstance()->m_cBitmapFont.Draw("Loading", 70, (int)(CStateManager::GetInstance()->GetWindowHeight()-108), 1.0f);
- else if(GetTickCount() % 1000 < 500)
- CStateManager::GetInstance()->m_cBitmapFont.Draw("Loading.", 70, (int)(CStateManager::GetInstance()->GetWindowHeight()-108), 1.0f);
- else if(GetTickCount() % 1000 < 750)
- CStateManager::GetInstance()->m_cBitmapFont.Draw("Loading..", 70, (int)(CStateManager::GetInstance()->GetWindowHeight()-108), 1.0f);
- else
- CStateManager::GetInstance()->m_cBitmapFont.Draw("Loading...", 70, (int)(CStateManager::GetInstance()->GetWindowHeight()-108), 1.0f);
- CStateManager::GetInstance()->m_cBitmapFont.SetColor(XMFLOAT4(1.0f, 1.0f, 1.0f, 1.0f));
- m_cLoadingIcon.Render();
- }
- else if(m_cLoadingIcon.GetScale().x > 0.01f)
- m_cLoadingIcon.Render();
- if(m_tCurrentButton->m_nTotalButtons == 0)
- return;
- //for (int i = 0; i < m_tCurrentButton->>m_tAttachedButtons.size(); i++)
- //{
- // if( !m_tCurrentButton->>m_tAttachedButtons[i]->m_bHidden )
- // {
- // m_tCurrentButton->>m_tAttachedButtons[i]->m_cButtonImg.Render();
- // }
- //}
- switch(eCurrentState)
- {
- case STATE_GAMEPLAY:
- {
- GameplayRender();
- }
- break;
- case STATE_LEVEL_SELECT:
- {
- CStateManager::GetInstance()->m_cBitmapFont.SetColor(XMFLOAT4(0.0f, 0.0f, 0.0f, 1.0f));
- for (unsigned int i = 0; i < m_tCurrentButton->m_tButtonNames.size(); i++)
- {
- CStateManager::GetInstance()->m_cBitmapFont.Draw(m_tCurrentButton->m_tButtonNames[i].m_szLabel.c_str(), (int)m_tCurrentButton->m_tButtonNames[i].m_tTexPos.x, (int)m_tCurrentButton->m_tButtonNames[i].m_tTexPos.y, m_tCurrentButton->m_tButtonNames[i].m_fScale);
- }
- CStateManager::GetInstance()->m_cBitmapFont.SetColor(XMFLOAT4(1.0f, 1.0f, 1.0f, 1.0f));
- m_tCurrentButton->m_cButtonImg.Render();
- if(!m_tCurrentButton->m_tAttachedButtons[m_tCurrentButton->m_nCurrentAttached]->m_bHidden)
- m_tCurrentButton->m_tAttachedButtons[m_tCurrentButton->m_nCurrentAttached]->m_cButtonImg.Render();
- m_tCurrentButton->m_cBackgroundImg.Render();
- }
- break;
- case STATE_OPTIONS:
- {
- //UpdateButton(m_tCurrentButton->m_nButtonNum);
- OptionsRender();
- if(CStateManager::GetInstance()->GetPrevState() == CStateManager::GetInstance()->GetMenuStateHandle())
- {
- //UpdateButton(tButtonCollection[STATE_MENU]);
- BaseRender(tButtonCollection[STATE_MENU]);
- }
- else
- {
- tButton tHold = *m_tCurrentButton;
- m_tCurrentButton = tButtonCollection[STATE_SOLO];
- GameplayRender();
- m_tCurrentButton = &tHold;
- }
- }
- break;
- default:
- {
- BaseRender(m_tCurrentButton);
- if(eCurrentState == STATE_PAUSE)
- {
- tButton tHold = *m_tCurrentButton;
- m_tCurrentButton = tButtonCollection[STATE_SOLO];
- GameplayRender();
- m_tCurrentButton = &tHold;
- }
- }
- break;
- };
- renderer.GetRenderController().PushRenderListClear();
- renderer.End2DRendering();
- }
- void CUIManager::Shutdown( void )
- {
- // Clear out Map
- for (auto tButtonIter = tButtonCollection.begin(); tButtonIter != tButtonCollection.end(); ++tButtonIter)
- {
- for (auto tAttachedIter = (*tButtonIter).second->m_tAttachedButtons.begin(); tAttachedIter != (*tButtonIter).second->m_tAttachedButtons.end(); ++tAttachedIter)
- {
- delete (*tAttachedIter).second;
- (*tAttachedIter).second = nullptr;
- }
- delete (*tButtonIter).second;
- (*tButtonIter).second = nullptr;
- }
- tButtonCollection.clear();
- for (auto tButtonIter = m_tSliders.begin(); tButtonIter != m_tSliders.end(); ++tButtonIter)
- {
- delete (*tButtonIter).second;
- (*tButtonIter).second = nullptr;
- }
- m_tSliders.clear();
- }
- void CUIManager::SetCurrentState( eStates nState )
- {
- eCurrentState = nState;
- CGameplayState* pGPState = (CGameplayState*)(CStateManager::GetInstance()->GetGameplayStateHandle());
- switch (eCurrentState)
- {
- case STATE_GAMEPLAY:
- {
- m_tCurrentButton = tButtonCollection[STATE_SOLO];
- m_tMultiCurrentButton = tButtonCollection[STATE_MULTI];
- }
- break;
- case STATE_LEVEL_COMPLETE:
- {
- if(pGPState->GetCurrLevel() == 3)
- {
- m_tCurrentButton = tButtonCollection[STATE_LEVEL_COMPLETE];
- m_tCurrentButton->m_nTotalButtons = 1;
- m_tCurrentButton->m_tButtonNames[1].m_szLabel = "";
- }
- else
- m_tCurrentButton = tButtonCollection[STATE_LEVEL_COMPLETE];
- };
- break;
- default:
- {
- m_tCurrentButton = tButtonCollection[eCurrentState];
- }
- break;
- }
- }
- void CUIManager::UpdateButton(tButton *tLoadButton)
- {
- XMFLOAT3 tNewPos;
- tNewPos.x = tLoadButton->m_tPos.x;
- tNewPos.y = tLoadButton->m_tPos.y;
- tNewPos.z = 0.0;
- RECT tClient;
- GetClientRect(CStateManager::GetInstance()->m_hWnd, &tClient );
- int nWidth = tClient.right;
- int nHieght = tClient.bottom;
- // int nWidth = CStateManager::GetInstance()->GetWindowWidth();
- // int nHieght = CStateManager::GetInstance()->GetWindowHeight();
- //tLoadButton.m_tClickArea.left += tLoadButton.m_tPos.x;
- //tLoadButton.m_tClickArea.right += tLoadButton.m_tPos.x;
- //tLoadButton.m_tClickArea.top += tLoadButton.m_tPos.y;
- //tLoadButton.m_tClickArea.bottom += tLoadButton.m_tPos.y;
- tNewPos.x = 2 * tNewPos.x / nWidth - 1;
- tNewPos.y = 1 - 2 * tNewPos.y / nHieght;
- tLoadButton->m_cButtonImg.SetScale(tLoadButton->m_tClickArea);
- tLoadButton->m_cButtonImg.SetPosition(tNewPos);
- //tLoadButton.m_tClickArea.left -= tLoadButton.m_tPos.x;
- //tLoadButton.m_tClickArea.right -= tLoadButton.m_tPos.x;
- //tLoadButton.m_tClickArea.top -= tLoadButton.m_tPos.y;
- //tLoadButton.m_tClickArea.bottom -= tLoadButton.m_tPos.y;
- }
- void CUIManager::UpdateButton(int nNum)
- {
- m_tCurrentButton->m_tPos.y -= ( m_tCurrentButton->m_ButtonWidth + m_tCurrentButton->m_fIncrement ) * nNum;
- m_tCurrentButton->m_tPos.y += ( m_tCurrentButton->m_ButtonWidth + m_tCurrentButton->m_fIncrement ) * m_tCurrentButton->m_nButtonNum;
- XMFLOAT3 tNewPos;
- tNewPos.x = m_tCurrentButton->m_tPos.x;
- tNewPos.y = m_tCurrentButton->m_tPos.y;
- tNewPos.z = 0.0;
- RECT tClient;
- GetClientRect(CStateManager::GetInstance()->m_hWnd, &tClient );
- int nWidth = tClient.right;
- int nHieght = tClient.bottom;
- //int nWidth = CStateManager::GetInstance()->GetWindowWidth();
- //int nHieght = CStateManager::GetInstance()->GetWindowHeight();
- //m_tCurrentButton->m_tClickArea.left += m_tCurrentButton->m_tPos.x;
- //m_tCurrentButton->m_tClickArea.right += m_tCurrentButton->m_tPos.x;
- //m_tCurrentButton->m_tClickArea.top += m_tCurrentButton->m_tPos.y;
- //m_tCurrentButton->m_tClickArea.bottom += m_tCurrentButton->m_tPos.y;
- tNewPos.x = 2 * tNewPos.x / nWidth - 1;
- tNewPos.y = 1 - 2 * tNewPos.y / nHieght;
- //m_tCurrentButton->m_cButtonImg.SetScale(m_tCurrentButton->m_tClickArea);
- m_tCurrentButton->m_cButtonImg.SetPosition(tNewPos);
- //m_tCurrentButton->m_tClickArea.left -= m_tCurrentButton->m_tPos.x;
- //m_tCurrentButton->m_tClickArea.right -= m_tCurrentButton->m_tPos.x;
- //m_tCurrentButton->m_tClickArea.top -= m_tCurrentButton->m_tPos.y;
- //m_tCurrentButton->m_tClickArea.bottom -= m_tCurrentButton->m_tPos.y;
- }
- int CUIManager::MouseIntersect(tButton *tButtonCheck, bool bCheck)
- {
- // Make Button button one no matter what.
- tButtonCheck->m_tPos.y -= ( tButtonCheck->m_ButtonWidth + tButtonCheck->m_fIncrement ) * tButtonCheck->m_nButtonNum;
- POINT tMouse_Pos = m_cInput->GetCursorPos();
- for (int i = 0; i < tButtonCheck->m_nTotalButtons; i++)
- {
- tButtonCheck->m_tPos.y += ( tButtonCheck->m_ButtonWidth + tButtonCheck->m_fIncrement ) * i;
- tButtonCheck->m_tClickArea.left += static_cast<LONG> (tButtonCheck->m_tPos.x);
- tButtonCheck->m_tClickArea.right += static_cast<LONG> (tButtonCheck->m_tPos.x);
- tButtonCheck->m_tClickArea.top += static_cast<LONG> (tButtonCheck->m_tPos.y);
- tButtonCheck->m_tClickArea.bottom += static_cast<LONG> (tButtonCheck->m_tPos.y);
- if(tMouse_Pos.x >= tButtonCheck->m_tClickArea.left && tMouse_Pos.x <= tButtonCheck->m_tClickArea.right)
- {
- if(tMouse_Pos.y >= tButtonCheck->m_tClickArea.top && tMouse_Pos.y <= tButtonCheck->m_tClickArea.bottom)
- {
- tButtonCheck->m_tClickArea.left -= static_cast<LONG> (tButtonCheck->m_tPos.x);
- tButtonCheck->m_tClickArea.right -= static_cast<LONG> (tButtonCheck->m_tPos.x);
- tButtonCheck->m_tClickArea.top -= static_cast<LONG> (tButtonCheck->m_tPos.y);
- tButtonCheck->m_tClickArea.bottom -= static_cast<LONG> (tButtonCheck->m_tPos.y);
- tButtonCheck->m_tPos.y -= ( tButtonCheck->m_ButtonWidth + tButtonCheck->m_fIncrement ) * i;
- tButtonCheck->m_tPos.y += ( tButtonCheck->m_ButtonWidth + tButtonCheck->m_fIncrement ) * tButtonCheck->m_nButtonNum;
- if(bCheck)
- {
- return i;
- }
- else
- {
- return 1;
- }
- }
- }
- tButtonCheck->m_tClickArea.left -= static_cast<LONG> (tButtonCheck->m_tPos.x);
- tButtonCheck->m_tClickArea.right -= static_cast<LONG> (tButtonCheck->m_tPos.x);
- tButtonCheck->m_tClickArea.top -= static_cast<LONG> (tButtonCheck->m_tPos.y);
- tButtonCheck->m_tClickArea.bottom -= static_cast<LONG> (tButtonCheck->m_tPos.y);
- tButtonCheck->m_tPos.y -= ( tButtonCheck->m_ButtonWidth + tButtonCheck->m_fIncrement ) * i;
- }
- tButtonCheck->m_tPos.y += ( tButtonCheck->m_ButtonWidth + tButtonCheck->m_fIncrement ) * tButtonCheck->m_nButtonNum;
- if(bCheck)
- {
- return -1;
- }
- else
- return 0;
- }
- bool CUIManager::MouseIntersect(tButton *tButtonCheck)
- {
- // Make Button button one no matter what.
- tButtonCheck->m_tPos.y -= ( tButtonCheck->m_ButtonWidth + tButtonCheck->m_fIncrement ) * tButtonCheck->m_nButtonNum;
- POINT tMouse_Pos = m_cInput->GetCursorPos();
- for (int i = 0; i < tButtonCheck->m_nTotalButtons; i++)
- {
- tButtonCheck->m_tPos.y += ( tButtonCheck->m_ButtonWidth + tButtonCheck->m_fIncrement ) * i;
- tButtonCheck->m_tClickArea.left += static_cast<LONG> (tButtonCheck->m_tPos.x);
- tButtonCheck->m_tClickArea.right += static_cast<LONG> (tButtonCheck->m_tPos.x);
- tButtonCheck->m_tClickArea.top += static_cast<LONG> (tButtonCheck->m_tPos.y);
- tButtonCheck->m_tClickArea.bottom += static_cast<LONG> (tButtonCheck->m_tPos.y);
- if(tMouse_Pos.x >= tButtonCheck->m_tClickArea.left && tMouse_Pos.x <= tButtonCheck->m_tClickArea.right)
- {
- if(tMouse_Pos.y >= tButtonCheck->m_tClickArea.top && tMouse_Pos.y <= tButtonCheck->m_tClickArea.bottom)
- {
- tButtonCheck->m_tClickArea.left -= static_cast<LONG> (tButtonCheck->m_tPos.x);
- tButtonCheck->m_tClickArea.right -= static_cast<LONG> (tButtonCheck->m_tPos.x);
- tButtonCheck->m_tClickArea.top -= static_cast<LONG> (tButtonCheck->m_tPos.y);
- tButtonCheck->m_tClickArea.bottom -= static_cast<LONG> (tButtonCheck->m_tPos.y);
- tButtonCheck->m_tPos.y -= ( tButtonCheck->m_ButtonWidth + tButtonCheck->m_fIncrement ) * i;
- tButtonCheck->m_tPos.y += ( tButtonCheck->m_ButtonWidth + tButtonCheck->m_fIncrement ) * tButtonCheck->m_nButtonNum;
- return true;
- }
- }
- tButtonCheck->m_tClickArea.left -= static_cast<LONG> (tButtonCheck->m_tPos.x);
- tButtonCheck->m_tClickArea.right -= static_cast<LONG> (tButtonCheck->m_tPos.x);
- tButtonCheck->m_tClickArea.top -= static_cast<LONG> (tButtonCheck->m_tPos.y);
- tButtonCheck->m_tClickArea.bottom -= static_cast<LONG> (tButtonCheck->m_tPos.y);
- tButtonCheck->m_tPos.y -= ( tButtonCheck->m_ButtonWidth + tButtonCheck->m_fIncrement ) * i;
- }
- tButtonCheck->m_tPos.y += ( tButtonCheck->m_ButtonWidth + tButtonCheck->m_fIncrement ) * tButtonCheck->m_nButtonNum;
- return false;
- }
- bool CUIManager::MouseIntersect(bool bCheck, tButton *tButtonCheck)
- {
- POINT tMouse_Pos = m_cInput->GetCursorPos();
- tButtonCheck->m_tClickArea.left += static_cast<LONG> (tButtonCheck->m_tPos.x);
- tButtonCheck->m_tClickArea.right += static_cast<LONG> (tButtonCheck->m_tPos.x);
- tButtonCheck->m_tClickArea.top += static_cast<LONG> (tButtonCheck->m_tPos.y);
- tButtonCheck->m_tClickArea.bottom += static_cast<LONG> (tButtonCheck->m_tPos.y);
- if(tMouse_Pos.x >= tButtonCheck->m_tClickArea.left && tMouse_Pos.x <= tButtonCheck->m_tClickArea.right)
- {
- if(tMouse_Pos.y >= tButtonCheck->m_tClickArea.top && tMouse_Pos.y <= tButtonCheck->m_tClickArea.bottom)
- {
- tButtonCheck->m_tClickArea.left -= static_cast<LONG> (tButtonCheck->m_tPos.x);
- tButtonCheck->m_tClickArea.right -= static_cast<LONG> (tButtonCheck->m_tPos.x);
- tButtonCheck->m_tClickArea.top -= static_cast<LONG> (tButtonCheck->m_tPos.y);
- tButtonCheck->m_tClickArea.bottom -= static_cast<LONG> (tButtonCheck->m_tPos.y);
- return true;
- }
- }
- tButtonCheck->m_tClickArea.left -= static_cast<LONG> (tButtonCheck->m_tPos.x);
- tButtonCheck->m_tClickArea.right -= static_cast<LONG> (tButtonCheck->m_tPos.x);
- tButtonCheck->m_tClickArea.top -= static_cast<LONG> (tButtonCheck->m_tPos.y);
- tButtonCheck->m_tClickArea.bottom -= static_cast<LONG> (tButtonCheck->m_tPos.y);
- return false;
- }
- RECT CUIManager::LoadRECT(TiXmlElement* tElement )
- {
- int nValue;
- tButton tNewButton;
- tElement->Attribute("Left", &nValue);
- tNewButton.m_tClickArea.left = static_cast<long>(nValue);
- tElement->Attribute("Right", &nValue);
- tNewButton.m_tClickArea.right = static_cast<long>(nValue);
- tElement->Attribute("Top", &nValue);
- tNewButton.m_tClickArea.top = static_cast<long>(nValue);
- tElement->Attribute("Bottom", &nValue);
- tNewButton.m_tClickArea.bottom = static_cast<long>(nValue);
- return tNewButton.m_tClickArea;
- }
- float CUIManager::DeterminePosition(XMFLOAT2 tLine, int nVolume)
- {
- float fReturn = tLine.x;
- int nPos = nVolume;
- nPos *= static_cast<int>(tLine.y - tLine.x);
- nPos /= 100;
- fReturn += static_cast<float>(nPos);
- return fReturn;
- }
- int CUIManager::DetermineVolume( float NewPos, float fBoundry)
- {
- int nVolume;
- nVolume = static_cast<int>(NewPos);
- nVolume *= 100;
- nVolume /= static_cast<int>(fBoundry);
- return nVolume;
- }
- void CUIManager::GameplayUpdate( void )
- {
- CGameplayState* pGPState = (CGameplayState*)(CStateManager::GetInstance()->GetGameplayStateHandle());
- CPlayer* pUIPlayer;
- if(pGPState->GetPlayer() == nullptr)
- return;
- else
- pUIPlayer = pGPState->GetPlayer();
- int nNum = 1;
- tButton tHold = *m_tCurrentButton;
- if(CStateManager::GetInstance()->GetCoop())
- {
- nNum = 2;
- }
- for (int nPlayers = 0; nPlayers < nNum; nPlayers++)
- {
- if(nPlayers == 1)
- {
- m_tCurrentButton = m_tMultiCurrentButton;
- pUIPlayer = pGPState->GetPlayer2();
- }
- for (unsigned int i = 0; i < m_tCurrentButton->m_tAttachedButtons.size(); i++)
- {
- switch(i)
- {
- case HUD_ORB_ONE:
- {
- eOrbType eCatchOne = pUIPlayer->GetOrbs()[0];
- if(eCatchOne == ORB_FIRE)
- {
- m_tCurrentButton->m_tAttachedButtons[i]->m_cButtonImg.SetDiffuseTexture( CStateManager::GetInstance()->GetAssetManagerHandle()->tUI[STATE_GAMEPLAY]->m_tImages[ UI_FIRE ] );
- m_tCurrentButton->m_tAttachedButtons[i]->m_bHidden = false;
- }
- else if(eCatchOne == ORB_LIGHT)
- {
- m_tCurrentButton->m_tAttachedButtons[i]->m_cButtonImg.SetDiffuseTexture( CStateManager::GetInstance()->GetAssetManagerHandle()->tUI[STATE_GAMEPLAY]->m_tImages[ UI_LIGHT ] );
- m_tCurrentButton->m_tAttachedButtons[i]->m_bHidden = false;
- }
- else if(eCatchOne == ORB_STONE)
- {
- m_tCurrentButton->m_tAttachedButtons[i]->m_cButtonImg.SetDiffuseTexture( CStateManager::GetInstance()->GetAssetManagerHandle()->tUI[STATE_GAMEPLAY]->m_tImages[ UI_STONE ] );
- m_tCurrentButton->m_tAttachedButtons[i]->m_bHidden = false;
- }
- else if(eCatchOne == ORB_LIGHTNING)
- {
- m_tCurrentButton->m_tAttachedButtons[i]->m_cButtonImg.SetDiffuseTexture( CStateManager::GetInstance()->GetAssetManagerHandle()->tUI[STATE_GAMEPLAY]->m_tImages[ UI_LIGHTNING ] );
- m_tCurrentButton->m_tAttachedButtons[i]->m_bHidden = false;
- }
- else if(eCatchOne == ORB_TAR)
- {
- m_tCurrentButton->m_tAttachedButtons[i]->m_cButtonImg.SetDiffuseTexture( CStateManager::GetInstance()->GetAssetManagerHandle()->tUI[STATE_GAMEPLAY]->m_tImages[ UI_TAR ] );
- m_tCurrentButton->m_tAttachedButtons[i]->m_bHidden = false;
- }
- else
- {
- m_tCurrentButton->m_tAttachedButtons[i]->m_bHidden = true;
- }
- };
- break;
- case HUD_ORB_TWO:
- {
- eOrbType eCatchOne = pUIPlayer->GetOrbs()[1];
- if(eCatchOne == ORB_FIRE)
- {
- m_tCurrentButton->m_tAttachedButtons[i]->m_cButtonImg.SetDiffuseTexture( CStateManager::GetInstance()->GetAssetManagerHandle()->tUI[STATE_GAMEPLAY]->m_tImages[ UI_FIRE ] );
- m_tCurrentButton->m_tAttachedButtons[i]->m_bHidden = false;
- }
- else if(eCatchOne == ORB_LIGHT)
- {
- m_tCurrentButton->m_tAttachedButtons[i]->m_cButtonImg.SetDiffuseTexture( CStateManager::GetInstance()->GetAssetManagerHandle()->tUI[STATE_GAMEPLAY]->m_tImages[ UI_LIGHT ] );
- m_tCurrentButton->m_tAttachedButtons[i]->m_bHidden = false;
- }
- else if(eCatchOne == ORB_STONE)
- {
- m_tCurrentButton->m_tAttachedButtons[i]->m_cButtonImg.SetDiffuseTexture( CStateManager::GetInstance()->GetAssetManagerHandle()->tUI[STATE_GAMEPLAY]->m_tImages[ UI_STONE ] );
- m_tCurrentButton->m_tAttachedButtons[i]->m_bHidden = false;
- }
- else if(eCatchOne == ORB_LIGHTNING)
- {
- m_tCurrentButton->m_tAttachedButtons[i]->m_cButtonImg.SetDiffuseTexture( CStateManager::GetInstance()->GetAssetManagerHandle()->tUI[STATE_GAMEPLAY]->m_tImages[ UI_LIGHTNING ] );
- m_tCurrentButton->m_tAttachedButtons[i]->m_bHidden = false;
- }
- else if(eCatchOne == ORB_TAR)
- {
- m_tCurrentButton->m_tAttachedButtons[i]->m_cButtonImg.SetDiffuseTexture( CStateManager::GetInstance()->GetAssetManagerHandle()->tUI[STATE_GAMEPLAY]->m_tImages[ UI_TAR ] );
- m_tCurrentButton->m_tAttachedButtons[i]->m_bHidden = false;
- }
- else
- {
- m_tCurrentButton->m_tAttachedButtons[i]->m_bHidden = true;
- }
- };
- break;
- case HUD_ORB_THREE:
- {
- eOrbType eCatchOne = pUIPlayer->GetOrbs()[2];
- if(eCatchOne == ORB_FIRE)
- {
- m_tCurrentButton->m_tAttachedButtons[i]->m_cButtonImg.SetDiffuseTexture( CStateManager::GetInstance()->GetAssetManagerHandle()->tUI[STATE_GAMEPLAY]->m_tImages[ UI_FIRE ] );
- m_tCurrentButton->m_tAttachedButtons[i]->m_bHidden = false;
- }
- else if(eCatchOne == ORB_LIGHT)
- {
- m_tCurrentButton->m_tAttachedButtons[i]->m_cButtonImg.SetDiffuseTexture( CStateManager::GetInstance()->GetAssetManagerHandle()->tUI[STATE_GAMEPLAY]->m_tImages[ UI_LIGHT ] );
- m_tCurrentButton->m_tAttachedButtons[i]->m_bHidden = false;
- }
- else if(eCatchOne == ORB_STONE)
- {
- m_tCurrentButton->m_tAttachedButtons[i]->m_cButtonImg.SetDiffuseTexture( CStateManager::GetInstance()->GetAssetManagerHandle()->tUI[STATE_GAMEPLAY]->m_tImages[ UI_STONE ] );
- m_tCurrentButton->m_tAttachedButtons[i]->m_bHidden = false;
- }
- else if(eCatchOne == ORB_LIGHTNING)
- {
- m_tCurrentButton->m_tAttachedButtons[i]->m_cButtonImg.SetDiffuseTexture( CStateManager::GetInstance()->GetAssetManagerHandle()->tUI[STATE_GAMEPLAY]->m_tImages[ UI_LIGHTNING ] );
- m_tCurrentButton->m_tAttachedButtons[i]->m_bHidden = false;
- }
- else if(eCatchOne == ORB_TAR)
- {
- m_tCurrentButton->m_tAttachedButtons[i]->m_cButtonImg.SetDiffuseTexture( CStateManager::GetInstance()->GetAssetManagerHandle()->tUI[STATE_GAMEPLAY]->m_tImages[ UI_TAR ] );
- m_tCurrentButton->m_tAttachedButtons[i]->m_bHidden = false;
- }
- else
- {
- m_tCurrentButton->m_tAttachedButtons[i]->m_bHidden = true;
- }
- };
- break;
- case HUD_SLOT_ONE:
- {
- if(pUIPlayer->GetActiveSlot() == 0)
- {
- m_tCurrentButton->m_tAttachedButtons[i]->m_cButtonImg.SetDiffuseTexture( CStateManager::GetInstance()->GetAssetManagerHandle()->tUI[STATE_GAMEPLAY]->m_tImages[UI_ACTIVE_SLOT] );
- }
- else
- {
- m_tCurrentButton->m_tAttachedButtons[i]->m_cButtonImg.SetDiffuseTexture( CStateManager::GetInstance()->GetAssetManagerHandle()->tUI[STATE_GAMEPLAY]->m_tImages[UI_INACTIVE_SLOT] );
- }
- };
- break;
- case HUD_SLOT_TWO:
- {
- if(pUIPlayer->GetActiveSlot() == 1)
- {
- m_tCurrentButton->m_tAttachedButtons[i]->m_cButtonImg.SetDiffuseTexture( CStateManager::GetInstance()->GetAssetManagerHandle()->tUI[STATE_GAMEPLAY]->m_tImages[UI_ACTIVE_SLOT] );
- }
- else
- {
- m_tCurrentButton->m_tAttachedButtons[i]->m_cButtonImg.SetDiffuseTexture( CStateManager::GetInstance()->GetAssetManagerHandle()->tUI[STATE_GAMEPLAY]->m_tImages[UI_INACTIVE_SLOT] );
- }
- };
- break;
- case HUD_SLOT_THREE:
- {
- if(pUIPlayer->GetActiveSlot() == 2)
- {
- m_tCurrentButton->m_tAttachedButtons[i]->m_cButtonImg.SetDiffuseTexture( CStateManager::GetInstance()->GetAssetManagerHandle()->tUI[STATE_GAMEPLAY]->m_tImages[UI_ACTIVE_SLOT] );
- }
- else
- {
- m_tCurrentButton->m_tAttachedButtons[i]->m_cButtonImg.SetDiffuseTexture( CStateManager::GetInstance()->GetAssetManagerHandle()->tUI[STATE_GAMEPLAY]->m_tImages[UI_INACTIVE_SLOT] );
- }
- };
- break;
- };
- }
- // Health Modify
- float fHealth = pUIPlayer->GetCurrHealth();
- fHealth *= (m_tCurrentButton->m_tAttachedButtons[HUD_HEALTH_BAR]->m_ButtonWidth);
- fHealth /= 100;
- m_tCurrentButton->m_tAttachedButtons[HUD_HEALTH_BAR]->m_tClickArea.right = (static_cast<LONG> (fHealth) );
- UpdateButton(m_tCurrentButton->m_tAttachedButtons[HUD_HEALTH_BAR]);
- // Stamina Modify
- float fStamina = pUIPlayer->GetCurrStamina();
- fStamina *= (m_tCurrentButton->m_tAttachedButtons[HUD_STAMINA_BAR]->m_ButtonWidth);
- fStamina /= 100;
- m_tCurrentButton->m_tAttachedButtons[HUD_STAMINA_BAR]->m_tClickArea.right = (static_cast<LONG> (fStamina) );
- UpdateButton(m_tCurrentButton->m_tAttachedButtons[HUD_STAMINA_BAR]);
- }
- m_tCurrentButton = &tHold;
- }
- void CUIManager::GameplayRender( void )
- {
- CGameplayState* pGPState = (CGameplayState*)(CStateManager::GetInstance()->GetGameplayStateHandle());
- CPlayer* pUIPlayer;
- if(pGPState->GetPlayer() == nullptr)
- return;
- else
- pUIPlayer = pGPState->GetPlayer();
- int nNum = 1;
- tButton tHold = *m_tCurrentButton;
- if(CStateManager::GetInstance()->GetCoop())
- {
- nNum = 2;
- }
- for (int nPlayers = 0; nPlayers < nNum; nPlayers++)
- {
- if(nPlayers == 1)
- {
- m_tCurrentButton = m_tMultiCurrentButton;
- pUIPlayer = pGPState->GetPlayer2();
- }
- // Render HUD Elements
- m_tCurrentButton->m_tAttachedButtons[HUD_HEALTH_BAR]->m_cButtonImg.Render();
- m_tCurrentButton->m_tAttachedButtons[HUD_STAMINA_BAR]->m_cButtonImg.Render();
- if(!m_tCurrentButton->m_tAttachedButtons[HUD_ORB_ONE]->m_bHidden)
- m_tCurrentButton->m_tAttachedButtons[HUD_ORB_ONE]->m_cButtonImg.Render();
- if(!m_tCurrentButton->m_tAttachedButtons[HUD_ORB_TWO]->m_bHidden)
- m_tCurrentButton->m_tAttachedButtons[HUD_ORB_TWO]->m_cButtonImg.Render();
- if(!m_tCurrentButton->m_tAttachedButtons[HUD_ORB_THREE]->m_bHidden)
- m_tCurrentButton->m_tAttachedButtons[HUD_ORB_THREE]->m_cButtonImg.Render();
- m_tCurrentButton->m_tAttachedButtons[HUD_SLOT_ONE]->m_cButtonImg.Render();
- m_tCurrentButton->m_tAttachedButtons[HUD_SLOT_TWO]->m_cButtonImg.Render();
- m_tCurrentButton->m_tAttachedButtons[HUD_SLOT_THREE]->m_cButtonImg.Render();
- m_tCurrentButton->m_tAttachedButtons[HUD_HS_CASE]->m_cButtonImg.Render();
- if(!CStateManager::GetInstance()->InLevelEditor())
- {
- //if( pGPState->GetCurrLevel() == 1 || pGPState->GetCurrLevel() == 4 || pGPState->GetCurrLevel() == 5 )
- {
- if( pGPState->GetCurrLevel() == 1 || pGPState->GetCurrLevel() == 4 || pGPState->GetCurrLevel() == 5 )
- CStateManager::GetInstance()->m_cBitmapFont.SetColor(XMFLOAT4(0.0f, 0.0f, 0.0f, 1.0f));
- // Messages
- /*
- if(CStateManager::GetInstance()->GetWindowHeight() == 768 )
- {
- CStateManager::GetInstance()->m_cBitmapFont.Draw( pGPState->GetPrimaryMessage().c_str(), 15, 70, pGPState->GetPrimarySize());
- CStateManager::GetInstance()->m_cBitmapFont.Draw( pGPState->GetSecondaryMessage().c_str(), 15, 105, pGPState->GetSecondarySize());
- }
- else
- {
- CStateManager::GetInstance()->m_cBitmapFont.Draw( pGPState->GetPrimaryMessage().c_str(), 20, 95, pGPState->GetPrimarySize());
- CStateManager::GetInstance()->m_cBitmapFont.Draw( pGPState->GetSecondaryMessage().c_str(), 20, 130, pGPState->GetSecondarySize());
- }
- */
- // Short version of Score Display code
- char buffer[20];
- _itoa_s(CStateManager::GetInstance()->GetEntityManager()->GetPlayerScore()->GetScore(), buffer, 10);
- std::string szScore = buffer;
- _itoa_s(CStateManager::GetInstance()->GetEntityManager()->GetPlayerScore()->GetMultiplier(), buffer, 10);
- std::string szMult = buffer;
- /*
- CStateManager::GetInstance()->m_cBitmapFont.Draw("Score: ", CStateManager::GetInstance()->GetWindowWidth() - (40 * szScore.length()) - 125, 5, .75);
- CStateManager::GetInstance()->m_cBitmapFont.Draw(szScore.c_str(), CStateManager::GetInstance()->GetWindowWidth() - (40 * szScore.length()), 5, 1);
- CStateManager::GetInstance()->m_cBitmapFont.Draw("x", CStateManager::GetInstance()->GetWindowWidth() - (40 * (szMult.length() + 1)), 65, .75);
- CStateManager::GetInstance()->m_cBitmapFont.Draw(szMult.c_str(), CStateManager::GetInstance()->GetWindowWidth() - (40 * szMult.length()), 55, 1);
- */
- if( nPlayers == 0 )
- {
- XMFLOAT2 tScorePos;
- tScorePos.x = m_tCurrentButton->m_tAttachedButtons[HUD_SLOT_THREE]->m_tClickArea.right + m_tCurrentButton->m_tAttachedButtons[HUD_SLOT_THREE]->m_tPos.x + 20;
- tScorePos.y = m_tCurrentButton->m_tAttachedButtons[HUD_SLOT_THREE]->m_tPos.y;
- CStateManager::GetInstance()->m_cBitmapFont.Draw("Score: ",(int)tScorePos.x, (int)tScorePos.y, .75);
- CStateManager::GetInstance()->m_cBitmapFont.Draw(szScore.c_str(),(int)tScorePos.x + 110, (int)tScorePos.y, 1);
- tScorePos.x = m_tCurrentButton->m_tAttachedButtons[HUD_HS_CASE]->m_tClickArea.right + m_tCurrentButton->m_tAttachedButtons[HUD_HS_CASE]->m_tPos.x + 10;
- tScorePos.y = m_tCurrentButton->m_tAttachedButtons[HUD_HS_CASE]->m_tPos.y;
- CStateManager::GetInstance()->m_cBitmapFont.Draw("x", (int)tScorePos.x, (int)tScorePos.y, .75);
- CStateManager::GetInstance()->m_cBitmapFont.Draw(szMult.c_str(), (int)tScorePos.x + 30, (int)tScorePos.y, 1);
- }
- else
- {
- XMFLOAT2 tScorePos;
- tScorePos.x = m_tCurrentButton->m_tAttachedButtons[HUD_SLOT_ONE]->m_tPos.x - 10;
- tScorePos.y = m_tCurrentButton->m_tAttachedButtons[HUD_SLOT_ONE]->m_tPos.y;
- CStateManager::GetInstance()->m_cBitmapFont.Draw("Score: ", (int)tScorePos.x - (25 * szScore.length()) - 110, (int)tScorePos.y, .75);
- CStateManager::GetInstance()->m_cBitmapFont.Draw(szScore.c_str(), (int)tScorePos.x - (25 * szScore.length()), (int)tScorePos.y, 1);
- tScorePos.x = m_tCurrentButton->m_tAttachedButtons[HUD_HS_CASE]->m_tPos.x - 10;
- tScorePos.y = m_tCurrentButton->m_tAttachedButtons[HUD_HS_CASE]->m_tPos.y;
- CStateManager::GetInstance()->m_cBitmapFont.Draw("x", (int)tScorePos.x - (25 * (szMult.length() + 1)), (int)tScorePos.y, .75);
- CStateManager::GetInstance()->m_cBitmapFont.Draw(szMult.c_str(), (int)tScorePos.x - (25 * szMult.length()), (int)tScorePos.y, 1);
- }
- if( pGPState->GetCurrLevel() == 1 || pGPState->GetCurrLevel() == 4 || pGPState->GetCurrLevel() == 5 )
- CStateManager::GetInstance()->m_cBitmapFont.SetColor(XMFLOAT4(1.0f, 1.0f, 1.0f, 1.0f));
- }
- }
- else
- {
- LevelEditorRender();
- }
- CPlayer* pPlayer = ((CGameplayState*)CStateManager::GetInstance()->GetGameplayStateHandle())->GetPlayer();
- if(pPlayer->GetCurrPriorityOrb() != nullptr && pPlayer->GetCurrPriorityOrb()->GetPriority() == true )
- {
- eOrbType* eCurrOrbs = pPlayer->GetOrbs();
- if(eCurrOrbs[2] == ORB_EMPTY ||eCurrOrbs[1] == ORB_EMPTY ||eCurrOrbs[0] == ORB_EMPTY)
- {
- if( CStateManager::GetInstance()->m_cInput.GetIsConnected() )
- {
- CStateManager::GetInstance()->m_cBitmapFont.Draw("Press 'A' to pick up Orb",
- 15, 15, 0.60f);
- }
- else
- {
- CStateManager::GetInstance()->m_cBitmapFont.Draw("Right Click to pick up Orb",
- 15, 15, 0.60f);
- }
- }
- }
- vector<CFountain*> fountainList = ((CGameplayState*)CStateManager::GetInstance()->GetGameplayStateHandle())->m_tFountains;
- for(size_t i = 0; i < fountainList.size(); ++i)
- {
- if( !fountainList[i]->GetIsActive() && fountainList[i]->GetCorruptLevel() > 0.0f && fountainList[i]->GetInfluence()->GetNumPlayersWithin() > 0 )
- {
- if( CStateManager::GetInstance()->m_cInput.GetIsConnected() )
- {
- CStateManager::GetInstance()->m_cBitmapFont.Draw("Press 'A' to activate Fountain",
- 15, 15, 0.60f);
- }
- else
- {
- CStateManager::GetInstance()->m_cBitmapFont.Draw("Right Click to activate Fountain",
- 15, 15, 0.60f);
- }
- }
- }
- }
- m_tCurrentButton = &tHold;
- }
- void CUIManager::LevelEditorRender(void)
- {
- CGameplayState* pGPState = (CGameplayState*)(CStateManager::GetInstance()->GetGameplayStateHandle());
- switch (CStateManager::GetInstance()->GetEntityManager()->GetPlayer()->GetLevelEditorType())
- {
- case LEP_DAMNED_TANK:
- CStateManager::GetInstance()->m_cBitmapFont.Draw("Tank Damned", CStateManager::GetInstance()->GetWindowWidth() - (40 * 4) - 125, 5, .75);
- break;
- case LEP_DAMNED_FAST:
- CStateManager::GetInstance()->m_cBitmapFont.Draw("Fast Damned", CStateManager::GetInstance()->GetWindowWidth() - (40 * 4) - 125, 5, .75);
- break;
- case LEP_DAMNED:
- CStateManager::GetInstance()->m_cBitmapFont.Draw("Damned", CStateManager::GetInstance()->GetWindowWidth() - (40 * 3) - 125, 5, .75);
- break;
- case LEP_DAMNED_DUMMY:
- CStateManager::GetInstance()->m_cBitmapFont.Draw("Dummy Damned", CStateManager::GetInstance()->GetWindowWidth() - (40 * 5) - 125, 5, .75);
- break;
- case LEP_GOATIMP_BIG:
- CStateManager::GetInstance()->m_cBitmapFont.Draw("Big Goat Imp", CStateManager::GetInstance()->GetWindowWidth() - (40 * 4) - 125, 5, .75);
- break;
- case LEP_GOATIMP_TRI:
- CStateManager::GetInstance()->m_cBitmapFont.Draw("Tri Goat Imp", CStateManager::GetInstance()->GetWindowWidth() - (40 * 4) - 125, 5, .75);
- break;
- case LEP_GOATIMP:
- CStateManager::GetInstance()->m_cBitmapFont.Draw("Goat Imp", CStateManager::GetInstance()->GetWindowWidth() - (40 * 3) - 125, 5, .75);
- break;
- case LEP_GOATIMP_DUMMY:
- CStateManager::GetInstance()->m_cBitmapFont.Draw("Dummy Goat Imp", CStateManager::GetInstance()->GetWindowWidth() - (40 * 5) - 125, 5, .75);
- break;
- case LEP_PIGGLY:
- CStateManager::GetInstance()->m_cBitmapFont.Draw("Piggly", CStateManager::GetInstance()->GetWindowWidth() - (40 * 3) - 125, 5, .75);
- break;
- case LEP_PIGGLY_DUMMY:
- CStateManager::GetInstance()->m_cBitmapFont.Draw("Dummy Piggly", CStateManager::GetInstance()->GetWindowWidth() - (40 * 3) - 125, 5, .75);
- break;
- case LEP_DEMONLORD:
- CStateManager::GetInstance()->m_cBitmapFont.Draw("Demon Lord", CStateManager::GetInstance()->GetWindowWidth() - (40 * 3) - 125, 5, .75);
- break;
- case LEP_LUCIFER:
- CStateManager::GetInstance()->m_cBitmapFont.Draw("Lucifer", CStateManager::GetInstance()->GetWindowWidth() - (40 * 3) - 125, 5, .75);
- break;
- case LEP_GATE:
- CStateManager::GetInstance()->m_cBitmapFont.Draw("Gate", CStateManager::GetInstance()->GetWindowWidth() - (40 * 3) - 125, 5, .75);
- break;
- case LEP_FOUNTAIN:
- CStateManager::GetInstance()->m_cBitmapFont.Draw("Fountain", CStateManager::GetInstance()->GetWindowWidth() - (40 * 3) - 125, 5, .75);
- break;
- default:
- break;
- }
- char buffer[20];
- _itoa_s((int)(CStateManager::GetInstance()->GetEntityManager()->GetPlayer()->GetLevelEditorArea()), buffer, 10);
- CStateManager::GetInstance()->m_cBitmapFont.Draw("Area: ", CStateManager::GetInstance()->GetWindowWidth() - 180, 65, 0.75);
- CStateManager::GetInstance()->m_cBitmapFont.Draw(buffer, CStateManager::GetInstance()->GetWindowWidth() - 40, 55, 0.75);
- _itoa_s((int)(CStateManager::GetInstance()->GetEntityManager()->GetPlayer()->GetLevelEditorWave()), buffer, 10);
- CStateManager::GetInstance()->m_cBitmapFont.Draw("Wave: ", CStateManager::GetInstance()->GetWindowWidth() - 180, 95, 0.75);
- CStateManager::GetInstance()->m_cBitmapFont.Draw(buffer, CStateManager::GetInstance()->GetWindowWidth() - 40, 95, 0.75);
- _itoa_s((int)(pGPState->GetCurrSub()), buffer, 10);
- CStateManager::GetInstance()->m_cBitmapFont.Draw("Sub: ", CStateManager::GetInstance()->GetWindowWidth() - 180, 125, 0.75);
- CStateManager::GetInstance()->m_cBitmapFont.Draw(buffer, CStateManager::GetInstance()->GetWindowWidth() - 40, 125, 0.75);
- }
- void CUIManager::OptionsRender(void)
- {
- CStateManager::GetInstance()->m_cBitmapFont.SetColor(XMFLOAT4(0.0f, 0.0f, 0.0f, 1.0f));
- for (unsigned int i = 0; i < m_tCurrentButton->m_tButtonNames.size(); i++)
- {
- CStateManager::GetInstance()->m_cBitmapFont.Draw(m_tCurrentButton->m_tButtonNames[i].m_szLabel.c_str(), (int)m_tCurrentButton->m_tButtonNames[i].m_tTexPos.x, (int)m_tCurrentButton->m_tButtonNames[i].m_tTexPos.y, m_tCurrentButton->m_tButtonNames[i].m_fScale);
- }
- CStateManager::GetInstance()->m_cBitmapFont.SetColor(XMFLOAT4(1.0f, 1.0f, 1.0f, 1.0f));
- if(m_tCurrentButton->m_nButtonNum == OPT_VIDEO)
- {
- if(CStateManager::GetInstance()->GetWindowWidth() == 1024)
- {
- CStateManager::GetInstance()->m_cBitmapFont.Draw("1024x768",(int)(m_tCurrentButton->m_tAttachedButtons[VID_RES_ONE]->m_tClickArea.right + m_tCurrentButton->m_tAttachedButtons[VID_RES_ONE]->m_tPos.x + 20), (int)m_tCurrentButton->m_tAttachedButtons[VID_RES_ONE]->m_tPos.y, 0.35f);
- }
- else
- {
- CStateManager::GetInstance()->m_cBitmapFont.Draw("1920x1080",(int)(m_tCurrentButton->m_tAttachedButtons[VID_RES_ONE]->m_tClickArea.right + m_tCurrentButton->m_tAttachedButtons[VID_RES_ONE]->m_tPos.x + 35), (int)m_tCurrentButton->m_tAttachedButtons[VID_RES_ONE]->m_tPos.y, 0.6f);
- }
- }
- if(m_tCurrentButton->m_nButtonNum == OPT_CONTROLS)
- m_tCurrentButton->m_cBackgroundImg.SetDiffuseTexture(CStateManager::GetInstance()->GetAssetManagerHandle()->tUI[STATE_OPTIONS]->m_tImages[UI_CON]);
- else if(m_tCurrentButton->m_nButtonNum == OPT_AUDIO)
- m_tCurrentButton->m_cBackgroundImg.SetDiffuseTexture(CStateManager::GetInstance()->GetAssetManagerHandle()->tUI[STATE_OPTIONS]->m_tImages[UI_AUD]);
- else if(m_tCurrentButton->m_nButtonNum == OPT_VIDEO)
- m_tCurrentButton->m_cBackgroundImg.SetDiffuseTexture(CStateManager::GetInstance()->GetAssetManagerHandle()->tUI[STATE_OPTIONS]->m_tImages[UI_VID]);
- for (unsigned int i = 0; i < m_tCurrentButton->m_tAttachedButtons.size(); i++)
- {
- if(m_tCurrentButton->m_tAttachedButtons[i]->m_nParentButton == m_tCurrentButton->m_nButtonNum)
- {
- if(CStateManager::GetInstance()->GetIsFullscreen())
- {
- if(m_tCurrentButton->m_tAttachedButtons[i]->m_nButtonNum != VID_FS_OFF)
- m_tCurrentButton->m_tAttachedButtons[i]->m_cButtonImg.Render();
- }
- else
- {
- if(m_tCurrentButton->m_tAttachedButtons[i]->m_nButtonNum != VID_FS_ON)
- m_tCurrentButton->m_tAttachedButtons[i]->m_cButtonImg.Render();
- }
- }
- }
- m_tCurrentButton->m_cButtonImg.Render();
- m_tCurrentButton->m_cBackgroundImg.Render();
- }
- void CUIManager::BaseRender(tButton* tRender)
- {
- CStateManager::GetInstance()->m_cBitmapFont.SetColor(XMFLOAT4(0.0f, 0.0f, 0.0f, 1.0f));
- for (unsigned int i = 0; i < tRender->m_tButtonNames.size(); i++)
- {
- CStateManager::GetInstance()->m_cBitmapFont.Draw(tRender->m_tButtonNames[i].m_szLabel.c_str(), (int)tRender->m_tButtonNames[i].m_tTexPos.x, (int)tRender->m_tButtonNames[i].m_tTexPos.y, tRender->m_tButtonNames[i].m_fScale);
- }
- CStateManager::GetInstance()->m_cBitmapFont.SetColor(XMFLOAT4(1.0f, 1.0f, 1.0f, 1.0f));
- tRender->m_cButtonImg.Render();
- tRender->m_cBackgroundImg.Render();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement