Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4818 in orxonox.OLD for orxonox/trunk/src/world_entities


Ignore:
Timestamp:
Jul 7, 2005, 5:24:34 PM (19 years ago)
Author:
patrick
Message:

orxonox/trunk: crosshair gets deleted also, now all event listeners are removed at the end

Location:
orxonox/trunk/src/world_entities
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/world_entities/player.cc

    r4781 r4818  
    3535#include "crosshair.h"
    3636
    37 Crosshair* test;
     37
    3838
    3939using namespace std;
     
    6363  this->weaponMan->addWeapon(wpRight, W_CONFIG2);
    6464  this->weaponMan->addWeapon(wpLeft, W_CONFIG2);
    65 
    6665}
    6766
     
    7776  */
    7877  delete this->weaponMan;
     78  delete this->crosshair;
    7979}
    8080
     
    102102
    103103
    104   test = new Crosshair();
     104  this->crosshair = new Crosshair();
    105105}
    106106
     
    198198void Player::draw ()
    199199{
    200   test->draw();
     200  this->crosshair->draw();
    201201  glMatrixMode(GL_MODELVIEW);
    202202  glPushMatrix();
  • orxonox/trunk/src/world_entities/player.h

    r4780 r4818  
    22    \file player.h
    33    \brief Implements a basic controllable WorldEntity
    4 */
     4 */
    55
    66#ifndef _PLAYER_H
     
    1717class World;
    1818class Event;
     19class Crosshair;
    1920
    2021//! Basic controllable WorldEntity
     
    2324  friend class World;
    2425
    25  public:
    26   Player();
    27   Player(const TiXmlElement* root);
    28   virtual ~Player();
     26  public:
     27    Player();
     28    Player(const TiXmlElement* root);
     29    virtual ~Player();
    2930
    30   void init();
    31   void loadParams(const TiXmlElement* root);
     31    void init();
     32    void loadParams(const TiXmlElement* root);
    3233
    33   void addWeapon(Weapon* weapon);
    34   void removeWeapon(Weapon* weapon);
     34    void addWeapon(Weapon* weapon);
     35    void removeWeapon(Weapon* weapon);
    3536
    36   virtual void postSpawn();
    37   virtual void leftWorld();
    38   virtual void hit(WorldEntity* weapon, Vector* loc);
    39   virtual void collide(WorldEntity* other, Uint32 ownhitflags, Uint32 otherhitflags);
     37    virtual void postSpawn();
     38    virtual void leftWorld();
     39    virtual void hit(WorldEntity* weapon, Vector* loc);
     40    virtual void collide(WorldEntity* other, Uint32 ownhitflags, Uint32 otherhitflags);
    4041
    41   virtual void tick(float time);
    42   virtual void draw();
     42    virtual void tick(float time);
     43    virtual void draw();
    4344
    44   virtual void command(Command* cmd);
     45    virtual void command(Command* cmd);
    4546
    46   virtual void process(const Event &event);
     47    virtual void process(const Event &event);
    4748
    48  private:
    49   bool bUp;              //!< up button pressed.
    50   bool bDown;            //!< down button pressed.
    51   bool bLeft;            //!< left button pressed.
    52   bool bRight;           //!< right button pressed.
    53   bool bAscend;          //!< ascend button pressed.
    54   bool bDescend;         //!< descend button presses.
    55   bool bFire;            //!< fire button pressed.
    56   bool bWeaponChange;    //!< weapon change button pressed
    5749
    58   tList<Weapon>* weapons;//!< a list of weapon
    59   Weapon* activeWeapon;  //!< the weapon that is currenty activated
    60   Weapon* activeWeaponL;  //temporary -- FIX THIS
    61   WeaponManager* weaponMan; //!< the weapon manager: managing a list of weapon to wepaon-slot mapping
     50  private:
     51    void move(float time);
     52    void weapon();
    6253
    63   World* myWorld;        //!< reference to the world object
    6454
    65   Vector* velocity;       //!< the velocity of the player.
    66   float travelSpeed;     //!< the current speed of the player (to make soft movement)
    67   float acceleration;    //!< the acceleration of the player.
     55  private:
     56    bool bUp;              //!< up button pressed.
     57    bool bDown;            //!< down button pressed.
     58    bool bLeft;            //!< left button pressed.
     59    bool bRight;           //!< right button pressed.
     60    bool bAscend;          //!< ascend button pressed.
     61    bool bDescend;         //!< descend button presses.
     62    bool bFire;            //!< fire button pressed.
     63    bool bWeaponChange;    //!< weapon change button pressed
    6864
    69   void move(float time);
    70   void weapon();
     65    tList<Weapon>* weapons;//!< a list of weapon
     66    Weapon* activeWeapon;  //!< the weapon that is currenty activated
     67    Weapon* activeWeaponL;  //temporary -- FIX THIS
     68    WeaponManager* weaponMan; //!< the weapon manager: managing a list of weapon to wepaon-slot mapping
     69
     70    World* myWorld;        //!< reference to the world object
     71
     72    Vector* velocity;       //!< the velocity of the player.
     73    float travelSpeed;     //!< the current speed of the player (to make soft movement)
     74    float acceleration;    //!< the acceleration of the player.
     75
     76    Crosshair*  crosshair; //!< the crosshair of the player
    7177
    7278};
  • orxonox/trunk/src/world_entities/weapons/crosshair.cc

    r4781 r4818  
    4646{
    4747  // delete what has to be deleted here
     48  EventHandler::getInstance()->unsubscribe(this);
    4849}
    4950
Note: See TracChangeset for help on using the changeset viewer.