naah , recompiling recompiling
let me tell how you can make the engines member functions do your stuff without recompiling the engine. Let say you want to edit function setText of CTextSceneNode class, whichs declaration is below
Code: Select all
namespace irr
00011 {
00012 namespace scene
00013 {
00014
00016 class ITextSceneNode : public ISceneNode
00017 {
00018 public:
00019
00021 ITextSceneNode(ISceneNode* parent, ISceneManager* mgr, s32 id,
00022 const core::vector3df& position = core::vector3df(0,0,0))
00023 : ISceneNode(parent, mgr, id, position) {}
00024
00026 virtual void setText(const wchar_t* text) = 0;
00027
00029 virtual void setTextColor(video::SColor color) = 0;
00030 };
00031
00032 } // end namespace scene
00033 } // end namespace irr
realize the class scene::ITextSceneNode is derived from scene::ISceneNode. All you have to do is to create a class, lets call it a IMyTextSceneNode that is derived from ITextSceneNode and add only one function to it, the one you want to edit the body of, we said the function is virtual void setText(const wchar_t* text) = 0;. So this is the declaration of new class
Code: Select all
namespace irr
00011 {
00012 namespace scene
00013 {
00014
00016 class IMyTextSceneNode : public ITextSceneNode
00017 {
00018 public:
00019
00021 IMyTextSceneNode(ISceneNode* parent, ISceneManager* mgr, s32 id,
00022 const core::vector3df& position = core::vector3df(0,0,0))
00023 : ISceneNode(parent, mgr, id, position) {}
00024
00026 virtual void setText(const wchar_t* text) = 0;
00027
00030 };
00031
00032 } // end namespace scene
00033 } // end namespace irr
we needed only constructor and destructor.. (thus I can't see the destructor in CTextSceneNode, interesting) and the function we edit. In cpp file (new one of course) we edit the body of the function and include both CMyTextSceneNode.cpp and CMyTextSceneNode.h to project source files. and in code, we dodn't use CTextSceneNode* instacies but CMyTextSceneNode* instancies for our node, thus the node will use the new edited function and use all the others of originall irrlicht CTextSceneNode, becouse it is derived from CTextSceneNode. My coding looks like this
Code: Select all
scene::SMyAnimatedMesh mesh=....;
scene::SMyAnimatedMeshSceneNode node=....;
so the point is to keep irrlicht core untouched and derive your own stuff up from it. It keeps better order because you can see what you changed and you want mess up anything, because anytime you can switch to original irrlicht classes
what is this thing...