Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/spaceshipcontrol/src/world_entities/weapons/aim.h @ 6606

Last change on this file since 6606 was 6606, checked in by snellen, 18 years ago

aim.cc, targeting_turret.cc and aiming turret.cc updated

File size: 1.6 KB
RevLine 
[4779]1/*!
[5556]2 * @file aim.h
3 *  Definition of
4 */
[3329]5
[5556]6#ifndef _AIM_H
7#define _AIM_H
[1853]8
[4849]9#include "p_node.h"
10#include "element_2d.h"
[5557]11
[5405]12// FORWARD DECLARATION
[4830]13class Model;
[5750]14class Text;
[4830]15class Material;
[4832]16class TiXmlElement;
[5750]17template<class T> class tAnimation;
[3543]18
[5556]19//! An Aim for zooming in on Targets.
[5750]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 */
[5556]26class Aim : public PNode, public Element2D {
[2036]27
[1904]28 public:
[5750]29  Aim(PNode* source, const TiXmlElement* root = NULL);
[5556]30  virtual ~Aim();
[1853]31
[4832]32  void init();
33  void loadParams(const TiXmlElement* root);
[3245]34
[5750]35  inline void setSource(PNode* source) { this->source = source; };
36
[5557]37  inline void selectTarget(PNode* target) { this->setParent(target); };
38  inline PNode* getTarget(PNode* target) { return this->getParent(); };
39
[6606]40  void searchTarget(float range, float angle);
[5557]41
[4832]42  void setSize(float size);
43  void setTexture(const char* textureFile);
44  /** @param rotationSpeed the speed at what the crosshair should rotate */
[5557]45  inline void setRotationSpeed(float rotationSpeed) { this->rotationSpeed = rotationSpeed; };
[4832]46
[4849]47  virtual void tick(float dt);
48  virtual void draw() const;
[4779]49
[3245]50 private:
[4830]51   Material*        material;             //!< a material for the Aim.
[4832]52   float            rotationSpeed;        //!< Speed of the Rotation.
[5750]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)
[1853]58};
59
[5556]60#endif /* _AIM_H */
Note: See TracBrowser for help on using the repository browser.