- allow overriding text colors
This commit is contained in:
parent
35b917106c
commit
dcc615d427
|
@ -35,6 +35,8 @@ float GraphicComponent::anim= 0.f;
|
||||||
float GraphicComponent::fade= 0.f;
|
float GraphicComponent::fade= 0.f;
|
||||||
const float GraphicComponent::animSpeed= 0.02f;
|
const float GraphicComponent::animSpeed= 0.02f;
|
||||||
const float GraphicComponent::fadeSpeed= 0.01f;
|
const float GraphicComponent::fadeSpeed= 0.01f;
|
||||||
|
// WHITE
|
||||||
|
Vec3f GraphicComponent::customTextColor = Vec3f(1.0,1.0,1.0);
|
||||||
|
|
||||||
std::map<std::string, std::map<std::string, GraphicComponent *> > GraphicComponent::registeredGraphicComponentList;
|
std::map<std::string, std::map<std::string, GraphicComponent *> > GraphicComponent::registeredGraphicComponentList;
|
||||||
|
|
||||||
|
|
|
@ -62,6 +62,7 @@ protected:
|
||||||
|
|
||||||
static float anim;
|
static float anim;
|
||||||
static float fade;
|
static float fade;
|
||||||
|
static Vec3f customTextColor;
|
||||||
|
|
||||||
string instanceName;
|
string instanceName;
|
||||||
|
|
||||||
|
@ -69,6 +70,9 @@ public:
|
||||||
GraphicComponent(std::string containerName="", std::string objName="");
|
GraphicComponent(std::string containerName="", std::string objName="");
|
||||||
virtual ~GraphicComponent(){}
|
virtual ~GraphicComponent(){}
|
||||||
|
|
||||||
|
static void setCustomTextColor(Vec3f value) { customTextColor = value; }
|
||||||
|
static Vec3f getCustomTextColor() { return customTextColor; }
|
||||||
|
|
||||||
static void clearRegisteredComponents(std::string containerName="");
|
static void clearRegisteredComponents(std::string containerName="");
|
||||||
static void clearRegisterGraphicComponent(std::string containerName, std::string objName);
|
static void clearRegisterGraphicComponent(std::string containerName, std::string objName);
|
||||||
static void clearRegisterGraphicComponent(std::string containerName, std::vector<std::string> objNameList);
|
static void clearRegisterGraphicComponent(std::string containerName, std::vector<std::string> objNameList);
|
||||||
|
@ -138,7 +142,7 @@ private:
|
||||||
|
|
||||||
public:
|
public:
|
||||||
GraphicLabel();
|
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;}
|
bool getCentered() const {return centered;}
|
||||||
void setCentered(bool centered) {this->centered= centered;}
|
void setCentered(bool centered) {this->centered= centered;}
|
||||||
|
@ -206,7 +210,7 @@ private:
|
||||||
|
|
||||||
public:
|
public:
|
||||||
GraphicListBox(std::string containerName="", std::string objName="");
|
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();}
|
int getItemCount() const {return items.size();}
|
||||||
string getItem(int index) const {return items[index];}
|
string getItem(int index) const {return items[index];}
|
||||||
|
|
|
@ -2826,14 +2826,14 @@ void Renderer::renderButton(GraphicButton *button, const Vec4f *fontColorOverrid
|
||||||
}
|
}
|
||||||
|
|
||||||
//button
|
//button
|
||||||
Vec4f fontColor;
|
Vec4f fontColor(GraphicComponent::getCustomTextColor());
|
||||||
|
|
||||||
if(fontColorOverride != NULL) {
|
if(fontColorOverride != NULL) {
|
||||||
fontColor= *fontColorOverride;
|
fontColor= *fontColorOverride;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// white shadowed is default ( in the menu for example )
|
// 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());
|
//Vec4f color= Vec4f(1.f, 1.f, 1.f, GraphicComponent::getFade());
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// This file is part of Glest (www.glest.org)
|
// This file is part of Glest (www.glest.org)
|
||||||
//
|
//
|
||||||
// Copyright (C) 2001-2008 Martiño Figueroa
|
// Copyright (C) 2001-2008 Marti<EFBFBD>o Figueroa
|
||||||
//
|
//
|
||||||
// You can redistribute this code and/or modify it under
|
// You can redistribute this code and/or modify it under
|
||||||
// the terms of the GNU General Public License as published
|
// 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");
|
UPNP_Tools::isUPNP = !config.getBool("DisableUPNP","false");
|
||||||
Texture::useTextureCompression = config.getBool("EnableTextureCompression","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
|
// 256 for English
|
||||||
// 30000 for Chinese
|
// 30000 for Chinese
|
||||||
Font::charCount = config.getInt("FONT_CHARCOUNT",intToStr(Font::charCount).c_str());
|
Font::charCount = config.getInt("FONT_CHARCOUNT",intToStr(Font::charCount).c_str());
|
||||||
|
|
Loading…
Reference in New Issue
Block a user