Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10685 in orxonox.OLD for branches/hud/src/world_entities


Ignore:
Timestamp:
Jun 11, 2007, 4:40:33 PM (17 years ago)
Author:
bknecht
Message:

My computer is not working anymore, so I upload my unfinished work to continue my work

Location:
branches/hud/src/world_entities
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/hud/src/world_entities/creatures/fps_player.cc

    r10654 r10685  
    2020#include "state.h"
    2121#include "tools/camera.h"
     22#include "player.h"
    2223
    2324#include "src/lib/util/loading/factory.h"
     
    5253                            ->addMethod("getAbsCoorY", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorY))
    5354                            ->addMethod("getAbsCoorZ", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorZ))
     55                            ->addMethod("displayHUDText", Executor1<FPSPlayer, lua_State*, const std::string&>(&FPSPlayer::displayHUDText))
    5456                       );
    5557
     
    352354  {
    353355    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);
    355356  }
    356357
     
    604605}
    605606
     607void 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  
    3636    virtual void tick(float time);
    3737    virtual void draw() const;
     38   
     39    void displayHUDText( const std::string& message );
    3840
    3941
  • branches/hud/src/world_entities/player.cc

    r10516 r10685  
    1919
    2020#include "event_handler.h"
     21#include "fps_player.h"
    2122
    2223#include "state.h"
     
    7475    PRINTF(4)("Enter new Playable\n");
    7576    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)
    7889      this->_hud.setWeaponManager(&this->playable->getWeaponManager(), &dynamic_cast<SpaceShip*>(this->playable)->getWeaponManagerSecondary());
    7990    else
    80       this->_hud.setWeaponManager(&this->playable->getWeaponManager());
     91      this->_hud.setWeaponManager(&this->playable->getWeaponManager());*/
    8192
    8293    this->playable->setPlayer(this);
  • branches/hud/src/world_entities/world_entity.cc

    r10618 r10685  
    813813}
    814814
     815/**
     816 * @brief creates the ImplantWidget
     817 *
     818 * since not all entities need an ImpantWidget, it is only created on request.
     819 */
     820void 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
    815835void WorldEntity::increaseHealthMax(float increaseHealth)
    816836{
     
    824844  this->createHealthWidget();
    825845  return this->healthWidget;
     846}
     847
     848
     849OrxGui::GLGuiWidget* WorldEntity::getImplantWidget()
     850{
     851  this->createImplantWidget();
     852  return this->implantWidget;
    826853}
    827854
  • branches/hud/src/world_entities/world_entity.h

    r10540 r10685  
    161161  void increaseHealthMax(float increaseHealth);
    162162  OrxGui::GLGuiWidget* getHealthWidget();
     163  OrxGui::GLGuiWidget* getImplantWidget();
    163164  bool hasHealthWidget() const { return this->healthWidget != NULL; };
    164165
     
    187188  void setHealthMax(float healthMax);
    188189  void createHealthWidget();
     190  void createImplantWidget();
    189191    //  CharacterAttributes*    charAttr;         //!< the character attributes of a world_entity
    190192
     
    206208
    207209private:
    208   /// TODO maybe we will move the following three entries and the corresponding functions to Playable AND NPC
     210  /// TODO maybe we will move the following eight entries and the corresponding functions to Playable AND NPC
    209211  float                   damage;             //!< the damage dealt to other objects by colliding.
    210212  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
    212215  OrxGui::GLGuiEnergyWidgetVertical* healthWidget;    //!< The Slider (if wanted).
     216  OrxGui::GLGuiEnergyWidgetVertical* implantWidget;
    213217
    214218  std::vector<Model*>     models;             //!< The model that should be loaded for this entity.
     
    247251  float                   healthMax_write;
    248252  int                     healthMax_handle;
     253 
     254
    249255
    250256
Note: See TracChangeset for help on using the changeset viewer.