namespace misunderstanding

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
Void

namespace misunderstanding

Post by Void »

Hello,

Im a newbie coder and trying to get my head round the irrlicht engine. I have a problem. Im trying to create a new player class derived from a CCameraFPSSceneNode. Im looking at the irrlicht source and im led to beleive that i can access this class under the scene namespace but however it keeps tellin me it is not a member of this namespace. i have tried it without a namespace but it says something like base class dont exist...here is what i have...

#include "StdAfx.h"
#include "IrrBox.h"

class CPlayer: public scene::CCameraFPSSceneNode
{

private:

CPlayer(IrrlichtDevice *indev);
IrrlichtDevice *device;
};


I am sorry as this will probably seem really obvious and stupid to some but i want to know...how can i derive from the CCamerFPSSceneNode class?
Tyn
Posts: 932
Joined: Thu Nov 20, 2003 7:53 pm
Location: England
Contact:

Post by Tyn »

Code: Select all

using namespace irr;
You must either use this just below your includes or use:

Code: Select all

public irr::scene::CCameraFPSSceneNode
Void

Post by Void »

That doesnt work.
3dsmin

Post by 3dsmin »

there's no way you're gonna extend C<whatever> from outside irrlicht sources! so either build your new class in the irrlicht sources or

build your own scenenode by extending irr::scene::ISceneNode and copy the code you need from CCameraFPSSceneNode. h/cpp

3dsmin
Tyn
Posts: 932
Joined: Thu Nov 20, 2003 7:53 pm
Location: England
Contact:

Post by Tyn »

If inheriting from CCameraFPSSceneNode doesn't work then I would try ICameraSceneNode, all the functions you need are there so you only need to include the functions you wish to change. IIRC CCameraFPSSceneNode inherits from ICameraSceneNode, which in turn inherits from ISceneNode. So just grabbing the functions in CCameraFPSSceneNode and putting it in a ISceneNode class won't work ( I think ) as the functions which aren't changed by CCameraFPSSceneNode won't be in the class. Then again, polymorphism still confuses me quite a bit so that may not be quite accurate but I am pretty sure that's right.

Edit: Actually, if it's a C prefix on the class name it's a base class innit. You should still be able to create a camera inheritied from ICameraSceneNode, you may have to manually copy code from the CCameraFPSSceneNode class over but at least it will work. Sorry, thought you might get away with doing it without copying from file to file :(
Void

Post by Void »

Yeah Tyn, thats pretty much what i ended up doing...All of your answers have helped me to realise what alla the C's an I's are about as i misunderstood that aswell before. Thanks for all your helps. However i have 1 more question, and that is, why has the creator done this like, so that we must use the I prefixed classes an copy code from the C prefix classes. Why no allow us to just derive from the C prefixes and do away with all the I's. Im not complaining, im just curious.

Thanks
VoidChoice
Post Reply