Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/test/src/world_entities/weapons/aim.h @ 10292

Last change on this file since 10292 was 9869, checked in by bensch, 18 years ago

orxonox/trunk: merged the new_class_id branche back to the trunk.
merged with command:
svn merge https://svn.orxonox.net/orxonox/branches/new_class_id trunk -r9683:HEAD
no conflicts… puh..

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