mirror of
https://github.com/glest/glest-source.git
synced 2025-02-24 11:42:31 +01:00
- 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) :
|
||||
GraphicComponent(containerName, objName){
|
||||
header= "";
|
||||
autoWordWrap=true;
|
||||
}
|
||||
|
||||
GraphicMessageBox::~GraphicMessageBox(){
|
||||
|
@ -276,6 +276,7 @@ public:
|
||||
private:
|
||||
GraphicButtons buttons;
|
||||
string header;
|
||||
bool autoWordWrap;
|
||||
|
||||
private:
|
||||
void alignButtons();
|
||||
@ -288,6 +289,9 @@ public:
|
||||
void removeButtons();
|
||||
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();}
|
||||
GraphicButton *getButton(int index) {return buttons[index];}
|
||||
string getHeader() const {return header;}
|
||||
|
@ -408,6 +408,7 @@ void ScriptManager::init(World* world, GameCamera *gameCamera, const XmlNode *ro
|
||||
//setup message box
|
||||
messageBox.init( Lang::getInstance().get("Ok") );
|
||||
messageBox.setEnabled(false);
|
||||
messageBox.setAutoWordWrap(false);
|
||||
|
||||
//last created unit
|
||||
lastCreatedUnitId= -1;
|
||||
|
@ -3531,11 +3531,13 @@ void Renderer::renderMessageBox(GraphicMessageBox *messageBox) {
|
||||
}
|
||||
|
||||
string wrappedText = messageBox->getText();
|
||||
if(renderText3DEnabled == false) {
|
||||
wrappedText = messageBox->getFont()->getMetrics()->wordWrapText(wrappedText,messageBox->getW() * 0.90);
|
||||
}
|
||||
else {
|
||||
wrappedText = messageBox->getFont3D()->getMetrics()->wordWrapText(wrappedText,messageBox->getW() * 0.90);
|
||||
if(messageBox->getAutoWordWrap() == true) {
|
||||
if(renderText3DEnabled == false) {
|
||||
wrappedText = messageBox->getFont()->getMetrics()->wordWrapText(wrappedText,messageBox->getW() * 0.90);
|
||||
}
|
||||
else {
|
||||
wrappedText = messageBox->getFont3D()->getMetrics()->wordWrapText(wrappedText,messageBox->getW() * 0.90);
|
||||
}
|
||||
}
|
||||
|
||||
//background
|
||||
|
Loading…
x
Reference in New Issue
Block a user