[4744] | 1 | /* |
---|
[1853] | 2 | orxonox - the future of 3D-vertical-scrollers |
---|
| 3 | |
---|
| 4 | Copyright (C) 2004 orx |
---|
| 5 | |
---|
| 6 | This program is free software; you can redistribute it and/or modify |
---|
| 7 | it under the terms of the GNU General Public License as published by |
---|
| 8 | the Free Software Foundation; either version 2, or (at your option) |
---|
| 9 | any later version. |
---|
[1855] | 10 | |
---|
| 11 | ### File Specific: |
---|
[6437] | 12 | main-programmer: Benjamin Grauer |
---|
[1855] | 13 | co-programmer: ... |
---|
[1853] | 14 | */ |
---|
| 15 | |
---|
[3955] | 16 | //#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_ |
---|
[1853] | 17 | |
---|
[6437] | 18 | #include "hud.h" |
---|
[1853] | 19 | |
---|
[6441] | 20 | #include "state.h" |
---|
[8976] | 21 | #include "debug.h" |
---|
[6441] | 22 | |
---|
[6442] | 23 | #include "world_entities/weapons/weapon_manager.h" |
---|
[8448] | 24 | #include "glgui_widget.h" |
---|
[10111] | 25 | #include "glgui_box.h" |
---|
[10230] | 26 | #include "glgui_bar.h" |
---|
[10120] | 27 | #include "elements/glgui_energywidgetvertical.h" |
---|
[6442] | 28 | |
---|
[8518] | 29 | #include "glgui_inputline.h" |
---|
| 30 | #include "specials/glgui_notifier.h" |
---|
[8994] | 31 | #include "elements/glgui_radar.h" |
---|
[8518] | 32 | |
---|
[8996] | 33 | |
---|
| 34 | |
---|
| 35 | /// HACK |
---|
| 36 | #include "player.h" |
---|
| 37 | #include "playable.h" |
---|
| 38 | |
---|
[9869] | 39 | ObjectListDefinition(Hud); |
---|
[3245] | 40 | /** |
---|
[4838] | 41 | * standard constructor |
---|
| 42 | * @todo this constructor is not jet implemented - do it |
---|
[3245] | 43 | */ |
---|
[6437] | 44 | Hud::Hud () |
---|
[3365] | 45 | { |
---|
[9869] | 46 | this->registerObject(this, Hud::_objectList); |
---|
[4320] | 47 | |
---|
[6441] | 48 | //this->setSize2D( |
---|
[6442] | 49 | this->weaponManager = NULL; |
---|
[9965] | 50 | this->weaponManagerSecondary = NULL; |
---|
[6440] | 51 | this->energyWidget = NULL; |
---|
| 52 | this->shieldWidget = NULL; |
---|
| 53 | this->armorWidget = NULL; |
---|
[10230] | 54 | //this->leftRect = NULL; |
---|
| 55 | //this->rightRect = NULL; |
---|
[6441] | 56 | this->resX = 1; |
---|
| 57 | this->resY = 1; |
---|
[6442] | 58 | |
---|
[10234] | 59 | this->overlayPercentage = 40; |
---|
[10233] | 60 | this->overlayActive = false; |
---|
[10234] | 61 | this->rightRect = new OrxGui::GLGuiImage(); |
---|
| 62 | this->leftRect = new OrxGui::GLGuiImage(); |
---|
[10230] | 63 | |
---|
[8518] | 64 | this->inputLine = new OrxGui::GLGuiInputLine(); |
---|
| 65 | this->inputLine->setParent2D(this); |
---|
| 66 | this->notifier = new OrxGui::GLGuiNotifier(); |
---|
| 67 | this->notifier->setParent2D(this); |
---|
| 68 | notifier->setAbsCoor2D(100,100); |
---|
| 69 | |
---|
[8995] | 70 | this->_radar = new OrxGui::GLGuiRadar(); |
---|
[8994] | 71 | |
---|
[8990] | 72 | this->subscribeEvent(ES_ALL, EV_VIDEO_RESIZE); |
---|
[9003] | 73 | this->subscribeEvent(ES_ALL, SDLK_TAB); |
---|
[8518] | 74 | |
---|
[10194] | 75 | //this->shipValuesBox = NULL; |
---|
[3365] | 76 | } |
---|
[1853] | 77 | |
---|
| 78 | |
---|
[3245] | 79 | /** |
---|
[4838] | 80 | * standard deconstructor |
---|
[3245] | 81 | */ |
---|
[6437] | 82 | Hud::~Hud () |
---|
[3543] | 83 | { |
---|
[8518] | 84 | delete this->inputLine; |
---|
| 85 | delete this->notifier; |
---|
[8994] | 86 | |
---|
[8995] | 87 | delete this->_radar; |
---|
[10233] | 88 | delete this->rightRect; |
---|
| 89 | delete this->leftRect; |
---|
[10194] | 90 | //if (this->shipValuesBox != NULL) |
---|
| 91 | //delete this->shipValuesBox; |
---|
[10139] | 92 | |
---|
[3543] | 93 | // delete what has to be deleted here |
---|
| 94 | } |
---|
[6438] | 95 | |
---|
| 96 | |
---|
| 97 | void Hud::loadParams(const TiXmlElement* root) |
---|
| 98 | { |
---|
[6512] | 99 | Element2D::loadParams(root); |
---|
[6438] | 100 | } |
---|
| 101 | |
---|
[8518] | 102 | void Hud::notifyUser(const std::string& message) |
---|
[6438] | 103 | { |
---|
[8518] | 104 | this->notifier->pushNotifyMessage(message); |
---|
[6438] | 105 | } |
---|
| 106 | |
---|
[8518] | 107 | void Hud::setBackGround() |
---|
| 108 | {} |
---|
| 109 | |
---|
[8145] | 110 | void Hud::setEnergyWidget(OrxGui::GLGuiWidget* widget) |
---|
[6438] | 111 | { |
---|
[10194] | 112 | //if (this->shipValuesBox == NULL) |
---|
| 113 | //this->createShipValuesBox(); |
---|
| 114 | |
---|
[6440] | 115 | // decopple old widget |
---|
| 116 | if (this->energyWidget != NULL) |
---|
| 117 | { |
---|
| 118 | this->energyWidget->hide(); |
---|
| 119 | } |
---|
[6438] | 120 | |
---|
[6440] | 121 | this->energyWidget = widget; |
---|
| 122 | if (this->energyWidget != NULL) |
---|
| 123 | { |
---|
[10139] | 124 | //this->energyWidget->shiftDir2D(270); |
---|
[10194] | 125 | //dynamic_cast<OrxGui::GLGuiEnergyWidgetVertical*> (this->energyWidget)->setDisplayedName("Electronics"); |
---|
| 126 | //this->shipValuesBox->pack(this->energyWidget); |
---|
[10230] | 127 | //dynamic_cast<OrxGui::GLGuiEnergyWidgetVertical*> (this->energyWidget)->setStandardSettings(); |
---|
[10234] | 128 | this->energyWidget->setParent2D(this->leftRect); |
---|
[10139] | 129 | this->energyWidget->show(); |
---|
[8518] | 130 | /* this->energyWidget->frontMaterial().setDiffuseMap("hud_energy_bar.png"); |
---|
| 131 | this->energyWidget->frontMaterial().setBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);*/ |
---|
[6440] | 132 | } |
---|
| 133 | |
---|
[6441] | 134 | this->updateResolution(); |
---|
[6438] | 135 | } |
---|
| 136 | |
---|
[8145] | 137 | void Hud::setShiledWidget(OrxGui::GLGuiWidget* widget) |
---|
[10120] | 138 | { |
---|
[10194] | 139 | /* |
---|
[10139] | 140 | if (this->shipValuesBox == NULL) |
---|
| 141 | this->createShipValuesBox(); |
---|
[10194] | 142 | */ |
---|
| 143 | |
---|
[10120] | 144 | // decopple old widget |
---|
| 145 | if (this->shieldWidget != NULL) |
---|
| 146 | { |
---|
| 147 | this->shieldWidget->hide(); |
---|
| 148 | } |
---|
[6438] | 149 | |
---|
[10120] | 150 | this->shieldWidget = widget; |
---|
| 151 | if (this->shieldWidget != NULL) |
---|
| 152 | { |
---|
[10139] | 153 | //this->shieldWidget->shiftDir2D(270); |
---|
[10194] | 154 | //this->shipValuesBox->pack(this->shieldWidget); |
---|
[10230] | 155 | //dynamic_cast<OrxGui::GLGuiEnergyWidgetVertical*> (this->shieldWidget)->setStandardSettings(); |
---|
[10234] | 156 | this->shieldWidget->setParent2D(this->leftRect); |
---|
[10120] | 157 | this->shieldWidget->show(); |
---|
| 158 | /* this->shieldWidget->frontMaterial().setDiffuseMap("hud_energy_bar.png"); |
---|
| 159 | this->shieldWidget->frontMaterial().setBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);*/ |
---|
| 160 | } |
---|
[10139] | 161 | else |
---|
| 162 | printf("schild im hud nicht uebergeben!!!!!!!!!!!!!!!!!!!!!!!!!"); |
---|
[10120] | 163 | |
---|
| 164 | this->updateResolution(); |
---|
| 165 | } |
---|
| 166 | |
---|
[8145] | 167 | void Hud::setArmorWidget(OrxGui::GLGuiWidget* widget) |
---|
[10120] | 168 | { |
---|
[10194] | 169 | /* |
---|
[10139] | 170 | if (this->shipValuesBox == NULL) |
---|
| 171 | this->createShipValuesBox(); |
---|
[10194] | 172 | */ |
---|
[10139] | 173 | |
---|
[10120] | 174 | // decopple old widget |
---|
| 175 | if (this->armorWidget != NULL) |
---|
| 176 | { |
---|
| 177 | this->armorWidget->hide(); |
---|
| 178 | } |
---|
[6438] | 179 | |
---|
[10120] | 180 | this->armorWidget = widget; |
---|
| 181 | if (this->armorWidget != NULL) |
---|
| 182 | { |
---|
[10139] | 183 | //this->armorWidget->shiftDir2D(270); |
---|
[10194] | 184 | //this->shipValuesBox->pack(this->armorWidget); |
---|
[10230] | 185 | //dynamic_cast<OrxGui::GLGuiEnergyWidgetVertical*> (this->armorWidget)->setStandardSettings(); |
---|
[10234] | 186 | this->armorWidget->setParent2D(this->leftRect); |
---|
[10120] | 187 | this->armorWidget->show(); |
---|
| 188 | /* this->armorWidget->frontMaterial().setDiffuseMap("hud_energy_bar.png"); |
---|
| 189 | this->armorWidget->frontMaterial().setBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);*/ |
---|
| 190 | } |
---|
| 191 | |
---|
| 192 | this->updateResolution(); |
---|
| 193 | } |
---|
| 194 | |
---|
[9965] | 195 | void Hud::setWeaponManager(WeaponManager* weaponMan, WeaponManager* weaponManSec) |
---|
[6442] | 196 | { |
---|
| 197 | if (this->weaponManager != NULL) |
---|
| 198 | { |
---|
| 199 | for (unsigned int i = 0; i < this->weaponManager->getSlotCount(); i++) |
---|
| 200 | { |
---|
| 201 | Weapon* weapon = this->weaponManager->getWeapon(i); |
---|
| 202 | if (weapon != NULL) |
---|
| 203 | { |
---|
| 204 | weapon->getEnergyWidget()->hide(); |
---|
[10230] | 205 | this->weaponsWidgetsPrim.remove(dynamic_cast<OrxGui::GLGuiEnergyWidgetVertical*> (weapon->getEnergyWidget())); |
---|
[6442] | 206 | } |
---|
| 207 | } |
---|
| 208 | } |
---|
| 209 | |
---|
[9965] | 210 | if (this->weaponManagerSecondary != NULL) |
---|
| 211 | { |
---|
| 212 | for (unsigned int i = 0; i < this->weaponManagerSecondary->getSlotCount(); i++) |
---|
| 213 | { |
---|
| 214 | Weapon* weapon = this->weaponManagerSecondary->getWeapon(i); |
---|
| 215 | if (weapon != NULL) |
---|
| 216 | { |
---|
| 217 | weapon->getEnergyWidget()->hide(); |
---|
[10230] | 218 | this->weaponsWidgetsSec.remove(dynamic_cast<OrxGui::GLGuiEnergyWidgetVertical*> (weapon->getEnergyWidget())); |
---|
[9965] | 219 | } |
---|
| 220 | } |
---|
| 221 | } |
---|
| 222 | |
---|
[6442] | 223 | this->weaponManager = weaponMan; |
---|
[9965] | 224 | this->weaponManagerSecondary = weaponManSec; |
---|
[6442] | 225 | |
---|
[6445] | 226 | this->updateWeaponManager(); |
---|
[8996] | 227 | // this->updateResolution(); |
---|
[6438] | 228 | } |
---|
| 229 | |
---|
[6443] | 230 | void Hud::updateWeaponManager() |
---|
| 231 | { |
---|
| 232 | // hide all the Widgets |
---|
[10230] | 233 | std::list<OrxGui::GLGuiEnergyWidgetVertical*>::iterator weaponWidget; |
---|
| 234 | for (weaponWidget = this->weaponsWidgetsPrim.begin(); weaponWidget != this->weaponsWidgetsPrim.end(); weaponWidget++) |
---|
[6443] | 235 | { |
---|
| 236 | (*weaponWidget)->hide(); |
---|
| 237 | } |
---|
[10230] | 238 | this->weaponsWidgetsPrim.clear(); |
---|
[6442] | 239 | |
---|
[10230] | 240 | for (weaponWidget = this->weaponsWidgetsSec.begin(); weaponWidget != this->weaponsWidgetsSec.end(); weaponWidget++) |
---|
| 241 | { |
---|
| 242 | (*weaponWidget)->hide(); |
---|
| 243 | } |
---|
| 244 | this->weaponsWidgetsSec.clear(); |
---|
| 245 | |
---|
[6443] | 246 | // add all that we need again. |
---|
| 247 | if (this->weaponManager != NULL) |
---|
| 248 | for (unsigned int i = 0; i < this->weaponManager->getSlotCount(); i++) |
---|
| 249 | { |
---|
[8518] | 250 | Weapon* weapon = this->weaponManager->getWeapon(i); |
---|
| 251 | if (weapon != NULL) |
---|
| 252 | { |
---|
[9406] | 253 | //PRINTF(0)("WEAPON %s::%s in Slots\n", weapon->getClassCName(), weapon->getName()); |
---|
[10234] | 254 | weapon->getEnergyWidget()->setParent2D(this->rightRect); |
---|
[8518] | 255 | weapon->getEnergyWidget()->show(); |
---|
[8619] | 256 | weapon->getEnergyWidget()->setBackgroundColor(Color(.8,.2,.11, 0.1)); |
---|
[8518] | 257 | weapon->getEnergyWidget()->setFrontColor(Color( .2,.5,.7,.6)); |
---|
[10234] | 258 | weapon->getEnergyWidget()->setWidgetSize(120,30); |
---|
[10023] | 259 | //weapon->getEnergyWidget()->frontMaterial().setTransparency(.6); |
---|
[10230] | 260 | this->weaponsWidgetsPrim.push_back(dynamic_cast<OrxGui::GLGuiEnergyWidgetVertical*> (weapon->getEnergyWidget())); |
---|
[8518] | 261 | } |
---|
[6443] | 262 | } |
---|
[9965] | 263 | |
---|
| 264 | if (this->weaponManagerSecondary != NULL) |
---|
| 265 | for (unsigned int i = 0; i < this->weaponManagerSecondary->getSlotCount(); i++) |
---|
| 266 | { |
---|
| 267 | Weapon* weapon = this->weaponManagerSecondary->getWeapon(i); |
---|
| 268 | if (weapon != NULL) |
---|
| 269 | { |
---|
| 270 | //PRINTF(0)("WEAPON %s::%s in Slots\n", weapon->getClassCName(), weapon->getName()); |
---|
[10234] | 271 | weapon->getEnergyWidget()->setParent2D(this->rightRect); |
---|
[9965] | 272 | weapon->getEnergyWidget()->show(); |
---|
| 273 | weapon->getEnergyWidget()->setBackgroundColor(Color(.8,.2,.11, 0.1)); |
---|
| 274 | weapon->getEnergyWidget()->setFrontColor(Color( .2,.5,.7,.6)); |
---|
[10023] | 275 | //weapon->getEnergyWidget()->frontMaterial().setTransparency(.6); |
---|
[10230] | 276 | this->weaponsWidgetsSec.push_back(dynamic_cast<OrxGui::GLGuiEnergyWidgetVertical*> (weapon->getEnergyWidget())); |
---|
[9965] | 277 | } |
---|
| 278 | } |
---|
| 279 | |
---|
[6443] | 280 | this->updateResolution(); |
---|
[9965] | 281 | |
---|
[6443] | 282 | } |
---|
| 283 | |
---|
[8145] | 284 | void Hud::addWeaponWidget(OrxGui::GLGuiWidget* widget) |
---|
[8518] | 285 | {} |
---|
[6438] | 286 | |
---|
[8145] | 287 | void Hud::removeWeaponWidget(OrxGui::GLGuiWidget* widget) |
---|
[8518] | 288 | {} |
---|
[6438] | 289 | |
---|
[6441] | 290 | void Hud::updateResolution() |
---|
| 291 | { |
---|
[6498] | 292 | this->resX = State::getResX(); |
---|
| 293 | this->resY = State::getResY(); |
---|
[8976] | 294 | |
---|
| 295 | this->setSize2D(.2 * this->resX, this->resY); |
---|
[8989] | 296 | this->notifier->setAbsCoor2D(0.7 * this->resX, 0.3 * this->resY); |
---|
| 297 | this->notifier->setWidgetSize(0.25 * this->resX, 0.6 * this->resY); |
---|
[8976] | 298 | |
---|
[10234] | 299 | int overlayWidth = this->resX * (overlayPercentage)/(200); |
---|
| 300 | this->rightRect->hide(); |
---|
| 301 | this->leftRect->hide(); |
---|
| 302 | |
---|
| 303 | this->leftRect->setParent2D(this); |
---|
| 304 | this->leftRect->setWidgetSize(float(overlayWidth), float(this->resY)); |
---|
| 305 | this->leftRect->setAbsCoor2D(0,0); |
---|
| 306 | this->leftRect->setBackgroundTexture(Texture()); |
---|
| 307 | this->leftRect->setBackgroundColor(Color(0,0,0.7,0.2)); |
---|
| 308 | this->leftRect->setForegroundTexture(Texture()); |
---|
| 309 | this->leftRect->setForegroundColor(Color(0,0,0,0)); |
---|
| 310 | |
---|
| 311 | this->rightRect->setParent2D(this); |
---|
| 312 | this->rightRect->setWidgetSize(float(overlayWidth), float(this->resY)); |
---|
| 313 | this->rightRect->setAbsCoor2D(this->resX - overlayWidth,0); |
---|
| 314 | this->rightRect->setBackgroundTexture(Texture()); |
---|
| 315 | this->rightRect->setBackgroundColor(Color(0,0,0.7,0.2)); |
---|
| 316 | this->rightRect->setForegroundTexture(Texture()); |
---|
| 317 | this->rightRect->setForegroundColor(Color(0,0,0,0)); |
---|
| 318 | |
---|
| 319 | |
---|
[10233] | 320 | if (this->overlayActive == true) |
---|
| 321 | { |
---|
[10234] | 322 | this->rightRect->show(); |
---|
[10233] | 323 | this->leftRect->show(); |
---|
| 324 | } |
---|
[8995] | 325 | |
---|
[10233] | 326 | |
---|
[8996] | 327 | if (State::getPlayer() && State::getPlayer()->getPlayable() && State::getObjectManager()) |
---|
| 328 | { |
---|
[9869] | 329 | PRINTF(4)("UPDATING RADAR\n"); |
---|
[10234] | 330 | this->_radar->setParent2D(this->leftRect); |
---|
[8996] | 331 | this->_radar->setCenterNode(State::getPlayer()->getPlayable()); |
---|
[10092] | 332 | //this->_radar->addEntityList(&State::getObjectManager()->getEntityList((OM_LIST)(State::getPlayer()->getPlayable()->getOMListNumber()+1)), Color(.4, .4, 1.0)); |
---|
| 333 | this->_radar->addEntityList(&State::getObjectManager()->getEntityList(OM_GROUP_00), Color(1, 0, 0)); |
---|
| 334 | this->_radar->addEntityList(&State::getObjectManager()->getEntityList(OM_GROUP_01), Color(0, 0, 1)); |
---|
[10230] | 335 | this->_radar->setAbsCoor2D(0, 0.01 * this->resY); |
---|
| 336 | this->_radar->setWidgetSize(0.18 * this->resX, 0.2 * this->resY); |
---|
[9014] | 337 | this->_radar->setRange(300); |
---|
[8996] | 338 | this->_radar->show(); |
---|
[10194] | 339 | |
---|
| 340 | if (this->armorWidget != NULL) |
---|
[10230] | 341 | this->armorWidget->setRelCoor2D(100,0.2*this->resY + this->armorWidget->getSizeX2D()); |
---|
[10194] | 342 | if (this->shieldWidget != NULL) |
---|
[10230] | 343 | this->shieldWidget->setRelCoor2D(60,0.2*this->resY + this->armorWidget->getSizeX2D()); |
---|
[10194] | 344 | if (this->energyWidget != NULL) |
---|
[10230] | 345 | this->energyWidget->setRelCoor2D(20,0.2*this->resY + this->armorWidget->getSizeX2D()); |
---|
[10194] | 346 | //this->shieldWidget->setRelCoor2D(0.1*this->resX + this->armorWidget->getSizeX2D(),0); |
---|
| 347 | //this->energyWidget->setRelCoor2D(0.1*this->resX + this->armorWidget->getSizeX2D() + this->shieldWidget->getSizeX2D(),0); |
---|
[8996] | 348 | } |
---|
| 349 | |
---|
[10194] | 350 | /* |
---|
[10111] | 351 | if (this->shipValuesBox != NULL) |
---|
[6441] | 352 | { |
---|
[10139] | 353 | this->shipValuesBox->setAbsCoor2D(0.2 * this->resX, 0.4 * this->resY); |
---|
[10111] | 354 | this->shipValuesBox->setWidgetSize(.4 * this->resX, 0.1 * this->resY); |
---|
[6441] | 355 | } |
---|
[10139] | 356 | else |
---|
| 357 | createShipValuesBox(); |
---|
[10194] | 358 | */ |
---|
[6442] | 359 | |
---|
[10230] | 360 | std::list<OrxGui::GLGuiEnergyWidgetVertical*>::iterator weaponWidget; |
---|
[10234] | 361 | Vector2D pos(overlayWidth, 0.5*this->resY); |
---|
| 362 | |
---|
| 363 | // out of reasons i can't get behind, this version is segfaulting when calling getSizeX2D or getSizeY2D. the other |
---|
| 364 | // element2D- related function works tough.. :s |
---|
| 365 | |
---|
[10230] | 366 | for (weaponWidget = this->weaponsWidgetsPrim.begin(); weaponWidget != this->weaponsWidgetsPrim.end(); weaponWidget++) |
---|
[6442] | 367 | { |
---|
[10234] | 368 | if (pos.x < overlayWidth*0.2) |
---|
[8987] | 369 | { |
---|
[10234] | 370 | pos.x = overlayWidth; |
---|
| 371 | pos.y += (*weaponWidget)->getSizeX2D(); |
---|
[10230] | 372 | } |
---|
[10234] | 373 | pos.x -= (*weaponWidget)->getSizeY2D(); |
---|
[10230] | 374 | (*weaponWidget)->setAbsCoor2D(pos.x, pos.y); |
---|
[10234] | 375 | //(*weaponWidget)->setAbsCoor2D(0,100); |
---|
[10230] | 376 | (*weaponWidget)->show(); |
---|
| 377 | //printf("update thing %s::%s\n", (*weaponWidget)->getClassCName(), (*weaponWidget)->getName()); |
---|
| 378 | } |
---|
[8987] | 379 | |
---|
[10234] | 380 | pos.y += 160; |
---|
| 381 | pos.x = overlayWidth; |
---|
[10230] | 382 | for (weaponWidget = this->weaponsWidgetsSec.begin(); weaponWidget != this->weaponsWidgetsSec.end(); weaponWidget++) |
---|
| 383 | { |
---|
[10234] | 384 | if (pos.x < overlayWidth*0.2) |
---|
[10230] | 385 | { |
---|
[10234] | 386 | pos.x = overlayWidth; |
---|
| 387 | pos.y += (*weaponWidget)->getSizeX2D(); |
---|
[8987] | 388 | } |
---|
[10234] | 389 | pos.x -= (*weaponWidget)->getSizeY2D(); |
---|
[10230] | 390 | (*weaponWidget)->setAbsCoor2D(pos.x, pos.y); |
---|
[8976] | 391 | (*weaponWidget)->show(); |
---|
[9406] | 392 | //printf("update thing %s::%s\n", (*weaponWidget)->getClassCName(), (*weaponWidget)->getName()); |
---|
[6442] | 393 | } |
---|
[10230] | 394 | |
---|
[6441] | 395 | } |
---|
| 396 | |
---|
[8990] | 397 | void Hud::draw() const |
---|
[6441] | 398 | { |
---|
[8990] | 399 | // GLGuiWidget::draw(); |
---|
[6441] | 400 | } |
---|
| 401 | |
---|
[8990] | 402 | |
---|
| 403 | void Hud::process(const Event &event) |
---|
[6441] | 404 | { |
---|
[8990] | 405 | if (event.type == EV_VIDEO_RESIZE) |
---|
| 406 | this->updateResolution(); |
---|
[9003] | 407 | else if (event.type == SDLK_TAB) |
---|
| 408 | { |
---|
| 409 | /// TODO SHOW THE INPUT-LINE |
---|
| 410 | // this->inputLine->select(); |
---|
| 411 | } |
---|
[10139] | 412 | } |
---|
[9003] | 413 | |
---|
[10194] | 414 | /* |
---|
[10139] | 415 | void Hud::createShipValuesBox() |
---|
| 416 | { |
---|
[10194] | 417 | this->shipValuesBox = new OrxGui::GLGuiBox(OrxGui::Vertical); |
---|
[10139] | 418 | //this->shipValuesBox->setWidgetSize(1000,500); |
---|
| 419 | //this->shipValuesBox->setBackgroundTexture("maps/gui_container_background.png"); |
---|
| 420 | this->shipValuesBox->setBackgroundTexture(Texture()); |
---|
| 421 | this->shipValuesBox->setBackgroundColor(Color(0,0,1,0.5)); |
---|
| 422 | this->shipValuesBox->setVisibility(true); |
---|
[6441] | 423 | } |
---|
[10194] | 424 | */ |
---|
[6441] | 425 | |
---|
| 426 | |
---|