diff --git a/source/glest_game/facilities/components.cpp b/source/glest_game/facilities/components.cpp index 65534539..8f3d4cc4 100644 --- a/source/glest_game/facilities/components.cpp +++ b/source/glest_game/facilities/components.cpp @@ -35,6 +35,8 @@ float GraphicComponent::anim= 0.f; float GraphicComponent::fade= 0.f; const float GraphicComponent::animSpeed= 0.02f; const float GraphicComponent::fadeSpeed= 0.01f; +// WHITE +Vec3f GraphicComponent::customTextColor = Vec3f(1.0,1.0,1.0); std::map > GraphicComponent::registeredGraphicComponentList; diff --git a/source/glest_game/facilities/components.h b/source/glest_game/facilities/components.h index 1be0da55..26377178 100644 --- a/source/glest_game/facilities/components.h +++ b/source/glest_game/facilities/components.h @@ -62,6 +62,7 @@ protected: static float anim; static float fade; + static Vec3f customTextColor; string instanceName; @@ -69,6 +70,9 @@ public: GraphicComponent(std::string containerName="", std::string objName=""); virtual ~GraphicComponent(){} + static void setCustomTextColor(Vec3f value) { customTextColor = value; } + static Vec3f getCustomTextColor() { return customTextColor; } + static void clearRegisteredComponents(std::string containerName=""); static void clearRegisterGraphicComponent(std::string containerName, std::string objName); static void clearRegisterGraphicComponent(std::string containerName, std::vector objNameList); @@ -138,7 +142,7 @@ private: public: GraphicLabel(); - void init(int x, int y, int w=defW, int h=defH, bool centered= false, Vec3f textColor=Vec3f(1.f, 1.f, 1.f), bool wordWrap=false); + void init(int x, int y, int w=defW, int h=defH, bool centered= false, Vec3f textColor=GraphicComponent::customTextColor, bool wordWrap=false); bool getCentered() const {return centered;} void setCentered(bool centered) {this->centered= centered;} @@ -206,7 +210,7 @@ private: public: GraphicListBox(std::string containerName="", std::string objName=""); - void init(int x, int y, int w=defW, int h=defH, Vec3f textColor=Vec3f(1.f, 1.f, 1.f)); + void init(int x, int y, int w=defW, int h=defH, Vec3f textColor=GraphicComponent::customTextColor); int getItemCount() const {return items.size();} string getItem(int index) const {return items[index];} diff --git a/source/glest_game/graphics/renderer.cpp b/source/glest_game/graphics/renderer.cpp index c4a7c6b8..8e794e6c 100644 --- a/source/glest_game/graphics/renderer.cpp +++ b/source/glest_game/graphics/renderer.cpp @@ -2826,14 +2826,14 @@ void Renderer::renderButton(GraphicButton *button, const Vec4f *fontColorOverrid } //button - Vec4f fontColor; + Vec4f fontColor(GraphicComponent::getCustomTextColor()); if(fontColorOverride != NULL) { fontColor= *fontColorOverride; } else { // white shadowed is default ( in the menu for example ) - fontColor=Vec4f(1.f, 1.f, 1.f, GraphicComponent::getFade()); + fontColor.w = GraphicComponent::getFade(); } //Vec4f color= Vec4f(1.f, 1.f, 1.f, GraphicComponent::getFade()); diff --git a/source/glest_game/main/main.cpp b/source/glest_game/main/main.cpp index 7597228a..0f842ebc 100644 --- a/source/glest_game/main/main.cpp +++ b/source/glest_game/main/main.cpp @@ -1,6 +1,6 @@ // This file is part of Glest (www.glest.org) // -// Copyright (C) 2001-2008 Martiño Figueroa +// Copyright (C) 2001-2008 Marti�o Figueroa // // You can redistribute this code and/or modify it under // the terms of the GNU General Public License as published @@ -3361,6 +3361,12 @@ int glestMain(int argc, char** argv) { UPNP_Tools::isUPNP = !config.getBool("DisableUPNP","false"); Texture::useTextureCompression = config.getBool("EnableTextureCompression","false"); + if(config.getString("CustomMenuTextColor","") != "") { + string customMenuTextColor = config.getString("CustomMenuTextColor"); + Vec3f customTextColor = Vec3f::strToVec3(customMenuTextColor); + GraphicComponent::setCustomTextColor(customTextColor); + } + // 256 for English // 30000 for Chinese Font::charCount = config.getInt("FONT_CHARCOUNT",intToStr(Font::charCount).c_str());