Changeset 5556 in orxonox.OLD for trunk/src/world_entities
- Timestamp:
- Nov 13, 2005, 2:49:48 PM (19 years ago)
- Location:
- trunk/src/world_entities
- Files:
-
- 1 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/world_entities/player.cc
r5500 r5556 23 23 #include "factory.h" 24 24 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" 28 28 29 29 #include "list.h" -
trunk/src/world_entities/weapons/aim.cc
r5554 r5556 16 16 #define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WEAPON 17 17 18 #include "crosshair.h" 19 #include "event_handler.h" 18 #include "aim.h" 20 19 21 20 #include "load_param.h" … … 31 30 * standart constructor 32 31 */ 33 Crosshair::Crosshair(const TiXmlElement* root)32 Aim::Aim (const TiXmlElement* root) 34 33 { 35 34 this->init(); … … 42 41 43 42 /** 44 * destroys a Crosshair43 * destroys a Aim 45 44 */ 46 Crosshair::~Crosshair()45 Aim::~Aim () 47 46 { 48 47 if (this->material) … … 56 55 57 56 /** 58 * initializes the Crosshair57 * initializes the Aim 59 58 */ 60 void Crosshair::init()59 void Aim::init() 61 60 { 62 this->setClassID(CL_CROSSHAIR, " Crosshair");63 this->setName(" Crosshair");61 this->setClassID(CL_CROSSHAIR, "Aim"); 62 this->setName("Aim"); 64 63 65 64 this->setLayer(E2D_LAYER_TOP); … … 70 69 this->material = new Material; 71 70 72 EventHandler::getInstance()->subscribe(this, ES_GAME, EV_MOUSE_MOTION);73 74 71 // center the mouse on the screen, and also hide the cursors 75 72 SDL_WarpMouse(GraphicsEngine::getInstance()->getResolutionX()/2, GraphicsEngine::getInstance()->getResolutionY()/2); … … 79 76 80 77 81 void Crosshair::loadParams(const TiXmlElement* root)78 void Aim::loadParams(const TiXmlElement* root) 82 79 { 83 80 static_cast<PNode*>(this)->loadParams(root); 84 static_cast<EventListener*>(this)->loadParams(root);85 81 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"); 88 84 89 LoadParam< Crosshair>(root, "size", this, &Crosshair::setSize)90 .describe("the size of the Crosshairin Pixels");85 LoadParam<Aim>(root, "size", this, &Aim::setSize) 86 .describe("the size of the Aim in Pixels"); 91 87 92 LoadParam< Crosshair>(root, "rotation-speed", this, &Crosshair::setRotationSpeed)93 .describe("the Speed with which the Crosshairshould rotate");88 LoadParam<Aim>(root, "rotation-speed", this, &Aim::setRotationSpeed) 89 .describe("the Speed with which the Aim should rotate"); 94 90 } 95 91 96 92 97 93 /** 98 * sets the size of the Crosshair.94 * sets the size of the Aim. 99 95 * @param size the size in pixels 100 96 */ 101 void Crosshair::setSize(float size)97 void Aim::setSize(float size) 102 98 { 103 99 this->setSize2D(size/2, size/2); … … 108 104 * @param textureFile The texture-file to load onto the crosshair 109 105 */ 110 void Crosshair::setTexture(const char* textureFile)106 void Aim::setTexture(const char* textureFile) 111 107 { 112 108 this->material->setDiffuseMap(textureFile); … … 114 110 115 111 /** 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 129 113 * @param dt the time to ticks 130 114 */ 131 void Crosshair::tick(float dt)115 void Aim::tick(float dt) 132 116 { 133 117 // let the crosshair rotate … … 162 146 * draws the crosshair 163 147 */ 164 void Crosshair::draw() const148 void Aim::draw() const 165 149 { 166 150 glPushMatrix(); -
trunk/src/world_entities/weapons/aim.h
r5554 r5556 1 1 /*! 2 * @file crosshair.h 3 * Definition of ... 2 * @file aim.h 3 * Definition of 4 */ 4 5 5 */ 6 7 #ifndef _CROSSHAIR_H 8 #define _CROSSHAIR_H 6 #ifndef _AIM_H 7 #define _AIM_H 9 8 10 9 #include "p_node.h" 11 10 #include "element_2d.h" 12 #include "event_listener.h"13 14 #include "vector.h"15 16 17 11 // FORWARD DECLARATION 18 12 class Model; … … 20 14 class TiXmlElement; 21 15 22 //! A class that enables the23 class Crosshair : public PNode, public Element2D, public EventListener{16 //! An Aim for zooming in on Targets. 17 class Aim : public PNode, public Element2D { 24 18 25 19 public: 26 Crosshair(const TiXmlElement* root = NULL);27 virtual ~ Crosshair();20 Aim(const TiXmlElement* root = NULL); 21 virtual ~Aim(); 28 22 29 23 void init(); … … 35 29 void setRotationSpeed(float rotationSpeed) { this->rotationSpeed = rotationSpeed; }; 36 30 37 virtual void process(const Event &event);38 31 virtual void tick(float dt); 39 32 virtual void draw() const; … … 44 37 }; 45 38 46 #endif /* _ CROSSHAIR_H */39 #endif /* _AIM_H */
Note: See TracChangeset
for help on using the changeset viewer.