diff --git a/source/glest_game/facilities/components.cpp b/source/glest_game/facilities/components.cpp index bb48c2bb..508fdd64 100644 --- a/source/glest_game/facilities/components.cpp +++ b/source/glest_game/facilities/components.cpp @@ -282,6 +282,7 @@ GraphicLabel::GraphicLabel() { maxEditWidth = -1; maxEditRenderWidth = -1; isPassword = false; + texture = NULL; } void GraphicLabel::init(int x, int y, int w, int h, bool centered, Vec3f textColor, bool wordWrap) { diff --git a/source/glest_game/facilities/components.h b/source/glest_game/facilities/components.h index 64ea46f4..f57b3af1 100644 --- a/source/glest_game/facilities/components.h +++ b/source/glest_game/facilities/components.h @@ -149,6 +149,7 @@ private: vector textCharLength; bool isPassword; + Texture2D *texture; public: GraphicLabel(); @@ -189,6 +190,8 @@ public: void setMaxEditRenderWidth(int value) { maxEditRenderWidth = value; } int getMaxEditRenderWidth() const { return maxEditRenderWidth; } + void setTexture(Texture2D *value) { texture = value; } + Texture2D *getTexture() const { return texture; } }; // =========================================================== diff --git a/source/glest_game/global/core_data.cpp b/source/glest_game/global/core_data.cpp index 0e01e017..01a77f52 100644 --- a/source/glest_game/global/core_data.cpp +++ b/source/glest_game/global/core_data.cpp @@ -157,6 +157,15 @@ Texture2D *CoreData::getTextureBySystemId(TextureSystemType type) const { case tsyst_onServerInstalledTexture: result = onServerInstalledTexture; break; + case tsyst_statusReadyTexture: + result = statusReadyTexture; + break; + case tsyst_statusNotReadyTexture: + result = statusNotReadyTexture; + break; + case tsyst_statusBRBTexture: + result = statusBRBTexture; + break; //std::vector miscTextureList; } @@ -207,6 +216,24 @@ void CoreData::load() { snowTexture->setTextureSystemId(tsyst_snowTexture); } + statusReadyTexture= renderer.newTexture2D(rsGlobal); + if(statusReadyTexture) { + statusReadyTexture->getPixmap()->load(getGameCustomCoreDataPath(data_path, "data/core/menu/textures/status_ready.png")); + statusReadyTexture->setTextureSystemId(tsyst_statusReadyTexture); + } + + statusNotReadyTexture= renderer.newTexture2D(rsGlobal); + if(statusNotReadyTexture) { + statusNotReadyTexture->getPixmap()->load(getGameCustomCoreDataPath(data_path, "data/core/menu/textures/status_notready.png")); + statusNotReadyTexture->setTextureSystemId(tsyst_statusNotReadyTexture); + } + + statusBRBTexture= renderer.newTexture2D(rsGlobal); + if(statusBRBTexture) { + statusBRBTexture->getPixmap()->load(getGameCustomCoreDataPath(data_path, "data/core/menu/textures/status_brb.png")); + statusBRBTexture->setTextureSystemId(tsyst_statusBRBTexture); + } + customTexture= renderer.newTexture2D(rsGlobal); if(customTexture) { customTexture->getPixmap()->load(getGameCustomCoreDataPath(data_path, "data/core/menu/textures/custom_texture.tga")); diff --git a/source/glest_game/global/core_data.h b/source/glest_game/global/core_data.h index e099c197..bb903552 100644 --- a/source/glest_game/global/core_data.h +++ b/source/glest_game/global/core_data.h @@ -72,6 +72,9 @@ private: Texture2D *onServerDifferentTexture; Texture2D *onServerTexture; Texture2D *onServerInstalledTexture; + Texture2D *statusReadyTexture; + Texture2D *statusNotReadyTexture; + Texture2D *statusBRBTexture; std::vector miscTextureList; @@ -125,7 +128,10 @@ public: tsyst_notOnServerTexture, tsyst_onServerDifferentTexture, tsyst_onServerTexture, - tsyst_onServerInstalledTexture + tsyst_onServerInstalledTexture, + tsyst_statusReadyTexture, + tsyst_statusNotReadyTexture, + tsyst_statusBRBTexture //std::vector miscTextureList; }; @@ -158,6 +164,9 @@ public: Texture2D *getOnServerDifferentTexture() const {return onServerDifferentTexture;} Texture2D *getOnServerTexture() const {return onServerTexture;} Texture2D *getOnServerInstalledTexture() const {return onServerInstalledTexture;} + Texture2D *getStatusReadyTexture() const {return statusReadyTexture;} + Texture2D *getStatusNotReadyTexture() const {return statusNotReadyTexture;} + Texture2D *getStatusBRBTexture() const {return statusBRBTexture;} Texture2D *getGameWinnerTexture() const {return gameWinnerTexture;} diff --git a/source/glest_game/graphics/renderer.cpp b/source/glest_game/graphics/renderer.cpp index d7747140..e8523bda 100644 --- a/source/glest_game/graphics/renderer.cpp +++ b/source/glest_game/graphics/renderer.cpp @@ -2886,7 +2886,36 @@ void Renderer::renderLabel(GraphicLabel *label) { } } + if(label->getTexture()!=NULL ) + { + int x= label->getX(); + int y= label->getY(); + int h= label->getH(); + int w= label->getW(); + if(h>0){ + //background + glPushAttrib(GL_ENABLE_BIT | GL_CURRENT_BIT); + glEnable(GL_BLEND); + glEnable(GL_TEXTURE_2D); + glBindTexture(GL_TEXTURE_2D, static_cast( label->getTexture())->getHandle()); + glColor4f(1.0f, 1.0f, 1.0f, 1.0f*label->getFade()) ; + glBegin(GL_TRIANGLE_STRIP); + glTexCoord2f(0.f, 0.f); + glVertex2f(x, y); + glTexCoord2f(0.f, 1.f); + glVertex2f(x, y+h); + + glTexCoord2f(1.f, 0.f); + glVertex2f(x+w, y); + + glTexCoord2f(1.f, 1.f); + glVertex2f(x+w, y+h); + glEnd(); + glDisable(GL_TEXTURE_2D); + glPopAttrib(); + } + } Vec3f labelColor=label->getTextColor(); Vec4f colorWithAlpha = Vec4f(labelColor.x,labelColor.y,labelColor.z,GraphicComponent::getFade()); renderLabel(label,&colorWithAlpha); diff --git a/source/glest_game/menu/menu_state_connected_game.cpp b/source/glest_game/menu/menu_state_connected_game.cpp index e2714564..df1371bd 100644 --- a/source/glest_game/menu/menu_state_connected_game.cpp +++ b/source/glest_game/menu/menu_state_connected_game.cpp @@ -298,7 +298,7 @@ MenuStateConnectedGame::MenuStateConnectedGame(Program *program, MainMenu *mainM if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__); - xoffset=40; + xoffset=30; int rowHeight=27; for(int i=0; i"); } labelControl.registerGraphicComponent(containerName,"labelControl"); - labelControl.init(xoffset+160, setupPos, GraphicListBox::defW, GraphicListBox::defH, true); + labelControl.init(xoffset+170, setupPos, GraphicListBox::defW, GraphicListBox::defH, true); labelControl.setText(lang.get("Control")); labelRMultiplier.registerGraphicComponent(containerName,"labelRMultiplier"); - labelRMultiplier.init(xoffset+300, setupPos, GraphicListBox::defW, GraphicListBox::defH, true); + labelRMultiplier.init(xoffset+310, setupPos, GraphicListBox::defW, GraphicListBox::defH, true); labelFaction.registerGraphicComponent(containerName,"labelFaction"); - labelFaction.init(xoffset+380, setupPos, GraphicListBox::defW, GraphicListBox::defH, true); + labelFaction.init(xoffset+390, setupPos, GraphicListBox::defW, GraphicListBox::defH, true); labelFaction.setText(lang.get("Faction")); labelTeam.registerGraphicComponent(containerName,"labelTeam"); - labelTeam.init(xoffset+640, setupPos, 60, GraphicListBox::defH, true); + labelTeam.init(xoffset+650, setupPos, 60, GraphicListBox::defH, true); labelTeam.setText(lang.get("Team")); labelControl.setFont(CoreData::getInstance().getMenuFontBig()); @@ -390,8 +390,11 @@ MenuStateConnectedGame::MenuStateConnectedGame(Program *program, MainMenu *mainM for(int i=0; igetFactionControl(i) == ctHuman) { switch(gameSettings->getNetworkPlayerStatuses(i)) { case npst_BeRightBack: - labelPlayerStatus[slot].setText("#"); - labelPlayerStatus[slot].setTextColor(Vec3f(1.f, 0.8f, 0.f)); + labelPlayerStatus[slot].setTexture(CoreData::getInstance().getStatusBRBTexture()); break; case npst_Ready: - labelPlayerStatus[slot].setText("#"); - labelPlayerStatus[slot].setTextColor(Vec3f(0.f, 1.f, 0.f)); + labelPlayerStatus[slot].setTexture(CoreData::getInstance().getStatusReadyTexture()); break; case npst_PickSettings: - labelPlayerStatus[slot].setText("#"); - labelPlayerStatus[slot].setTextColor(Vec3f(1.f, 0.f, 0.f)); + labelPlayerStatus[slot].setTexture(CoreData::getInstance().getStatusNotReadyTexture()); break; case npst_Disconnected: - labelPlayerStatus[slot].setText(lang.get("-")); + labelPlayerStatus[slot].setTexture(NULL); break; default: - labelPlayerStatus[slot].setText(""); + labelPlayerStatus[slot].setTexture(NULL); break; } } diff --git a/source/glest_game/menu/menu_state_custom_game.cpp b/source/glest_game/menu/menu_state_custom_game.cpp index aaed1f88..92ad4d7c 100644 --- a/source/glest_game/menu/menu_state_custom_game.cpp +++ b/source/glest_game/menu/menu_state_custom_game.cpp @@ -469,7 +469,7 @@ MenuStateCustomGame::MenuStateCustomGame(Program *program, MainMenu *mainMenu, checkBoxNetworkPauseGameForLaggedClients.setValue(true); //list boxes - xoffset=40; + xoffset=30; int rowHeight=27; for(int i=0; igetSlot(i)->getNetworkPlayerStatus()) { case npst_BeRightBack: - labelPlayerStatus[i].setText("#"); - labelPlayerStatus[i].setTextColor(Vec3f(1.f, 0.8f, 0.f)); - labelPlayerNames[i].setTextColor(Vec3f(1.f, 0.8f, 0.f)); + labelPlayerStatus[i].setTexture(CoreData::getInstance().getStatusBRBTexture()); break; case npst_Ready: - labelPlayerStatus[i].setText("#"); - labelPlayerStatus[i].setTextColor(Vec3f(0.f, 1.f, 0.f)); - labelPlayerNames[i].setTextColor(Vec3f(0.f, 1.f, 0.f)); + labelPlayerStatus[i].setTexture(CoreData::getInstance().getStatusReadyTexture()); break; case npst_PickSettings: default: - labelPlayerStatus[i].setText("#"); - labelPlayerStatus[i].setTextColor(Vec3f(1.f, 0.f, 0.f)); - labelPlayerNames[i].setTextColor(Vec3f(1.f, 0.f, 0.f)); + labelPlayerStatus[i].setTexture(CoreData::getInstance().getStatusNotReadyTexture()); break; } }