#ifndef __C_SCENE_NODE_ANIMATOR_CAMERA_FPS_H_INCLUDED__
#define __C_SCENE_NODE_ANIMATOR_CAMERA_FPS_H_INCLUDED__
#include "ISceneNodeAnimatorCameraFPS.h"
#include "vector2d.h"
#include "position2d.h"
#include "SKeyMap.h"
#include "irrArray.h"
namespace irr
{
namespace gui
{
class ICursorControl;
}
namespace scene
{
class CSceneNodeAnimatorCameraFPS : public ISceneNodeAnimatorCameraFPS
{
public:
CSceneNodeAnimatorCameraFPS(gui::ICursorControl* cursorControl,
f32 rotateSpeed = 100.0f, f32 moveSpeed = .5f, f32 jumpSpeed=0.f,
SKeyMap* keyMapArray=0, u32 keyMapSize=0, bool noVerticalMovement=false,
bool invertY=false);
virtual ~CSceneNodeAnimatorCameraFPS();
virtual void animateNode(ISceneNode* node, u32 timeMs);
virtual bool OnEvent(const SEvent& event);
virtual f32 getMoveSpeed() const;
virtual void setMoveSpeed(f32 moveSpeed);
virtual f32 getRotateSpeed() const;
virtual void setRotateSpeed(f32 rotateSpeed);
virtual void setKeyMap(SKeyMap *map, u32 count);
virtual void setVerticalMovement(bool allow);
virtual void setInvertMouse(bool invert);
virtual bool isEventReceiverEnabled() const
{
return true;
}
virtual ESCENE_NODE_ANIMATOR_TYPE getType() const
{
return ESNAT_CAMERA_FPS;
}
virtual ISceneNodeAnimator* createClone(ISceneNode* node, ISceneManager* newManager=0);
struct SCamKeyMap
{
SCamKeyMap() {};
SCamKeyMap(s32 a, EKEY_CODE k) : action(a), keycode(k) {}
s32 action;
EKEY_CODE keycode;
};
void setKeyMap(const core::array<SCamKeyMap>& keymap);
private:
void allKeysUp();
gui::ICursorControl *CursorControl;
f32 MaxVerticalAngle;
f32 MoveSpeed;
f32 RotateSpeed;
f32 JumpSpeed;
f32 MouseYDirection;
s32 LastAnimationTime;
core::array<SCamKeyMap> KeyMap;
core::position2d<f32> CenterCursor, CursorPos;
bool CursorKeys[6];
bool firstUpdate;
bool NoVerticalMovement;
};
}
}
#endif