Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/powerups/src/world_entities/weapons/aim.h @ 6685

Last change on this file since 6685 was 6512, checked in by bensch, 19 years ago

orxonox/trunk: loadParams is now virtual.
ALL THE CLASSES HAVE TO CALL

SuperClass::loadParams(root);

isntead of:
static_cast<SuperClass*>(this)→loadParams(root);

which was quite stupid anyways

File size: 1.6 KB
Line 
1/*!
2 * @file aim.h
3 *  Definition of
4 */
5
6#ifndef _AIM_H
7#define _AIM_H
8
9#include "p_node.h"
10#include "element_2d.h"
11
12// FORWARD DECLARATION
13class Model;
14class Text;
15class Material;
16class TiXmlElement;
17template<class T> class tAnimation;
18
19//! An Aim for zooming in on Targets.
20/**
21 * An Aim is a PNode, that is connected, to the Target, it has aquired
22 * The target becomes, if selected its Parent.
23 *
24 * Also the Aim is a Element2D, as it draws a cross onto the Target.
25 */
26class Aim : public PNode, public Element2D {
27
28 public:
29  Aim(PNode* source, const TiXmlElement* root = NULL);
30  virtual ~Aim();
31
32  void init();
33  virtual void loadParams(const TiXmlElement* root);
34
35  inline void setSource(PNode* source) { this->source = source; };
36
37  inline void selectTarget(PNode* target) { this->setParent(target); };
38  inline PNode* getTarget(PNode* target) { return this->getParent(); };
39
40  void searchTarget(float range);
41
42  void setSize(float size);
43  void setTexture(const char* textureFile);
44  /** @param rotationSpeed the speed at what the crosshair should rotate */
45  inline void setRotationSpeed(float rotationSpeed) { this->rotationSpeed = rotationSpeed; };
46
47  virtual void tick(float dt);
48  virtual void draw() const;
49
50 private:
51   Material*        material;             //!< a material for the Aim.
52   float            rotationSpeed;        //!< Speed of the Rotation.
53   tAnimation<Aim>* anim;
54
55   PNode*           source;               //!< Where this Shot has come from.
56
57   Text*            text;                 //!< A Text to display onto this Node. (distance to Target)
58};
59
60#endif /* _AIM_H */
Note: See TracBrowser for help on using the repository browser.