Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 7993 was 7221, checked in by bensch, 19 years ago

orxonox/trunk: merged the std-branche back, it runs on windows and Linux

svn merge https://svn.orxonox.net/orxonox/branches/std . -r7202:HEAD

File size: 1.9 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#include "object_manager.h"
12
13// FORWARD DECLARATION
14class Model;
15class Text;
16class Material;
17class TiXmlElement;
18template<class T> class tAnimation;
19
20//! An Aim for zooming in on Targets.
21/**
22 * An Aim is a PNode, that is connected, to the Target, it has aquired
23 * The target becomes, if selected its Parent.
24 *
25 * Also the Aim is a Element2D, as it draws a cross onto the Target.
26 */
27class Aim : public PNode, public Element2D {
28
29 public:
30  Aim(PNode* source, const TiXmlElement* root = NULL);
31  virtual ~Aim();
32
33  void init();
34  virtual void loadParams(const TiXmlElement* root);
35
36  inline void setSource(PNode* source) { this->source = source; };
37
38  inline void selectTarget(PNode* target) { this->setParent(target); };
39  inline PNode* getTarget(PNode* target) { return this->getParent(); };
40
41  void searchTarget();
42
43  void setRange(float range){this->range = range;};
44  void setAngle(float angle){this->angle = angle;};
45  void setGroup(OM_LIST group){this->group = group;};
46
47  void setSize(float size);
48  void setTexture(const std::string& textureFile);
49  /** @param rotationSpeed the speed at what the crosshair should rotate */
50  inline void setRotationSpeed(float rotationSpeed) { this->rotationSpeed = rotationSpeed; };
51
52  virtual void tick(float dt);
53  virtual void draw() const;
54
55 private:
56   Material*        material;             //!< a material for the Aim.
57   float            rotationSpeed;        //!< Speed of the Rotation.
58   tAnimation<Aim>* anim;
59
60   float            range;                //!<
61   float            angle;                //!<
62   Vector           diffVec;
63   OM_LIST          group;
64
65   PNode*           source;               //!< Where this Shot has come from.
66
67   Text*            text;                 //!< A Text to display onto this Node. (distance to Target)
68};
69
70#endif /* _AIM_H */
Note: See TracBrowser for help on using the repository browser.