Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 2077 in orxonox.OLD for orxonox


Ignore:
Timestamp:
Jul 5, 2004, 9:51:48 PM (20 years ago)
Author:
patrick
Message:

/orxonox/trunk/src: making doxygen comments in worldentity, player, world; extending API of worldentity; inserting list.h in world - this version does not compile

Location:
orxonox/trunk/src
Files:
2 added
1 deleted
7 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/Makefile.am

    r2043 r2077  
    66
    77bin_PROGRAMS=orxonox
    8 orxonox_SOURCES=orxonox.cc world.cc environment.cc player.cc npc.cc input_output.cc data_tank.cc ai.cc shoot_laser.cc shoot_rocket.cc world_entity.cc synchronisable.cc list.cc vector.cc ability.cc
     8orxonox_SOURCES=orxonox.cc world.cc environment.cc player.cc npc.cc input_output.cc data_tank.cc ai.cc shoot_laser.cc shoot_rocket.cc world_entity.cc synchronisable.cc vector.cc ability.cc power_up.cc
    99
    1010#  uncomment the following if bencoder requires the math library
  • orxonox/trunk/src/Makefile.in

    r2043 r2077  
    117117#"-O3 -pedantic -fPIC -ffast-math -I/usr/X11R6/include"
    118118bin_PROGRAMS = orxonox
    119 orxonox_SOURCES = orxonox.cc world.cc environment.cc player.cc npc.cc input_output.cc data_tank.cc ai.cc shoot_laser.cc shoot_rocket.cc world_entity.cc synchronisable.cc list.cc vector.cc ability.cc
     119orxonox_SOURCES = orxonox.cc world.cc environment.cc player.cc npc.cc input_output.cc data_tank.cc ai.cc shoot_laser.cc shoot_rocket.cc world_entity.cc synchronisable.cc vector.cc ability.cc power_up.cc
    120120subdir = src
    121121ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
     
    130130        input_output.$(OBJEXT) data_tank.$(OBJEXT) ai.$(OBJEXT) \
    131131        shoot_laser.$(OBJEXT) shoot_rocket.$(OBJEXT) \
    132         world_entity.$(OBJEXT) synchronisable.$(OBJEXT) list.$(OBJEXT) \
    133         vector.$(OBJEXT) ability.$(OBJEXT)
     132        world_entity.$(OBJEXT) synchronisable.$(OBJEXT) \
     133        vector.$(OBJEXT) ability.$(OBJEXT) power_up.$(OBJEXT)
    134134orxonox_OBJECTS = $(am_orxonox_OBJECTS)
    135135orxonox_LDADD = $(LDADD)
     
    142142@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/ability.Po ./$(DEPDIR)/ai.Po \
    143143@AMDEP_TRUE@    ./$(DEPDIR)/data_tank.Po ./$(DEPDIR)/environment.Po \
    144 @AMDEP_TRUE@    ./$(DEPDIR)/input_output.Po ./$(DEPDIR)/list.Po \
    145 @AMDEP_TRUE@    ./$(DEPDIR)/npc.Po ./$(DEPDIR)/orxonox.Po \
    146 @AMDEP_TRUE@    ./$(DEPDIR)/player.Po ./$(DEPDIR)/shoot_laser.Po \
     144@AMDEP_TRUE@    ./$(DEPDIR)/input_output.Po ./$(DEPDIR)/npc.Po \
     145@AMDEP_TRUE@    ./$(DEPDIR)/orxonox.Po ./$(DEPDIR)/player.Po \
     146@AMDEP_TRUE@    ./$(DEPDIR)/power_up.Po ./$(DEPDIR)/shoot_laser.Po \
    147147@AMDEP_TRUE@    ./$(DEPDIR)/shoot_rocket.Po \
    148148@AMDEP_TRUE@    ./$(DEPDIR)/synchronisable.Po ./$(DEPDIR)/vector.Po \
     
    205205@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/environment.Po@am__quote@
    206206@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/input_output.Po@am__quote@
    207 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/list.Po@am__quote@
    208207@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/npc.Po@am__quote@
    209208@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/orxonox.Po@am__quote@
    210209@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/player.Po@am__quote@
     210@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/power_up.Po@am__quote@
    211211@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/shoot_laser.Po@am__quote@
    212212@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/shoot_rocket.Po@am__quote@
  • orxonox/trunk/src/list.h

    r2036 r2077  
     1/*!
     2  \file list.h
     3  \brief Contains a template for a doubly linked list
     4*/
    15
    26#ifndef LIST_H
    37#define LIST_H
    48
    5 #include "list.h"
    6 
    7 class WorldEntity;
    8 
    9 class List {
    10 
     9#include "stdlib.h"
     10
     11//! An enum to list all the modes available when adding an object to a List
     12enum ADDMODE {LIST_ADD_NEXT, LIST_ADD_PREV, LIST_ADD_FIRST, LIST_ADD_LAST};
     13//! An enum to list the two searching directions available when removing an object from a List
     14enum FINDMODE {LIST_FIND_BW, LIST_FIND_FW};
     15
     16//! A generic doubly linked list
     17template<class T> class List
     18{
     19  T* object;
     20  List<T>* next;
     21  List<T>* prev;
     22  bool bReference;
     23 
    1124 public:
    12   List ();
     25  List (T* obj, List<T>* n, List<T>* p, bool bRef);
    1326  ~List ();
    14 
    15   void addElement(WorldEntity* we);
    16   void removeElement(WorldEntity* we);
    17   WorldEntity* getElement(int number);
    18   int getNrOfElement(WorldEntity* we);
    19   void defragment();
    20   void flushList();
    21   void killList();
    22  
    23  private:
    24   struct listElement {
    25     WorldEntity* we;
    26     listElement* next;
    27     listElement* prev;
    28   };
    29   listElement* lastElement;
    30   int listSize;
    31 
    32 
     27 
     28  int add (T* obj, ADDMODE mode, bool bRef);
     29  T* get_object();
     30  List<T>* get_next ();
     31  List<T>* get_previous ();
     32  List<T>* get_last ();
     33  List<T>* get_first ();
     34  void set_next (List<T>* ptr);
     35  void set_prev (List<T>* ptr);
     36  int remove (T* obj, FINDMODE mode);
    3337};
    3438
     39
     40/**
     41  \brief Standard constructor
     42 
     43  Call this without any parameters to generate a new List which can be filled with content.
     44  DO NOT create a List element that contains an object on your own, you'll lose the data
     45  contained in that object and will have trouble removing the list from your memory.
     46*/
     47template<class T>
     48List<T>::List (T* obj = NULL, List<T>* n = NULL, List<T>* p = NULL, bool bRef = false)
     49{
     50  object = obj;
     51  next = n;
     52  prev = p;
     53  bReference = bRef;
     54}
     55
     56/**
     57  \brief Standard destructor
     58 
     59  Call this on the initially generated base List element to remove the whole List from the memory.
     60  You can safely do this to any List element you want without messing up the rest of the List, but keep in mind
     61  that the contained object will be deleted as well when bRef had been set to false.
     62*/
     63template<class T>
     64List<T>::~List ()
     65{
     66  if (object == NULL) // deleted foot node => disband the list
     67  {
     68    while( next != NULL)
     69    {
     70      delete next;
     71    }
     72    while( prev != NULL)
     73    {
     74      delete prev;
     75    }
     76  }
     77  else
     78  {
     79    if (prev != NULL) prev->set_next (next);
     80    if (next != NULL) next->set_prev (prev);
     81    if (!bReference) delete object;
     82  }
     83}
     84 
     85/**
     86  \brief Add an object to the List
     87  \param obj: A pointer to an allocated object
     88  \param mode: A Value of ADDMODE (default: LIST_ADD_NEXT)
     89  \param bRef: Sets whether the element is serving as a storage point or a simple listing (default: false)
     90  \return 0 if the operation succeded, -1 if the element could not be added
     91 
     92  This adds a new List element to the chain. The mode parameter can be used to specify
     93  the location where the element should be added. LIST_ADD_NEXT will add the new element directly
     94  after the base element. LIST_ADD_PREV will add the new element directly before the base element.
     95  LIST_ADD_FIRST will add the element at the beginning of the List whereas LIST_ADD_LAST will add
     96  it to the end of the chain. If the bRef parameter is set to true, the object pointer will not be deleted
     97  when the element containing that object is deleted, thus the List can be used for temporary listings as
     98  well as permanent data storage.
     99*/
     100template<class T>
     101int List<T>::add (T* obj, ADDMODE mode = LIST_ADD_NEXT, bool bRef = false)
     102{
     103  List<T>* p;
     104  if( obj == NULL) return -1;
     105  switch (mode)
     106  {
     107    case LIST_ADD_NEXT:
     108      p = new List<T>( obj, next, this, bRef);
     109      if( next != NULL) next->set_prev (p);
     110      next = p;
     111      break;
     112    case LIST_ADD_PREV:
     113      p = new List<T>( obj, this, prev, bRef);
     114      if( prev != NULL) prev->set_next (p);
     115      prev = p;
     116      break;
     117    case LIST_ADD_FIRST:
     118      if (prev == NULL) prev = new List<T> (obj, this, NULL, bRef);
     119      else return prev->add (obj, mode, bRef);
     120      break;
     121    case LIST_ADD_LAST:
     122      if (next == NULL) next = new List<T> (obj, NULL, this, bRef);
     123      else return next->add (obj, mode, bRef);
     124      break;
     125    default:
     126        return -1;
     127      break;
     128  }
     129  return 0;
     130}
     131
     132/**
     133  \brief Get the next element of the List
     134  \return The List element after the current List element
     135*/
     136template<class T>
     137List<T>* List<T>::get_next ()
     138{
     139  return next;
     140}
     141 
     142/**
     143  \brief Get the previous element of the List
     144  \return The List element before the current List element
     145*/
     146template<class T>
     147List<T>* List<T>::get_previous ()
     148{
     149  return prev;
     150}
     151
     152/**
     153  \brief Get the last element of the List
     154  \return The last List element
     155*/
     156template<class T>
     157List<T>* List<T>::get_last ()
     158{
     159  if (next == NULL) return this;
     160  else return next->get_last();
     161}
     162
     163/**
     164  \brief Get the first element of the List
     165  \return The first List element
     166*/
     167template<class T>
     168List<T>* List<T>::get_first ()
     169{
     170  if (prev == NULL) return this;
     171  else return prev->get_first();
     172}
     173
     174/**
     175  \brief Removes a certain element from the List
     176  \param obj: A pointer to the object that should be removed
     177  \param mode: A value of FINDMODE
     178  \return 0 if the element was found and removed, -1 if the element was not found
     179 
     180  This searches the part of the List specified with mode for the object in question.
     181  When the object is found it is deleted and the List element is removed from the chain.
     182  If mode is LIST_FIND_FW all elements AFTER the base element are searched, if mode is
     183  LIST_FIND_BW all elements BEFORE the base element are searched. Note that the object
     184  contained within the List element is NOT deleted when bRef was set to true.
     185*/
     186template<class T>
     187int List<T>::remove (T* obj, FINDMODE mode = LIST_FIND_FW)
     188{
     189  if (obj == NULL) return -1;
     190  else
     191  {
     192    switch (mode)
     193    {
     194      case LIST_FIND_BW:
     195        if (prev == NULL) return -1;
     196        else
     197        {
     198          if( prev->get_object() == obj)
     199          {
     200            delete prev;
     201          }
     202          else
     203          {
     204            return prev->remove( obj, mode);
     205          }
     206        }
     207        break;
     208      case LIST_FIND_FW:
     209        if (next == NULL) return -1;
     210        else
     211        {
     212          if( next->get_object() == obj)
     213          {
     214            delete next;
     215          }
     216          else
     217          {
     218            return next->remove( obj, mode);
     219          }
     220        }
     221        break;
     222      default:
     223        return -1;
     224    }
     225  }
     226  return 0;
     227}
     228
     229/**
     230  \brief Set the next element of a List element
     231  \param ptr: A pointer to the new next element
     232   
     233  Sets the next element of a List element... Better not touch this, it can really mess up a List.
     234*/
     235template<class T>
     236void List<T>::set_next (List<T>* ptr)
     237{
     238  next = ptr;
     239}
     240
     241/**
     242  \brief Set the prev element of a List element
     243  \param ptr: A pointer to the new previous element
     244   
     245  Sets the previous element of a List element... Better not touch this, it can really mess up a List.
     246*/
     247template<class T>
     248void List<T>::set_prev (List<T>* ptr)
     249{
     250  prev = ptr;
     251}
     252
     253/**
     254  \brief Get the pointer to the object the element is containing
     255  \return The contained object (will be NULL if called on the base element).
     256*/
     257template<class T>
     258T* List<T>::get_object()
     259{
     260  return object;
     261}
     262
     263
     264
    35265#endif
     266
  • orxonox/trunk/src/world.cc

    r2036 r2077  
    2828#include "data_tank.h"
    2929
     30#include "list.h"
     31#include "world_entity.h"
     32
    3033#include "world.h"
    3134
     
    3740   \brief Create a new World
    3841   
    39    This creates a new empty world!
     42   This creates a new, empty world!
    4043*/
    4144World::World () {
    42   lastPlayer = null;
    43   lastNPC = null;
    44   lastEnv = null;
     45  //lastPlayer = null;
     46  //lastNPC = null;
     47  //lastEnv = null;
    4548  primitiveMove = 0;
    4649  step = 0;
     50
     51  //List<int> *list = new List<int>();
     52  npcList = new List<WorldEntity*>();
     53  playerList = new List<WorldEntity*>();
     54  envList = new List<WorldEntity*>();
    4755}
    4856
    4957
    5058World::~World () {}
     59
     60
     61
     62/**
     63   \brief Load a new World
     64   
     65   Load a new world. The old world (if any) will be unloaded and becomes unrecoverable.
     66*/
     67void World::loadWorld() {}
     68
     69
     70/**
     71   \brief Unloads a new World
     72   
     73   Unloads a world and frees the memory. You cant game until you have a new world loaded.
     74*/
     75void World::unloadWorld() {}
     76
     77
     78/**
     79   \brief Pause the game
     80   
     81   Pauses the game until the pause is released. During this time nothing moves at all and nothing is calculated. Use it if you have to go out of the game to read some mails...
     82*/
     83void World::pauseWorld() {}
     84
     85
     86/**
     87   \brief Save the game to file
     88   \param filename: the filename where the savegame should be saved to
     89   
     90   Saves the state of the game to a file. The state is catched like in a multiplayer game over a synchronisable interface.
     91*/
     92void World::saveGameState(char* filename) {}
     93
    5194
    5295
     
    59102bool World::addPlayer(Player* player)
    60103{
     104  WorldEntity *we;
     105  playerList->add(we);
     106  /*
    61107  playerList* listMember = new playerList;
    62108  listMember->player = player;
     
    72118    }
    73119  lastPlayer = listMember;
    74 }
    75 
     120  */
     121}
    76122
    77123/**
     
    79125   \param player A reference to the new npc object
    80126   
    81    Remove a new Player to the game.
     127   Remove a new Player to the game. This kills the player objects.
    82128*/
    83129bool World::removePlayer(Player* player) {
    84   cout << "World::removeNPC not implemented yet" << endl;
    85 }
    86 
     130  playerList->remove(player, LIST_FIND_BW);
     131}
     132
     133/**
     134   \brief Returns the player-entity controlled by the local gamer
     135   \return pointer to player object
     136   
     137   Remove a new Player to the game. This kills the player objects.
     138*/
    87139Player* World::getLocalPlayer()
    88140{
     
    99151bool World::addNPC(NPC* npc)
    100152{
     153  npcList->add(npc, LIST_ADD_NEXT);
     154  /*
    101155  npcList* listMember = new npcList;
    102156  listMember->npc = npc;
     
    112166    }
    113167  lastNPC = listMember;
     168  */
    114169}
    115170
     
    117172/**
    118173   \brief Remove Non-Player Character
    119    \param player A reference to the new npc object
    120    
    121    Remove a new Non-Player-Character to the game.
    122 */
    123 bool World::removeNPC(NPC* npc) {
    124 
     174   \param player A reference to the npc object
     175   
     176   Remove a Non-Player-Character to the game.
     177*/
     178bool World::removeNPC(NPC* npc)
     179{
     180  npcList->remove(npc, LIST_FIND_FW);
     181  /*
    125182  npcList* npcRef = lastNPC;
    126183  npcList* lastRef = lastNPC;
     
    128185    {
    129186      if ( npcRef->npc == npc ) {
    130         cout << "found" << endl;
     187        cout <
     188< "found" << endl;
    131189        if ( npcRef == lastRef ) {
    132190          lastNPC = lastNPC->next;
     
    148206    }
    149207  cout << "npc left" << endl;
     208  */
    150209}
    151210
     
    160219bool World::addEnv(Environment* env)
    161220{
     221  /*
    162222  envList* listMember = new envList;
    163223  listMember->env = env;
     
    173233    }
    174234  lastEnv = listMember;
     235  */
     236}
     237
     238/**
     239   \brief Remove an environmental object
     240   \param player A reference to the env object
     241   
     242   Remove a environment from the game.
     243*/
     244bool World::removeEnv(Environment* env)
     245{
     246 
    175247}
    176248
     
    189261  gluLookAt(0.0, -14.0 + DataTank::yOffset, 15.0, 0.0, 0.0 + DataTank::yOffset, 0.0, 0.0, 1.0, 0.0);
    190262  /* first draw all players */
     263
     264
     265  /*
    191266  playerList* tmpPlayer = lastPlayer;
    192267  Player* player = tmpPlayer->player;
     
    196271      tmpPlayer = tmpPlayer->next;
    197272    }
     273  */
    198274  /* second draw all npcs */
     275  /*
    199276  npcList* tmpNPC = lastNPC;
    200277  while( tmpNPC != null )
     
    203280      tmpNPC = tmpNPC->next;
    204281    }
     282  */
    205283
    206284  /* now draw the rest of the world: environement */
     285  /*
    207286  envList* tmpEnv = lastEnv;
    208287  while( tmpEnv != null )
     
    211290      tmpEnv = tmpEnv->next;
    212291    }
    213  
     292  */
     293
    214294  /* draw the ground grid  */
    215295  glColor3f(0.0, 1.0, 0.0);
     
    240320  DataTank::yOffset += step;
    241321
     322  /*
    242323  tmpPlayer = lastPlayer;
    243324  while( tmpPlayer != null )
     
    246327      tmpPlayer = tmpPlayer->next;
    247328    }
    248 
     329  */
    249330
    250331}
     
    291372void World::detectCollision()
    292373{
     374  /*
    293375  //cout << "World::detectCollision" << endl;
    294376  float xOff, yOff, zOff, radius;
    295377  npcList* tmpNPC, *tmpRef;
    296 
     378  */
    297379  //cout << "World::detectCollsions" << endl;
    298380  /* first: check if any player's shoots trigger a collision */
     381  /*
    299382  playerList* tmpPlayer = lastPlayer;
    300383  Player* player = tmpPlayer->player;
     
    318401                  //cout << "COLLISION " << endl;
    319402                  int state = tmpNPC->npc->hit();
     403  */
    320404                  /* state is a value that marks if the ship dies or not */
    321405                  /* if state == 0 the ship dies and we have to remove it */
     
    327411                    break;
    328412                  }
    329                   */
     413                 
    330414                }
    331415              shoota = shoota->next;
     
    338422      tmpPlayer = tmpPlayer->next;
    339423      //cout << "changing play done" << endl;
    340     }
    341 
     424     
     425    }
     426                  */
    342427  //cout << "World::detectCollisions middle" << endl;
    343428
    344429  /* second: check if any player hits an enemy */
     430/*
    345431  tmpPlayer = lastPlayer;
    346432  while( tmpPlayer != null )
     
    365451 
    366452 
    367 
     453*/
    368454  /* third: check if any enemy shoots a player */
    369455
     
    380466void World::testThaTest(void)
    381467{
     468/*
    382469  cout << "World::testThaTest() called" << endl;
    383   /* test addPlayer */
     470
    384471  cout << "addPlayer test..." << endl;
    385472  playerList* pl = lastPlayer;
     
    390477    }
    391478
    392   /* test addNPC */
     479
    393480  cout << "addNPC test..." << endl;
    394481  npcList* nl = lastNPC;
     
    400487
    401488
    402   /* test addEnv */
     489
    403490  cout << "addEnv test..." << endl;
    404491  envList* en = lastEnv;
     
    408495      en = en->next;
    409496    }
    410 
    411   /* test drawWorld() */
    412 }
     497*/
     498}
  • orxonox/trunk/src/world.h

    r2036 r2077  
     1/**
     2  Class representating the game-world
     3 
     4  It contains a list of players (if multiplayer game), a list of Non-Player-Characters (nps), a list of Environment Entities. All this things together are building the orxonox-world. This class also handels the story-line (track), the world start/stop, init/uninit abilities. It is the middle point of every orxonox world.
     5*/
    16
    27#ifndef WORLD_H
     
    611class NPC;
    712class Environment;
     13class WorldEntity;
     14
     15template<class T> class List;
    816
    917
     18
     19//! World Class
     20/**
     21  Class for World representation
     22 
     23  It contains a list of players (if multiplayer game), a list of Non-Player-Characters (nps), a list of Environment Entities. All this things together are building the orxonox-world. This class also handels the story-line (track), the world start/stop, init/uninit abilities. It is the middle point of every orxonox world.
     24*/
    1025class World {
    1126
     
    1429  ~World ();
    1530
    16   float primitiveMove;
    1731
    18   /* for easier use: map the first two player here */
    19   Player *localPlayer;
    20   Player *player1;
    21   Player *player2;
    2232
    23   /* a list of all players */
     33  float primitiveMove; //!< deprecated, do not use
     34
     35  Player *localPlayer; //!< a pointer to the local player object
     36  Player *player1;     //!< a pointer to the second player object
     37  Player *player2;     //!< a pointer to the third player object
     38
     39  /*
    2440  struct playerList {
    2541    playerList* next;
     
    2945  playerList* lastPlayer;
    3046
    31   /* a list of all non-player-characters */
    3247  struct npcList {
    3348    npcList* next;
     
    3752  npcList* lastNPC;
    3853
    39   /* a list of all environmental objects */
    4054  struct envList {
    4155    envList* next;
     
    4458  };
    4559  envList* lastEnv;
     60  */
    4661
    4762
    48 
     63  void loadWorld();
     64  void unloadWorld();
     65  void pauseWorld();
     66  void saveGameState(char* filename);
     67 
    4968
    5069  bool addPlayer(Player* player);
     
    5473  bool removeNPC(NPC* npc);
    5574  bool addEnv(Environment* env);
     75  bool removeEnv(Environment* env);
    5676
     77 
    5778  void drawWorld(void);
    5879  void initEnvironement(void);
     
    6384
    6485 private:
    65   float surface[120][120];
    66   float step;
     86  float surface[120][120]; //!< deprecated: used to build a surface
     87  float step; //!< this is the step
     88
     89  List<WorldEntity*> *playerList; //!< the list of players, usualy very short
     90  List<WorldEntity*> *npcList;  //!< list of non player characters (npc)
     91  List<WorldEntity*> *envList;  //!< list of environment objects
    6792
    6893
  • orxonox/trunk/src/world_entity.cc

    r2043 r2077  
    108108/**
    109109   \brief this method is called every tick
    110    \param time: the time since start of the world
     110   \param time: the time since the last frame was painted
    111111
    112112   This function is called before every repaint of the world, to update every time dependent variable of the entity. If the entity moves, it has to calculate the new position every tick here in this function. Do not use this for animations.
    113113*/
    114 void WorldEntity::tick(float time)
     114void WorldEntity::tick(float dt)
    115115{}
    116116
     
    121121*/
    122122void WorldEntity::paint()
    123 {
    124   cout << "WorldEntity::paint()" << endl;
    125 }
     123{}
    126124
    127125/* virtual void WorldEntity::actionEvent(Event* event); */
  • orxonox/trunk/src/world_entity.h

    r2043 r2077  
     1/*!
     2    \file world_entity.h
     3    \brief A base class for all objects in the world
     4   
     5    This is the base class of all objects in the game-world. If you want to have an object in the world, that can realy interact with other objects and that is also dispbayable etc. you have to extend this class and override the needed functions.
     6*/
     7
     8
    19
    210#ifndef WORLD_ENTITY_H
     
    816class Ability;
    917
     18//! WorldEntity
     19/**
     20  A base class for all objects in the world
     21
     22  This is the base class of all objects in the game-world. If you want to have an object in the world, that can realy interact with other objects and that is also dispbayable etc. you have to extend this class and override the needed functions.
     23*/
    1024class WorldEntity {
    1125
     
    2842  void removeAbility(Ability* ability);
    2943
    30   virtual void tick(float time);
     44  virtual void tick(float dt);
    3145  virtual void paint();
    3246  /* virtual void actionEvent(Event* event); */
     
    4357
    4458 private:
    45   Vector* position;
    46   Vector* orientation;
     59  Vector* position;    //!< position of the entity
     60  Vector* orientation; //!< orientation of the entity
    4761  /* List of abilities */
    48   float health;
    49   float speed;
     62  float health; //!< health of the entity, if any
     63  float speed; //!< speed of the entity if any
    5064  /* entity can be in the air or at ground: */
    51   int airGround;
     65  int airGround; //!< is it air or bound to the ground (ground=0, air=1)
    5266
    5367 
Note: See TracChangeset for help on using the changeset viewer.