- Timestamp:
- Jan 8, 2006, 3:20:00 PM (19 years ago)
- Location:
- trunk/src
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/util/hud.cc
r6438 r6440 29 29 this->setClassID(CL_HUD, "Hud"); 30 30 31 32 this->energyWidget = NULL; 33 this->shieldWidget = NULL; 34 this->armorWidget = NULL; 31 35 } 32 36 … … 53 57 void Hud::setEnergyWidget(GLGuiWidget* widget) 54 58 { 59 // decopple old widget 60 if (this->energyWidget != NULL) 61 { 62 this->energyWidget->hide(); 63 } 64 65 this->energyWidget = widget; 66 if (this->energyWidget != NULL) 67 { 68 this->energyWidget->show(); 69 this->energyWidget->setAbsCoor2D(10,80); 70 this->energyWidget->setSize2D(20,300); 71 } 72 55 73 56 74 } -
trunk/src/world_entities/player.cc
r6438 r6440 32 32 Player::Player() 33 33 { 34 this->init(); 34 // this->setRelDir(Quaternion(M_PI, Vector(1,0,0))); 35 this->setClassID(CL_PLAYER, "Player"); 36 37 PRINTF(4)("PLAYER INIT\n"); 38 39 this->controllable = NULL; 40 this->hud = new Hud(); 35 41 36 42 EventHandler::getInstance()->subscribe(this, ES_GAME, SDLK_l); … … 43 49 Player::~Player () 44 50 { 45 } 51 delete this->hud; 46 52 47 48 /**49 * initializes a Player50 */51 void Player::init()52 {53 // this->setRelDir(Quaternion(M_PI, Vector(1,0,0)));54 this->setClassID(CL_PLAYER, "Player");55 56 PRINTF(4)("PLAYER INIT\n");57 58 this->controllable = NULL;59 this->hud = new Hud();60 53 } 61 54 … … 66 59 { 67 60 this->controllable = controllable; 61 this->hud->setEnergyWidget(this->controllable->getEnergyWidget()); 68 62 return true; 69 63 } … … 79 73 { 80 74 this->controllable = NULL; 75 this->hud->setEnergyWidget(NULL); 81 76 return true; 82 77 } -
trunk/src/world_entities/player.h
r6438 r6440 35 35 36 36 private: 37 void init();38 39 40 private:41 37 Playable* controllable; //!< The one we controll or NULL if none 42 38 Hud* hud; //!< The HUD to be displayed. -
trunk/src/world_entities/space_ships/space_ship.cc
r6436 r6440 213 213 dynamic_cast<Element2D*>(this->getWeaponManager()->getFixedTarget())->setVisibility( true); 214 214 this->attachCamera(); 215 216 this->setEnergyWidgetVisibilit(true);217 218 215 } 219 216 … … 222 219 dynamic_cast<Element2D*>(this->getWeaponManager()->getFixedTarget())->setVisibility( false); 223 220 this->detachCamera(); 224 225 this->setEnergyWidgetVisibilit(false);226 227 221 } 228 222 -
trunk/src/world_entities/world_entity.cc
r6431 r6440 410 410 } 411 411 412 GLGuiWidget* WorldEntity::getEnergyWidget() 413 { 414 this->createEnergyWidget(); 415 return this->energyWidget; 416 } 417 412 418 /** 413 419 * @param visibility shows or hides the energy-bar -
trunk/src/world_entities/world_entity.h
r6430 r6440 20 20 class BVTree; 21 21 class Model; 22 23 class GLGuiWidget; 22 24 class GLGuiBar; 23 25 … … 36 38 void loadModel(const char* fileName, float scaling = 1.0f, unsigned int modelNumber = 0); 37 39 void setModel(Model* model, unsigned int modelNumber = 0); 38 Model* getModel(unsigned int modelNumber = 0) const { return (this->models.size() > modelNumber)? this->models[modelNumber] : NULL; };40 Model* getModel(unsigned int modelNumber = 0) const { return (this->models.size() > modelNumber)? this->models[modelNumber] : NULL; }; 39 41 40 42 inline void loadMD2Texture(const char* fileName) { this->md2TextureFileName = fileName; } … … 91 93 float removeEnergy(float energy); 92 94 void setMaxEnergy(float maxEnergy); 93 95 GLGuiWidget* getEnergyWidget(); 94 96 95 97 protected:
Note: See TracChangeset
for help on using the changeset viewer.