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 |
---|
13 | class Model; |
---|
14 | class Text; |
---|
15 | class Material; |
---|
16 | class TiXmlElement; |
---|
17 | template<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 | */ |
---|
26 | class 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 */ |
---|