GLWScorchedInfo.cpp

Go to the documentation of this file.
00001 ////////////////////////////////////////////////////////////////////////////////
00002 //    Scorched3D (c) 2000-2009
00003 //
00004 //    This file is part of Scorched3D.
00005 //
00006 //    Scorched3D is free software; you can redistribute it and/or modify
00007 //    it under the terms of the GNU General Public License as published by
00008 //    the Free Software Foundation; either version 2 of the License, or
00009 //    (at your option) any later version.
00010 //
00011 //    Scorched3D is distributed in the hope that it will be useful,
00012 //    but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014 //    GNU General Public License for more details.
00015 //
00016 //    You should have received a copy of the GNU General Public License
00017 //    along with Scorched3D; if not, write to the Free Software
00018 //    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019 ////////////////////////////////////////////////////////////////////////////////
00020 
00021 #include <GLW/GLWScorchedInfo.h>
00022 #include <GLW/GLWFont.h>
00023 #include <GLW/GLWTranslate.h>
00024 #include <GLW/GLWWindView.h>
00025 #include <client/ScorchedClient.h>
00026 #include <tankgraph/TargetRendererImplTank.h>
00027 #include <tank/TankContainer.h>
00028 #include <tank/TankState.h>
00029 #include <tank/TankAvatar.h>
00030 #include <tank/TankScore.h>
00031 #include <tank/TankAccessories.h>
00032 #include <tank/TankPosition.h>
00033 #include <target/TargetParachute.h>
00034 #include <target/TargetLife.h>
00035 #include <target/TargetShield.h>
00036 #include <common/OptionsTransient.h>
00037 #include <common/Defines.h>
00038 #include <weapons/AccessoryStore.h>
00039 #include <lang/CachedValueString.h>
00040 #include <lang/LangResource.h>
00041 
00042 REGISTER_CLASS_SOURCE(GLWHudCondition);
00043 
00044 GLWHudCondition::GLWHudCondition()
00045 {
00046 }
00047 
00048 GLWHudCondition::~GLWHudCondition()
00049 {
00050 }
00051 
00052 bool GLWHudCondition::getResult(GLWidget *widget)
00053 {
00054         return TargetRendererImplTankHUD::drawText();
00055 }
00056 
00057 REGISTER_CLASS_SOURCE(GLWScorchedInfo);
00058 
00059 GLWScorchedInfo::GLWScorchedInfo(float x, float y, float w, float h) : 
00060         GLWidget(x, y, w, h), infoType_(eNone), noCenter_(false)
00061 {
00062 
00063 }
00064 
00065 GLWScorchedInfo::~GLWScorchedInfo()
00066 {
00067 
00068 }
00069 
00070 void GLWScorchedInfo::draw()
00071 {
00072         LANG_RESOURCE_CONST_VAR(ON, "ON", "On");
00073         LANG_RESOURCE_CONST_VAR(OFF, "OFF", "Off");
00074 
00075         Vector *fontColor = &fontColor_;
00076         int mouseX = ScorchedClient::instance()->getGameState().getMouseX();
00077         int mouseY = ScorchedClient::instance()->getGameState().getMouseY();
00078         if (inBox((float) mouseX - GLWTranslate::getPosX(), 
00079                 (float) mouseY - GLWTranslate::getPosY(), x_, y_, w_, h_))
00080         {
00081                 fontColor = &selectedColor_;
00082         }
00083 
00084         GLWidget::draw();
00085         
00086         GLState state(GLState::TEXTURE_ON | GLState::DEPTH_OFF);
00087         
00088         // Items not relating to the current player
00089         switch(infoType_)
00090         {
00091                 case eWind:
00092                 {
00093                         static WindDialogToolTip windTip;
00094                         setToolTip(&windTip);
00095 
00096                         static CachedValueString windSpeed;
00097                         if (windSpeed.hasChanged(ScorchedClient::instance()->
00098                                 getOptionsTransient().getWindSpeed()))
00099                         {
00100                                 if (windSpeed.cachedValue == 0)
00101                                 {
00102                                         windSpeed.cachedString = LANG_RESOURCE("NO_WIND", "No Wind");
00103                                 }
00104                                 else
00105                                 {
00106                                         windSpeed.cachedString = LANG_RESOURCE_1("WIND_FORCE", "Force {0}",
00107                                                 S3D::formatStringBuffer("%.0f", windSpeed.cachedValue.asFloat()));
00108                                 }
00109                         }
00110 
00111                         float offSet = 0.0f;
00112                         if (!noCenter_) 
00113                         {
00114                                 float windwidth = GLWFont::instance()->
00115                                         getGameFont()->getWidth(
00116                                         fontSize_, windSpeed.cachedString);
00117                                 offSet = w_ / 2.0f - (windwidth / 2.0f);
00118                         }
00119                         GLWFont::instance()->getGameFont()->draw(
00120                                 *fontColor, fontSize_,
00121                                 x_ + offSet, y_, 0.0f,
00122                                 windSpeed.cachedString);                    
00123                 }
00124                 break;
00125         }
00126         
00127         // Get the current tank and model
00128         Tank *current = 
00129                 ScorchedClient::instance()->getTankContainer().getCurrentTank();
00130         if (!current ||
00131                 current->getState().getState() != TankState::sNormal)
00132         {
00133                 return;
00134         }
00135         TargetRendererImplTank *renderer = (TargetRendererImplTank *) 
00136                 current->getRenderer();
00137         if (!renderer) return;
00138 
00139         // Items relating to the current player
00140         switch (infoType_)
00141         {
00142                 case ePlayerName:
00143                 {
00144                         setToolTip(&renderer->getTips()->nameTip);
00145 
00146                         float offSet = 0.0f;
00147                         if (!noCenter_) 
00148                         {
00149                                 float namewidth = GLWFont::instance()->getGameFont()->getWidth(
00150                                         fontSize_, current->getTargetName());
00151                                 offSet = w_ / 2.0f - (namewidth / 2.0f);
00152                         }
00153                         GLWFont::instance()->getGameFont()->draw(
00154                                 current->getColor(), fontSize_,
00155                                 x_ + offSet, y_, 0.0f,
00156                                 current->getTargetName());
00157                 }
00158                 break;
00159                 case ePlayerIcon:
00160                 {
00161                         setToolTip(&renderer->getTips()->nameTip);
00162                         GLState state(GLState::TEXTURE_ON | GLState::BLEND_ON);
00163                         glColor3f((*fontColor)[0], (*fontColor)[1], (*fontColor)[2]);
00164                         current->getAvatar().getTexture()->draw();
00165                         glBegin(GL_QUADS);
00166                                 glTexCoord2f(0.0f, 0.0f);
00167                                 glVertex2f(x_, y_);
00168                                 glTexCoord2f(1.0f, 0.0f);
00169                                 glVertex2f(x_ + w_, y_);
00170                                 glTexCoord2f(1.0f, 1.0f);
00171                                 glVertex2f(x_ + w_, y_ + h_);
00172                                 glTexCoord2f(0.0f, 1.0f);
00173                                 glVertex2f(x_, y_ + h_);
00174                         glEnd();
00175                 }
00176                 break;
00177                 case ePlayerRank:
00178                         setToolTip(&renderer->getTips()->rankTip);
00179                         if (current->getScore().getRank() > -1)
00180                         {
00181                                 GLWFont::instance()->getGameFont()->draw(
00182                                         current->getColor(), fontSize_,
00183                                         x_, y_, 0.0f,
00184                                         S3D::formatStringBuffer("%i", current->getScore().getRank()));
00185                         }
00186                 break;
00187                 case eAutoDefenseCount:
00188                         setToolTip(&renderer->getTips()->autodTip);
00189                         GLWFont::instance()->getGameFont()->draw(
00190                                 *fontColor, fontSize_,
00191                                 x_, y_, 0.0f,
00192                                 (current->getAccessories().getAutoDefense().haveDefense()?ON:OFF));
00193                 break;
00194                 case eParachuteCount:
00195                         setToolTip(&renderer->getTips()->paraTip);
00196                         if (!current->getParachute().getCurrentParachute())
00197                         {
00198                                 GLWFont::instance()->getGameFont()->draw(
00199                                         *fontColor, fontSize_,
00200                                         x_, y_, 0.0f,
00201                                         OFF);
00202                         }
00203                         else
00204                         {
00205                                 static CachedValueString paraCount;
00206                                 if (paraCount.hasChanged(
00207                                         current->getAccessories().getAccessoryCount(
00208                                         current->getParachute().getCurrentParachute())))
00209                                 {
00210                                         paraCount.cachedString = 
00211                                                 current->getAccessories().getAccessoryCountString(
00212                                                         current->getParachute().getCurrentParachute());
00213                                 }
00214                                 GLWFont::instance()->getGameFont()->draw(
00215                                         *fontColor, fontSize_,
00216                                         x_, y_, 0.0f,
00217                                         paraCount.cachedString);
00218                         }
00219                 break;
00220                 case eHealthCount:
00221                         {
00222                                 setToolTip(&renderer->getTips()->healthTip);
00223 
00224                                 static CachedValueString health;
00225                                 if (health.hasChanged(current->getLife().getLife()))
00226                                 {
00227                                         health.cachedString = LANG_STRING(S3D::formatStringBuffer("%.0f", 
00228                                                 health.cachedValue.asFloat()));
00229                                 }
00230                                 GLWFont::instance()->getGameFont()->draw(
00231                                         *fontColor, fontSize_,
00232                                         x_, y_, 0.0f,
00233                                         health.cachedString);
00234                         }
00235                 break;
00236                 case eShieldCount:
00237                         setToolTip(&renderer->getTips()->shieldTip);
00238                         if (!current->getShield().getCurrentShield())
00239                         {
00240                                 GLWFont::instance()->getGameFont()->draw(
00241                                         *fontColor, fontSize_,
00242                                         x_, y_, 0.0f,
00243                                         OFF);
00244                         }
00245                         else
00246                         {
00247                                 static CachedValueString shieldPower;
00248                                 if (shieldPower.hasChanged(current->getShield().getShieldPower()))
00249                                 {
00250                                         shieldPower.cachedString = LANG_STRING(S3D::formatStringBuffer("%.0f", 
00251                                                 shieldPower.cachedValue.asFloat()));
00252                                 }
00253                                 GLWFont::instance()->getGameFont()->draw(
00254                                         *fontColor, fontSize_,
00255                                         x_, y_, 0.0f,
00256                                         shieldPower.cachedString);
00257                         }
00258                 break;
00259                 case eBatteryCount:
00260                         {
00261                                 setToolTip(&renderer->getTips()->batteryTip);
00262 
00263                                 static CachedValueString batteryCount;
00264                                 if (batteryCount.hasChanged(current->getAccessories().getBatteries().getNoBatteries()))
00265                                 {
00266                                         if (batteryCount.cachedValue == -1) 
00267                                                 batteryCount.cachedString = LANG_RESOURCE("INF", "In");
00268                                         else batteryCount.cachedString = 
00269                                                 LANG_STRING(S3D::formatStringBuffer("%i",       batteryCount.cachedValue.asInt()));
00270                                 }
00271                                 GLWFont::instance()->getGameFont()->draw(
00272                                         *fontColor, fontSize_,
00273                                         x_, y_, 0.0f,
00274                                         batteryCount.cachedString);
00275                         }
00276                 break;
00277                 case eFuelCount:
00278                         {
00279                         setToolTip(&renderer->getTips()->fuelTip);
00280 
00281                         Accessory *weapon = current->getAccessories().getWeapons().getCurrent();
00282                         if (!weapon ||
00283                                 weapon->getPositionSelect() != Accessory::ePositionSelectFuel)
00284                         {
00285                                 GLWFont::instance()->getGameFont()->draw(
00286                                         *fontColor, fontSize_,
00287                                         x_, y_, 0.0f,
00288                                         OFF);
00289                         }
00290                         else
00291                         {
00292                                 static CachedValueString weaponCount;
00293                                 if (weaponCount.hasChanged(current->getAccessories().getAccessoryCount(weapon)))
00294                                 {
00295                                         weaponCount.cachedString = 
00296                                                 current->getAccessories().getAccessoryCountString(weapon);
00297                                 }
00298                                 GLWFont::instance()->getGameFont()->draw(
00299                                         *fontColor, fontSize_,
00300                                         x_, y_, 0.0f,
00301                                         weaponCount.cachedString);
00302                         }
00303                         }
00304                 break;
00305                 case eWeaponName:
00306                 {
00307                         Accessory *weapon = current->getAccessories().getWeapons().getCurrent();
00308                         if (!weapon) return;
00309 
00310                         setToolTip(&renderer->getTips()->weaponTip);
00311                         float offSet = 0.0f;
00312                         if (!noCenter_) 
00313                         {
00314                                 float weaponWidth = (float) GLWFont::instance()->getGameFont()->
00315                                         getWidth(fontSize_, weapon->getStringName());
00316                                 offSet = w_ / 2.0f - (weaponWidth / 2.0f);
00317                         }
00318                         GLWFont::instance()->getGameFont()->draw(
00319                                 *fontColor, fontSize_,
00320                                 x_ + offSet, y_, 0.0f,
00321                                 weapon->getStringName());
00322                 }
00323                 break;
00324                 case eWeaponCount:
00325                 {
00326                         Accessory *weapon = current->getAccessories().getWeapons().getCurrent();
00327                         if (!weapon) return;
00328 
00329                         setToolTip(&renderer->getTips()->weaponTip);
00330                         static CachedValueString weaponCount;
00331                         if (weaponCount.hasChanged(current->getAccessories().getAccessoryCount(weapon)))
00332                         {
00333                                 weaponCount.cachedString = current->getAccessories().
00334                                         getAccessoryCountString(weapon);
00335                         }
00336                         GLWFont::instance()->getGameFont()->draw(
00337                                 *fontColor, fontSize_,
00338                                 x_, y_, 0.0f,
00339                                 weaponCount.cachedString);
00340                 }
00341                 break;
00342                 case eWeaponIcon:
00343                 {
00344                         Accessory *weapon = current->getAccessories().getWeapons().getCurrent();
00345                         if (!weapon) return;
00346 
00347                         setToolTip(&renderer->getTips()->weaponTip);
00348 
00349                         GLState state(GLState::TEXTURE_ON | GLState::BLEND_ON);
00350                         glColor3f((*fontColor)[0], (*fontColor)[1], (*fontColor)[2]);
00351                         weapon->getTexture()->draw();
00352                         glBegin(GL_QUADS);
00353                                 glTexCoord2f(0.0f, 0.0f);
00354                                 glVertex2f(x_, y_);
00355                                 glTexCoord2f(1.0f, 0.0f);
00356                                 glVertex2f(x_ + w_, y_);
00357                                 glTexCoord2f(1.0f, 1.0f);
00358                                 glVertex2f(x_ + w_, y_ + h_);
00359                                 glTexCoord2f(0.0f, 1.0f);
00360                                 glVertex2f(x_, y_ + h_);
00361                         glEnd();
00362                 }
00363                 break;
00364                 case eRotation:
00365                         {
00366                                 setToolTip(&renderer->getTips()->rotationTip);
00367                                 static CachedValueString rotationValue;
00368                                 if (rotationValue.hasChanged(current->getPosition().getRotationGunXY()))
00369                                 {
00370                                         rotationValue.cachedString =
00371                                                 LANG_STRING(S3D::formatStringBuffer("%.1f",
00372                                                         360.0f - rotationValue.cachedValue.asFloat()));
00373                                 }
00374                         
00375                                 GLWFont::instance()->getGameFont()->draw(
00376                                         *fontColor, fontSize_,
00377                                         x_, y_, 0.0f,
00378                                         rotationValue.cachedString);
00379                         }
00380                 break;
00381                 case eRotationDiff:
00382                         {
00383                                 static CachedValueString rotationValue;
00384                                 if (rotationValue.hasChanged(current->getPosition().getRotationXYDiff()))
00385                                 {
00386                                         rotationValue.cachedString = 
00387                                                 LANG_STRING(S3D::formatStringBuffer("%+.1f",
00388                                                         rotationValue.cachedValue.asFloat()));
00389                                 }
00390 
00391                                 GLWFont::instance()->getGameFont()->draw(
00392                                         *fontColor, fontSize_,
00393                                         x_, y_, 0.0f,
00394                                         rotationValue.cachedString);
00395                         }
00396                 break;
00397                 case eElevation:
00398                         {
00399                                 setToolTip(&renderer->getTips()->elevationTip);
00400 
00401                                 static CachedValueString elevationValue;
00402                                 if (elevationValue.hasChanged(current->getPosition().getRotationGunYZ()))
00403                                 {
00404                                         elevationValue.cachedString =
00405                                                 LANG_STRING(S3D::formatStringBuffer("%.1f",
00406                                                         elevationValue.cachedValue.asFloat()));
00407 
00408                                 }
00409                                 GLWFont::instance()->getGameFont()->draw(
00410                                         *fontColor, fontSize_,
00411                                         x_, y_, 0.0f,
00412                                         elevationValue.cachedString);
00413                         }
00414                 break;
00415                 case eElevationDiff:
00416                         {
00417                                 static CachedValueString elevationValue;
00418                                 if (elevationValue.hasChanged(current->getPosition().getRotationYZDiff()))
00419                                 {
00420                                         elevationValue.cachedString =
00421                                                 LANG_STRING(S3D::formatStringBuffer("%+.1f",
00422                                                         elevationValue.cachedValue.asFloat()));
00423                                 }
00424                                 GLWFont::instance()->getGameFont()->draw(
00425                                         *fontColor, fontSize_,
00426                                         x_, y_, 0.0f,
00427                                         elevationValue.cachedString);
00428                         }
00429                 break;
00430                 case ePower:
00431                         {
00432                                 setToolTip(&renderer->getTips()->powerTip);
00433 
00434                                 static CachedValueString powerValue;
00435                                 if (powerValue.hasChanged(current->getPosition().getPower()))
00436                                 {
00437                                         powerValue.cachedString =
00438                                                 LANG_STRING(S3D::formatStringBuffer("%.1f",
00439                                                         powerValue.cachedValue.asFloat()));
00440                                 }
00441                                 GLWFont::instance()->getGameFont()->draw(
00442                                         *fontColor, fontSize_,
00443                                         x_, y_, 0.0f,
00444                                         powerValue.cachedString);
00445                         }
00446                 break;
00447                 case ePowerDiff:
00448                         {
00449                                 static CachedValueString powerValue;
00450                                 if (powerValue.hasChanged(current->getPosition().getPowerDiff()))
00451                                 {
00452                                         powerValue.cachedString =
00453                                                 LANG_STRING(S3D::formatStringBuffer("%+.1f",
00454                                                         powerValue.cachedValue.asFloat()));
00455                                 }
00456                                 GLWFont::instance()->getGameFont()->draw(
00457                                         *fontColor, fontSize_,
00458                                         x_, y_, 0.0f,
00459                                         powerValue.cachedString);
00460                         }
00461                 break;
00462         }
00463 }
00464 
00465 void GLWScorchedInfo::mouseDown(int button, float x, float y, bool &skipRest)
00466 {
00467         Tank *current = 
00468                 ScorchedClient::instance()->getTankContainer().getCurrentTank();
00469         if (!current ||
00470                 current->getState().getState() != TankState::sNormal)
00471         {
00472                 return;
00473         }
00474         TargetRendererImplTank *renderer = (TargetRendererImplTank *) 
00475                 current->getRenderer();
00476         if (!renderer) return;
00477         GLWTankTips *tankTips = renderer->getTips();
00478 
00479         if (inBox(x, y, x_, y_, w_, h_))
00480         {
00481                 skipRest = true;
00482 
00483                 switch (infoType_)
00484                 {
00485                         case ePlayerName:
00486                         break;
00487                         case ePlayerIcon:
00488                         break;
00489                         case ePlayerRank:
00490                         break;
00491                         case eAutoDefenseCount:
00492                                 tankTips->autodTip.showItems(GLWTranslate::getPosX() + x, 
00493                                         GLWTranslate::getPosY() + y);
00494                         break;
00495                         case eParachuteCount:
00496                                 tankTips->paraTip.showItems(GLWTranslate::getPosX() + x, 
00497                                         GLWTranslate::getPosY() + y);
00498                         break;
00499                         case eHealthCount:
00500                         break;
00501                         case eShieldCount:
00502                                 tankTips->shieldTip.showItems(GLWTranslate::getPosX() + x, 
00503                                         GLWTranslate::getPosY() + y);
00504                         break;
00505                         case eBatteryCount:
00506                                 tankTips->batteryTip.showItems(GLWTranslate::getPosX() + x, 
00507                                         GLWTranslate::getPosY() + y);
00508                         break;
00509                         case eFuelCount:
00510                                 tankTips->fuelTip.showItems(GLWTranslate::getPosX() + x, 
00511                                         GLWTranslate::getPosY() + y);
00512                         break;
00513                         case eWeaponName:
00514                                 tankTips->weaponTip.showItems(GLWTranslate::getPosX() + x, 
00515                                         GLWTranslate::getPosY() + y);
00516                         break;
00517                         case eWeaponCount:
00518                                 tankTips->weaponTip.showItems(GLWTranslate::getPosX() + x, 
00519                                         GLWTranslate::getPosY() + y);
00520                         break;
00521                         case eWeaponIcon:
00522                                 tankTips->weaponTip.showItems(GLWTranslate::getPosX() + x, 
00523                                         GLWTranslate::getPosY() + y);
00524                         break;
00525                         case eRotation:
00526                                 tankTips->undoMenu.showItems(GLWTranslate::getPosX() + x, 
00527                                         GLWTranslate::getPosY() + y);
00528                         break;
00529                         case eElevation:
00530                                 tankTips->undoMenu.showItems(GLWTranslate::getPosX() + x, 
00531                                         GLWTranslate::getPosY() + y);
00532                         break;
00533                         case ePower:
00534                                 tankTips->undoMenu.showItems(GLWTranslate::getPosX() + x, 
00535                                         GLWTranslate::getPosY() + y);
00536                         break;
00537                 }
00538         }
00539         else
00540         {
00541                 GLWidget::mouseDown(button, x, y, skipRest);
00542         }
00543 }
00544 
00545 bool GLWScorchedInfo::initFromXML(XMLNode *node)
00546 {
00547         if (!GLWidget::initFromXML(node)) return false;
00548 
00549         // Type node
00550         XMLNode *typeNode = 0;
00551         if (!node->getNamedChild("type", typeNode)) return false;
00552         if (0 == strcmp(typeNode->getContent(), "wind")) infoType_ = eWind;
00553         else if (0 == strcmp(typeNode->getContent(), "playername")) infoType_ = ePlayerName;
00554         else if (0 == strcmp(typeNode->getContent(), "playericon")) infoType_ = ePlayerIcon;
00555         else if (0 == strcmp(typeNode->getContent(), "playerrank")) infoType_ = ePlayerRank;
00556         else if (0 == strcmp(typeNode->getContent(), "autodefensecount")) infoType_ = eAutoDefenseCount;
00557         else if (0 == strcmp(typeNode->getContent(), "parachutecount")) infoType_ = eParachuteCount;
00558         else if (0 == strcmp(typeNode->getContent(), "shieldcount")) infoType_ = eShieldCount;
00559         else if (0 == strcmp(typeNode->getContent(), "healthcount")) infoType_ = eHealthCount;
00560         else if (0 == strcmp(typeNode->getContent(), "fuelcount")) infoType_ = eFuelCount;
00561         else if (0 == strcmp(typeNode->getContent(), "batterycount")) infoType_ = eBatteryCount;
00562         else if (0 == strcmp(typeNode->getContent(), "weaponname")) infoType_ = eWeaponName;
00563         else if (0 == strcmp(typeNode->getContent(), "weaponcount")) infoType_ = eWeaponCount;
00564         else if (0 == strcmp(typeNode->getContent(), "weaponicon")) infoType_ = eWeaponIcon;
00565         else if (0 == strcmp(typeNode->getContent(), "rotation")) infoType_ = eRotation;
00566         else if (0 == strcmp(typeNode->getContent(), "elevation")) infoType_ = eElevation;
00567         else if (0 == strcmp(typeNode->getContent(), "power")) infoType_ = ePower;
00568         else if (0 == strcmp(typeNode->getContent(), "rotationdiff")) infoType_ = eRotationDiff;
00569         else if (0 == strcmp(typeNode->getContent(), "elevationdiff")) infoType_ = eElevationDiff;
00570         else if (0 == strcmp(typeNode->getContent(), "powerdiff")) infoType_ = ePowerDiff;
00571         else
00572         {
00573                 S3D::dialogMessage("GLWScorchedInfo", S3D::formatStringBuffer(
00574                         "Unknown info type \"%s\"",
00575                         typeNode->getContent()));
00576                 return false;
00577         }
00578         
00579         // Font Size
00580         if (!node->getNamedChild("fontsize", fontSize_)) return false;
00581         
00582         // Font Color
00583         if (!node->getNamedChild("fontcolorr", fontColor_[0])) return false;
00584         if (!node->getNamedChild("fontcolorg", fontColor_[1])) return false;
00585         if (!node->getNamedChild("fontcolorb", fontColor_[2])) return false;
00586 
00587         // Font Selected Size
00588         if (!node->getNamedChild("selfontcolorr", selectedColor_[0], false))  selectedColor_[0] = fontColor_[0];
00589         if (!node->getNamedChild("selfontcolorg", selectedColor_[1], false))  selectedColor_[1] = fontColor_[1];
00590         if (!node->getNamedChild("selfontcolorb", selectedColor_[2], false))  selectedColor_[2] = fontColor_[2];
00591 
00592         // No Center
00593         XMLNode *centerNode;
00594         if (node->getNamedChild("nocenter", centerNode, false))
00595         {
00596                 noCenter_ = (0 == strcmp(centerNode->getContent(), "true"));
00597         }
00598 
00599         return true;
00600 }

Generated on Mon Feb 16 15:14:45 2009 for Scorched3D by  doxygen 1.5.3