I've decided to see If I would be able to add my FPS Camera features to IRRlicht as a advanced FPS camera.
I was able to copy and create a copy of the FPS Camera animator, defined it as a new name, incorporated the new name also in the scene manager, and added the new ACTIONs in the SKEYMAP.H file.
I compiled back the code in MSCV 2008 (Express) and it compiled without any error. The new features are not there yet but the "base template" is there and working. Compiled and tried some demos, all seem ok so far.
The original modified files are theses:
include/SKeyMap.h --> Added new SKeyMap with more actions
source/CSceneManager.h --> Added the new camera animator as a defined camera
source/CSceneManager.cpp --> Added the new camera animator as a defined camera
Added files:
include/ISceneNodeAnimatorCameraFPS_Adv.h --> Current copy of the FPS camera animator
source/CSceneNodeAnimatorCameraFPS_Adv.cpp --> Current copy of the FPS camera animator
source/CSceneNodeAnimatorCameraFPS_Adv.h --> Current copy of the FPS camera animator
For the new SKeyMap. I think I have a small problem. Got some kind enum error, when I define it in the new FPS Cam animator. I'll will find out where the problem is with the code. Right now, reverted it back as the copy of the FPS Cam Animator.
Here the current code of SKeyMap.h:
Code: Select all
// Copyright (C) 2002-2008 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __S_KEY_MAP_H_INCLUDED__
#define __S_KEY_MAP_H_INCLUDED__
#include "Keycodes.h"
namespace irr
{
//! enumeration for key actions. Used for example in the FPS Camera.
enum EKEY_ACTION
{
EKA_MOVE_FORWARD = 0,
EKA_MOVE_BACKWARD,
EKA_STRAFE_LEFT,
EKA_STRAFE_RIGHT,
EKA_JUMP_UP,
EKA_COUNT,
//! This value is not used. It only forces this enumeration to compile in 32 bit.
EKA_FORCE_32BIT = 0x7fffffff
};
//! Struct storing which key belongs to which action.
struct SKeyMap
{
EKEY_ACTION Action;
EKEY_CODE KeyCode;
};
//! enumeration for key actions. Used for example in the FPS Camera, support more actions.
enum EKEY_ACTION_ADVANCED
{
EKAA_MOVE_FORWARD = 0,
EKAA_MOVE_BACKWARD,
EKAA_STRAFE_LEFT,
EKAA_STRAFE_RIGHT,
EKAA_JUMP_UP,
EKAA_TILT_LEFT,
EKAA_TILT_RIGHT,
EKAA_SPRINT,
EKAA_CROUCH,
EKAA_CRAWL,
EKAA_ATTACK0,
EKAA_ATTACK1,
EKAA_ATTACK2,
EKAA_ATTACK3,
EKAA_ATTACK4,
EKAA_WEAPON0,
EKAA_WEAPON1,
EKAA_WEAPON2,
EKAA_WEAPON3,
EKAA_WEAPON4,
EKAA_WEAPON5,
EKAA_WEAPON6,
EKAA_WEAPON7,
EKAA_WEAPON8,
EKAA_WEAPON9,
EKAA_USE,
EKAA_INVENTORY,
EKAA_DROP,
EKAA_OPTIONS,
EKAA_CONSOLE,
EKAA_MENU,
EKAA_COUNT,
//! This value is not used. It only forces this enumeration to compile in 32 bit.
EKAA_FORCE_32BIT = 0x7fffffff
};
//! Struct storing which key belongs to which action.
struct SKeyMap_Adv
{
EKEY_ACTION_ADVANCED Action;
EKEY_CODE KeyCode;
};
} // end namespace irr
#endif