aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/others/irrlicht-1.8.1/source/Irrlicht/CSceneNodeAnimatorCameraFPS.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/others/irrlicht-1.8.1/source/Irrlicht/CSceneNodeAnimatorCameraFPS.h')
-rw-r--r--src/others/irrlicht-1.8.1/source/Irrlicht/CSceneNodeAnimatorCameraFPS.h123
1 files changed, 123 insertions, 0 deletions
diff --git a/src/others/irrlicht-1.8.1/source/Irrlicht/CSceneNodeAnimatorCameraFPS.h b/src/others/irrlicht-1.8.1/source/Irrlicht/CSceneNodeAnimatorCameraFPS.h
new file mode 100644
index 0000000..9b4ad2e
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/source/Irrlicht/CSceneNodeAnimatorCameraFPS.h
@@ -0,0 +1,123 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __C_SCENE_NODE_ANIMATOR_CAMERA_FPS_H_INCLUDED__
6#define __C_SCENE_NODE_ANIMATOR_CAMERA_FPS_H_INCLUDED__
7
8#include "ISceneNodeAnimatorCameraFPS.h"
9#include "vector2d.h"
10#include "position2d.h"
11#include "SKeyMap.h"
12#include "irrArray.h"
13
14namespace irr
15{
16namespace gui
17{
18 class ICursorControl;
19}
20
21namespace scene
22{
23
24 //! Special scene node animator for FPS cameras
25 class CSceneNodeAnimatorCameraFPS : public ISceneNodeAnimatorCameraFPS
26 {
27 public:
28
29 //! Constructor
30 CSceneNodeAnimatorCameraFPS(gui::ICursorControl* cursorControl,
31 f32 rotateSpeed = 100.0f, f32 moveSpeed = .5f, f32 jumpSpeed=0.f,
32 SKeyMap* keyMapArray=0, u32 keyMapSize=0, bool noVerticalMovement=false,
33 bool invertY=false);
34
35 //! Destructor
36 virtual ~CSceneNodeAnimatorCameraFPS();
37
38 //! Animates the scene node, currently only works on cameras
39 virtual void animateNode(ISceneNode* node, u32 timeMs);
40
41 //! Event receiver
42 virtual bool OnEvent(const SEvent& event);
43
44 //! Returns the speed of movement in units per second
45 virtual f32 getMoveSpeed() const;
46
47 //! Sets the speed of movement in units per second
48 virtual void setMoveSpeed(f32 moveSpeed);
49
50 //! Returns the rotation speed
51 virtual f32 getRotateSpeed() const;
52
53 //! Set the rotation speed
54 virtual void setRotateSpeed(f32 rotateSpeed);
55
56 //! Sets the keyboard mapping for this animator (old style)
57 //! \param keymap: an array of keyboard mappings, see SKeyMap
58 //! \param count: the size of the keyboard map array
59 virtual void setKeyMap(SKeyMap *map, u32 count);
60
61 //! Sets the keyboard mapping for this animator
62 //! \param keymap The new keymap array
63 virtual void setKeyMap(const core::array<SKeyMap>& keymap);
64
65 //! Gets the keyboard mapping for this animator
66 virtual const core::array<SKeyMap>& getKeyMap() const;
67
68 //! Sets whether vertical movement should be allowed.
69 virtual void setVerticalMovement(bool allow);
70
71 //! Sets whether the Y axis of the mouse should be inverted.
72 /** If enabled then moving the mouse down will cause
73 the camera to look up. It is disabled by default. */
74 virtual void setInvertMouse(bool invert);
75
76 //! This animator will receive events when attached to the active camera
77 virtual bool isEventReceiverEnabled() const
78 {
79 return true;
80 }
81
82 //! Returns the type of this animator
83 virtual ESCENE_NODE_ANIMATOR_TYPE getType() const
84 {
85 return ESNAT_CAMERA_FPS;
86 }
87
88 //! Creates a clone of this animator.
89 /** Please note that you will have to drop
90 (IReferenceCounted::drop()) the returned pointer once you're
91 done with it. */
92 virtual ISceneNodeAnimator* createClone(ISceneNode* node, ISceneManager* newManager=0);
93
94 private:
95 void allKeysUp();
96
97 gui::ICursorControl *CursorControl;
98
99 f32 MaxVerticalAngle;
100
101 f32 MoveSpeed;
102 f32 RotateSpeed;
103 f32 JumpSpeed;
104 // -1.0f for inverted mouse, defaults to 1.0f
105 f32 MouseYDirection;
106
107 s32 LastAnimationTime;
108
109 core::array<SKeyMap> KeyMap;
110 core::position2d<f32> CenterCursor, CursorPos;
111
112 bool CursorKeys[EKA_COUNT];
113
114 bool firstUpdate;
115 bool firstInput;
116 bool NoVerticalMovement;
117 };
118
119} // end namespace scene
120} // end namespace irr
121
122#endif // __C_SCENE_NODE_ANIMATOR_CAMERA_FPS_H_INCLUDED__
123