Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5556 in orxonox.OLD for trunk/src


Ignore:
Timestamp:
Nov 13, 2005, 2:49:48 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: added Aim-class

Location:
trunk/src
Files:
8 edited
2 copied

Legend:

Unmodified
Added
Removed
  • trunk/src/Makefile.am

    r5549 r5556  
    6565                  world_entities/weapons/rocket.cc \
    6666                  world_entities/weapons/laser.cc \
     67                  world_entities/weapons/aim.cc \
    6768                  world_entities/weapons/crosshair.cc \
    6869                  world_entities/power_ups/power_up.cc \
     
    9899                 world_entities/weapons/rocket.h \
    99100                 world_entities/weapons/laser.h \
     101                 world_entities/weapons/aim.h \
    100102                 world_entities/weapons/crosshair.h \
    101103                 world_entities/power_ups/power_up.h \
  • trunk/src/Makefile.in

    r5549 r5556  
    6666        orxonox-test_gun.$(OBJEXT) orxonox-turret.$(OBJEXT) \
    6767        orxonox-test_bullet.$(OBJEXT) orxonox-rocket.$(OBJEXT) \
    68         orxonox-laser.$(OBJEXT) orxonox-crosshair.$(OBJEXT) \
    69         orxonox-power_up.$(OBJEXT) orxonox-turret_power_up.$(OBJEXT) \
     68        orxonox-laser.$(OBJEXT) orxonox-aim.$(OBJEXT) \
     69        orxonox-crosshair.$(OBJEXT) orxonox-power_up.$(OBJEXT) \
     70        orxonox-turret_power_up.$(OBJEXT) \
    7071        orxonox-laser_power_up.$(OBJEXT) orxonox-benchmark.$(OBJEXT)
    7172orxonox_OBJECTS = $(am_orxonox_OBJECTS)
     
    259260                  world_entities/weapons/rocket.cc \
    260261                  world_entities/weapons/laser.cc \
     262                  world_entities/weapons/aim.cc \
    261263                  world_entities/weapons/crosshair.cc \
    262264                  world_entities/power_ups/power_up.cc \
     
    292294                 world_entities/weapons/rocket.h \
    293295                 world_entities/weapons/laser.h \
     296                 world_entities/weapons/aim.h \
    294297                 world_entities/weapons/crosshair.h \
    295298                 world_entities/power_ups/power_up.h \
     
    392395        -rm -f *.tab.c
    393396
     397@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/orxonox-aim.Po@am__quote@
    394398@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/orxonox-benchmark.Po@am__quote@
    395399@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/orxonox-camera.Po@am__quote@
     
    771775@AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    772776@am__fastdepCXX_FALSE@  $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(orxonox_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o orxonox-laser.obj `if test -f 'world_entities/weapons/laser.cc'; then $(CYGPATH_W) 'world_entities/weapons/laser.cc'; else $(CYGPATH_W) '$(srcdir)/world_entities/weapons/laser.cc'; fi`
     777
     778orxonox-aim.o: world_entities/weapons/aim.cc
     779@am__fastdepCXX_TRUE@   if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(orxonox_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT orxonox-aim.o -MD -MP -MF "$(DEPDIR)/orxonox-aim.Tpo" -c -o orxonox-aim.o `test -f 'world_entities/weapons/aim.cc' || echo '$(srcdir)/'`world_entities/weapons/aim.cc; \
     780@am__fastdepCXX_TRUE@   then mv -f "$(DEPDIR)/orxonox-aim.Tpo" "$(DEPDIR)/orxonox-aim.Po"; else rm -f "$(DEPDIR)/orxonox-aim.Tpo"; exit 1; fi
     781@AMDEP_TRUE@@am__fastdepCXX_FALSE@      source='world_entities/weapons/aim.cc' object='orxonox-aim.o' libtool=no @AMDEPBACKSLASH@
     782@AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     783@am__fastdepCXX_FALSE@  $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(orxonox_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o orxonox-aim.o `test -f 'world_entities/weapons/aim.cc' || echo '$(srcdir)/'`world_entities/weapons/aim.cc
     784
     785orxonox-aim.obj: world_entities/weapons/aim.cc
     786@am__fastdepCXX_TRUE@   if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(orxonox_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT orxonox-aim.obj -MD -MP -MF "$(DEPDIR)/orxonox-aim.Tpo" -c -o orxonox-aim.obj `if test -f 'world_entities/weapons/aim.cc'; then $(CYGPATH_W) 'world_entities/weapons/aim.cc'; else $(CYGPATH_W) '$(srcdir)/world_entities/weapons/aim.cc'; fi`; \
     787@am__fastdepCXX_TRUE@   then mv -f "$(DEPDIR)/orxonox-aim.Tpo" "$(DEPDIR)/orxonox-aim.Po"; else rm -f "$(DEPDIR)/orxonox-aim.Tpo"; exit 1; fi
     788@AMDEP_TRUE@@am__fastdepCXX_FALSE@      source='world_entities/weapons/aim.cc' object='orxonox-aim.obj' libtool=no @AMDEPBACKSLASH@
     789@AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     790@am__fastdepCXX_FALSE@  $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(orxonox_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o orxonox-aim.obj `if test -f 'world_entities/weapons/aim.cc'; then $(CYGPATH_W) 'world_entities/weapons/aim.cc'; else $(CYGPATH_W) '$(srcdir)/world_entities/weapons/aim.cc'; fi`
    773791
    774792orxonox-crosshair.o: world_entities/weapons/crosshair.cc
  • trunk/src/defs/include_paths.am

    r5342 r5556  
    11AM_CXXFLAGS=-I$(MAINSRCDIR)
    22AM_CXXFLAGS+=-I$(MAINSRCDIR)/world_entities
    3 AM_CXXFLAGS+=-I$(MAINSRCDIR)/world_entities/weapons
    43AM_CXXFLAGS+=-I$(MAINSRCDIR)/story_entities
    54AM_CXXFLAGS+=-I$(MAINSRCDIR)/lib
  • trunk/src/story_entities/world.cc

    r5447 r5556  
    6161#include "factory.h"
    6262
    63 #include "projectile.h"
     63#include "weapons/projectile.h"
    6464#include "event_handler.h"
    6565
  • trunk/src/util/loading/load_param.h

    r5549 r5556  
    3636class LoadClassDescription;
    3737class LoadParamDescription;
     38class MultiType;
    3839
    3940/**************************
     
    4546 public:
    4647  LoadParamBase* describe(const char* descriptionText);
     48  LoadParamBase* defaultValues(unsigned int count, ...);
    4749
    4850 protected:
     
    5456  const char*              loadString;           //!< The string loaded by this LoadParam
    5557  const void*              pointerToParam;       //!< A Pointer to a Parameter.
     58
     59  MultiType*               defaultValue;
    5660};
    5761
     
    9397#define LoadParam0() \
    9498LoadParam(const TiXmlElement* root, const char* paramName, T* pt2Object, void(T::*function)(), bool multi = false) \
    95   : LoadParamBase(root, pt2Object, paramName, 0, multi, NULL, "") \
     99  : LoadParamBase(root, pt2Object, paramName, 0, multi, NULL) \
    96100{ \
    97101  if (loadString != NULL && root != NULL) \
  • trunk/src/util/loading/load_param_description.cc

    r5549 r5556  
    1515
    1616#include "load_param_description.h"
     17
    1718#include "list.h"
    1819#include <stdarg.h>
  • trunk/src/util/loading/load_param_description.h

    r5549 r5556  
    2626// Forward Declaration //
    2727template<class T> class tList;
     28class MultiType;
    2829
    2930/************************
     
    4950  int*          types;                 //!< What kind of parameters does this function take ??
    5051  char*         description;           //!< A longer description about this function.
    51   char**        defaultValues;         //!< The 'Default Values'.
     52  char**        defaultValues;         //!< The 'Default Values'. @TODO MAKE THIS A MULTITYPE
    5253};
    5354
     
    7172 private:
    7273  static bool                          parametersDescription;  //!< if parameter-description should be enabled.
    73   static tList<LoadClassDescription>*  classList;              //!< a list, that holds all the loadable classes. (after one instance has been loaded)
     74  static tList<LoadClassDescription>*  classList;              //!< a list, that stores all the loadable classes. (after one instance has been loaded)
    7475  char*                                className;              //!< name of the class
     76
    7577  tList<LoadParamDescription>*         paramList;              //!< List of parameters this class knows.
    7678};
  • trunk/src/world_entities/player.cc

    r5500 r5556  
    2323#include "factory.h"
    2424
    25 #include "weapon_manager.h"
    26 #include "test_gun.h"
    27 #include "turret.h"
     25#include "weapons/weapon_manager.h"
     26#include "weapons/test_gun.h"
     27#include "weapons/turret.h"
    2828
    2929#include "list.h"
  • trunk/src/world_entities/weapons/aim.cc

    r5554 r5556  
    1616#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WEAPON
    1717
    18 #include "crosshair.h"
    19 #include "event_handler.h"
     18#include "aim.h"
    2019
    2120#include "load_param.h"
     
    3130 * standart constructor
    3231 */
    33 Crosshair::Crosshair (const TiXmlElement* root)
     32Aim::Aim (const TiXmlElement* root)
    3433{
    3534  this->init();
     
    4241
    4342/**
    44  * destroys a Crosshair
     43 * destroys a Aim
    4544*/
    46 Crosshair::~Crosshair ()
     45Aim::~Aim ()
    4746{
    4847  if (this->material)
     
    5655
    5756/**
    58  * initializes the Crosshair
     57 * initializes the Aim
    5958 */
    60 void Crosshair::init()
     59void Aim::init()
    6160{
    62   this->setClassID(CL_CROSSHAIR, "Crosshair");
    63   this->setName("Crosshair");
     61  this->setClassID(CL_CROSSHAIR, "Aim");
     62  this->setName("Aim");
    6463
    6564  this->setLayer(E2D_LAYER_TOP);
     
    7069  this->material = new Material;
    7170
    72   EventHandler::getInstance()->subscribe(this, ES_GAME, EV_MOUSE_MOTION);
    73 
    7471  // center the mouse on the screen, and also hide the cursors
    7572  SDL_WarpMouse(GraphicsEngine::getInstance()->getResolutionX()/2, GraphicsEngine::getInstance()->getResolutionY()/2);
     
    7976
    8077
    81 void Crosshair::loadParams(const TiXmlElement* root)
     78void Aim::loadParams(const TiXmlElement* root)
    8279{
    8380  static_cast<PNode*>(this)->loadParams(root);
    84   static_cast<EventListener*>(this)->loadParams(root);
    8581
    86   LoadParam<Crosshair>(root, "texture", this, &Crosshair::setTexture)
    87       .describe("the texture-file to load onto the Crosshair");
     82  LoadParam<Aim>(root, "texture", this, &Aim::setTexture)
     83      .describe("the texture-file to load onto the Aim");
    8884
    89   LoadParam<Crosshair>(root, "size", this, &Crosshair::setSize)
    90       .describe("the size of the Crosshair in Pixels");
     85  LoadParam<Aim>(root, "size", this, &Aim::setSize)
     86      .describe("the size of the Aim in Pixels");
    9187
    92   LoadParam<Crosshair>(root, "rotation-speed", this, &Crosshair::setRotationSpeed)
    93       .describe("the Speed with which the Crosshair should rotate");
     88  LoadParam<Aim>(root, "rotation-speed", this, &Aim::setRotationSpeed)
     89      .describe("the Speed with which the Aim should rotate");
    9490}
    9591
    9692
    9793/**
    98  * sets the size of the Crosshair.
     94 * sets the size of the Aim.
    9995 * @param size the size in pixels
    10096 */
    101 void Crosshair::setSize(float size)
     97void Aim::setSize(float size)
    10298{
    10399  this->setSize2D(size/2, size/2);
     
    108104 * @param textureFile The texture-file to load onto the crosshair
    109105 */
    110 void Crosshair::setTexture(const char* textureFile)
     106void Aim::setTexture(const char* textureFile)
    111107{
    112108  this->material->setDiffuseMap(textureFile);
     
    114110
    115111/**
    116  * processes the input
    117  * @param event the Event coming as input
    118  */
    119 void Crosshair::process(const Event &event)
    120 {
    121   if  (event.type == EV_MOUSE_MOTION)
    122   {
    123     this->setAbsCoor2D(event.x, event.y);
    124   }
    125 }
    126 
    127 /**
    128  * ticks the Crosshair
     112 * ticks the Aim
    129113 * @param dt the time to ticks
    130114 */
    131 void Crosshair::tick(float dt)
     115void Aim::tick(float dt)
    132116{
    133117  // let the crosshair rotate
     
    162146 * draws the crosshair
    163147 */
    164 void Crosshair::draw() const
     148void Aim::draw() const
    165149{
    166150  glPushMatrix();
  • trunk/src/world_entities/weapons/aim.h

    r5554 r5556  
    11/*!
    2  * @file crosshair.h
    3   *  Definition of ...
     2 * @file aim.h
     3 *  Definition of
     4 */
    45
    5 */
    6 
    7 #ifndef _CROSSHAIR_H
    8 #define _CROSSHAIR_H
     6#ifndef _AIM_H
     7#define _AIM_H
    98
    109#include "p_node.h"
    1110#include "element_2d.h"
    12 #include "event_listener.h"
    13 
    14 #include "vector.h"
    15 
    16 
    1711// FORWARD DECLARATION
    1812class Model;
     
    2014class TiXmlElement;
    2115
    22 //! A class that enables the
    23 class Crosshair : public PNode, public Element2D, public EventListener {
     16//! An Aim for zooming in on Targets.
     17class Aim : public PNode, public Element2D {
    2418
    2519 public:
    26   Crosshair(const TiXmlElement* root = NULL);
    27   virtual ~Crosshair();
     20  Aim(const TiXmlElement* root = NULL);
     21  virtual ~Aim();
    2822
    2923  void init();
     
    3529  void setRotationSpeed(float rotationSpeed) { this->rotationSpeed = rotationSpeed; };
    3630
    37   virtual void process(const Event &event);
    3831  virtual void tick(float dt);
    3932  virtual void draw() const;
     
    4437};
    4538
    46 #endif /* _CROSSHAIR_H */
     39#endif /* _AIM_H */
Note: See TracChangeset for help on using the changeset viewer.