Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 8310 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
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"
[6724]11#include "object_manager.h"
[5557]12
[5405]13// FORWARD DECLARATION
[4830]14class Model;
[5750]15class Text;
[4830]16class Material;
[4832]17class TiXmlElement;
[5750]18template<class T> class tAnimation;
[3543]19
[5556]20//! An Aim for zooming in on Targets.
[5750]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 */
[5556]27class Aim : public PNode, public Element2D {
[2036]28
[1904]29 public:
[5750]30  Aim(PNode* source, const TiXmlElement* root = NULL);
[5556]31  virtual ~Aim();
[1853]32
[4832]33  void init();
[6512]34  virtual void loadParams(const TiXmlElement* root);
[3245]35
[5750]36  inline void setSource(PNode* source) { this->source = source; };
37
[5557]38  inline void selectTarget(PNode* target) { this->setParent(target); };
39  inline PNode* getTarget(PNode* target) { return this->getParent(); };
40
[6637]41  void searchTarget();
[5557]42
[6637]43  void setRange(float range){this->range = range;};
44  void setAngle(float angle){this->angle = angle;};
[6724]45  void setGroup(OM_LIST group){this->group = group;};
[6637]46
[4832]47  void setSize(float size);
[7221]48  void setTexture(const std::string& textureFile);
[4832]49  /** @param rotationSpeed the speed at what the crosshair should rotate */
[5557]50  inline void setRotationSpeed(float rotationSpeed) { this->rotationSpeed = rotationSpeed; };
[4832]51
[4849]52  virtual void tick(float dt);
53  virtual void draw() const;
[4779]54
[3245]55 private:
[4830]56   Material*        material;             //!< a material for the Aim.
[4832]57   float            rotationSpeed;        //!< Speed of the Rotation.
[5750]58   tAnimation<Aim>* anim;
59
[6637]60   float            range;                //!<
61   float            angle;                //!<
[6724]62   Vector           diffVec;
63   OM_LIST          group;
[6637]64
[5750]65   PNode*           source;               //!< Where this Shot has come from.
66
67   Text*            text;                 //!< A Text to display onto this Node. (distance to Target)
[1853]68};
69
[5556]70#endif /* _AIM_H */
Note: See TracBrowser for help on using the repository browser.