Changeset 10685 in orxonox.OLD for branches/hud/src/world_entities
- Timestamp:
- Jun 11, 2007, 4:40:33 PM (18 years ago)
- Location:
- branches/hud/src/world_entities
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/hud/src/world_entities/creatures/fps_player.cc
r10654 r10685 20 20 #include "state.h" 21 21 #include "tools/camera.h" 22 #include "player.h" 22 23 23 24 #include "src/lib/util/loading/factory.h" … … 52 53 ->addMethod("getAbsCoorY", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorY)) 53 54 ->addMethod("getAbsCoorZ", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorZ)) 55 ->addMethod("displayHUDText", Executor1<FPSPlayer, lua_State*, const std::string&>(&FPSPlayer::displayHUDText)) 54 56 ); 55 57 … … 352 354 { 353 355 this->getWeaponManager().fire(); 354 PRINTF(0)("Crosshair at position: %f, %f, %f\n", this->getWeaponManager().getFixedTarget()->getAbsCoor().x, this->getWeaponManager().getFixedTarget()->getAbsCoor().y, this->getWeaponManager().getFixedTarget()->getAbsCoor().z);355 356 } 356 357 … … 604 605 } 605 606 607 void FPSPlayer::displayHUDText( const std::string& message ) 608 { 609 State::getPlayer()->hud().notifyUser(message); 610 } -
branches/hud/src/world_entities/creatures/fps_player.h
r10654 r10685 36 36 virtual void tick(float time); 37 37 virtual void draw() const; 38 39 void displayHUDText( const std::string& message ); 38 40 39 41 -
branches/hud/src/world_entities/player.cc
r10516 r10685 19 19 20 20 #include "event_handler.h" 21 #include "fps_player.h" 21 22 22 23 #include "state.h" … … 74 75 PRINTF(4)("Enter new Playable\n"); 75 76 this->playable = playable; 76 this->_hud.setArmorWidget(this->playable->getHealthWidget()); 77 if (dynamic_cast<SpaceShip*>(this->playable) != 0) 77 78 if( playable->isA(FpsPlayer::staticClassID()) ) 79 { 80 this->_hud.setMod(Hud::Playmode FirstPerson); 81 this->_hud.setHealthWidget(this->playable->getHealthWidget()); 82 } 83 else 84 { 85 this->_hud.setMode(Hud::Playmode Full3D); 86 this->_hud.setHealthWidget(this->playable->getHealthWidget()); 87 } 88 /*if (dynamic_cast<SpaceShip*>(this->playable) != 0) 78 89 this->_hud.setWeaponManager(&this->playable->getWeaponManager(), &dynamic_cast<SpaceShip*>(this->playable)->getWeaponManagerSecondary()); 79 90 else 80 this->_hud.setWeaponManager(&this->playable->getWeaponManager()); 91 this->_hud.setWeaponManager(&this->playable->getWeaponManager());*/ 81 92 82 93 this->playable->setPlayer(this); -
branches/hud/src/world_entities/world_entity.cc
r10618 r10685 813 813 } 814 814 815 /** 816 * @brief creates the ImplantWidget 817 * 818 * since not all entities need an ImpantWidget, it is only created on request. 819 */ 820 void WorldEntity::createImplantWidget() 821 { 822 if (this->implantWidget == NULL) 823 { 824 this->implantWidget = new OrxGui::GLGuiEnergyWidgetVertical(); 825 //this->impantWidget->setDisplayedName("Implant"); 826 //this->impantWidget->setSize2D(100,20); 827 //this->impantWidget->setAbsCoor2D(100,200); 828 829 //this->updateImplantWidget(); 830 } 831 else 832 PRINTF(3)("Allready created the ImlpantWidget for %s::%s\n", this->getClassCName(), this->getCName()); 833 } 834 815 835 void WorldEntity::increaseHealthMax(float increaseHealth) 816 836 { … … 824 844 this->createHealthWidget(); 825 845 return this->healthWidget; 846 } 847 848 849 OrxGui::GLGuiWidget* WorldEntity::getImplantWidget() 850 { 851 this->createImplantWidget(); 852 return this->implantWidget; 826 853 } 827 854 -
branches/hud/src/world_entities/world_entity.h
r10540 r10685 161 161 void increaseHealthMax(float increaseHealth); 162 162 OrxGui::GLGuiWidget* getHealthWidget(); 163 OrxGui::GLGuiWidget* getImplantWidget(); 163 164 bool hasHealthWidget() const { return this->healthWidget != NULL; }; 164 165 … … 187 188 void setHealthMax(float healthMax); 188 189 void createHealthWidget(); 190 void createImplantWidget(); 189 191 // CharacterAttributes* charAttr; //!< the character attributes of a world_entity 190 192 … … 206 208 207 209 private: 208 /// TODO maybe we will move the following threeentries and the corresponding functions to Playable AND NPC210 /// TODO maybe we will move the following eight entries and the corresponding functions to Playable AND NPC 209 211 float damage; //!< the damage dealt to other objects by colliding. 210 212 float health; //!< The Energy of this Entity, if the Entity has any energy at all. 211 float healthMax; //!< The Maximal energy this entity can take. 213 float healthMax; //!< The Maximal energy this entity can take. 214 float implantEnergy; //!< energy of implants 212 215 OrxGui::GLGuiEnergyWidgetVertical* healthWidget; //!< The Slider (if wanted). 216 OrxGui::GLGuiEnergyWidgetVertical* implantWidget; 213 217 214 218 std::vector<Model*> models; //!< The model that should be loaded for this entity. … … 247 251 float healthMax_write; 248 252 int healthMax_handle; 253 254 249 255 250 256
Note: See TracChangeset
for help on using the changeset viewer.