- fixed messagebox word wrap with lua messages
This commit is contained in:
parent
16b85dbe79
commit
b178b1d1e9
|
@ -538,6 +538,7 @@ const int GraphicMessageBox::defW= 350;
|
||||||
GraphicMessageBox::GraphicMessageBox(std::string containerName, std::string objName) :
|
GraphicMessageBox::GraphicMessageBox(std::string containerName, std::string objName) :
|
||||||
GraphicComponent(containerName, objName){
|
GraphicComponent(containerName, objName){
|
||||||
header= "";
|
header= "";
|
||||||
|
autoWordWrap=true;
|
||||||
}
|
}
|
||||||
|
|
||||||
GraphicMessageBox::~GraphicMessageBox(){
|
GraphicMessageBox::~GraphicMessageBox(){
|
||||||
|
|
|
@ -276,6 +276,7 @@ public:
|
||||||
private:
|
private:
|
||||||
GraphicButtons buttons;
|
GraphicButtons buttons;
|
||||||
string header;
|
string header;
|
||||||
|
bool autoWordWrap;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void alignButtons();
|
void alignButtons();
|
||||||
|
@ -288,6 +289,9 @@ public:
|
||||||
void removeButtons();
|
void removeButtons();
|
||||||
void addButton(const string &buttonStr, int width=-1,int height=-1);
|
void addButton(const string &buttonStr, int width=-1,int height=-1);
|
||||||
|
|
||||||
|
bool getAutoWordWrap() const { return autoWordWrap; }
|
||||||
|
void setAutoWordWrap(bool value) { autoWordWrap = value; }
|
||||||
|
|
||||||
int getButtonCount() const {return buttons.size();}
|
int getButtonCount() const {return buttons.size();}
|
||||||
GraphicButton *getButton(int index) {return buttons[index];}
|
GraphicButton *getButton(int index) {return buttons[index];}
|
||||||
string getHeader() const {return header;}
|
string getHeader() const {return header;}
|
||||||
|
|
|
@ -408,6 +408,7 @@ void ScriptManager::init(World* world, GameCamera *gameCamera, const XmlNode *ro
|
||||||
//setup message box
|
//setup message box
|
||||||
messageBox.init( Lang::getInstance().get("Ok") );
|
messageBox.init( Lang::getInstance().get("Ok") );
|
||||||
messageBox.setEnabled(false);
|
messageBox.setEnabled(false);
|
||||||
|
messageBox.setAutoWordWrap(false);
|
||||||
|
|
||||||
//last created unit
|
//last created unit
|
||||||
lastCreatedUnitId= -1;
|
lastCreatedUnitId= -1;
|
||||||
|
|
|
@ -3531,11 +3531,13 @@ void Renderer::renderMessageBox(GraphicMessageBox *messageBox) {
|
||||||
}
|
}
|
||||||
|
|
||||||
string wrappedText = messageBox->getText();
|
string wrappedText = messageBox->getText();
|
||||||
if(renderText3DEnabled == false) {
|
if(messageBox->getAutoWordWrap() == true) {
|
||||||
wrappedText = messageBox->getFont()->getMetrics()->wordWrapText(wrappedText,messageBox->getW() * 0.90);
|
if(renderText3DEnabled == false) {
|
||||||
}
|
wrappedText = messageBox->getFont()->getMetrics()->wordWrapText(wrappedText,messageBox->getW() * 0.90);
|
||||||
else {
|
}
|
||||||
wrappedText = messageBox->getFont3D()->getMetrics()->wordWrapText(wrappedText,messageBox->getW() * 0.90);
|
else {
|
||||||
|
wrappedText = messageBox->getFont3D()->getMetrics()->wordWrapText(wrappedText,messageBox->getW() * 0.90);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//background
|
//background
|
||||||
|
|
Loading…
Reference in New Issue
Block a user