Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/trunk/src/world_entities/weapons/aim.h @ 6695

Last change on this file since 6695 was 6637, checked in by bensch, 19 years ago

orxonox/trunk: merged the SpaceShipControl branche back to the trunk

merged with command:
svn merge https://svn.orxonox.net/orxonox/branches/spaceshipcontrol . -r6482:HEAD

minor conflicts, and added file hover.cc/h to the Makefile.

File size: 1.8 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();
41
42  void setRange(float range){this->range = range;};
43  void setAngle(float angle){this->angle = angle;};
44
45  void setSize(float size);
46  void setTexture(const char* textureFile);
47  /** @param rotationSpeed the speed at what the crosshair should rotate */
48  inline void setRotationSpeed(float rotationSpeed) { this->rotationSpeed = rotationSpeed; };
49
50  virtual void tick(float dt);
51  virtual void draw() const;
52
53 private:
54   Material*        material;             //!< a material for the Aim.
55   float            rotationSpeed;        //!< Speed of the Rotation.
56   tAnimation<Aim>* anim;
57
58   float            range;                //!<
59   float            angle;                //!<
60
61   PNode*           source;               //!< Where this Shot has come from.
62
63   Text*            text;                 //!< A Text to display onto this Node. (distance to Target)
64};
65
66#endif /* _AIM_H */
Note: See TracBrowser for help on using the repository browser.