set parent before calling LoadFromNode
This commit is contained in:
@@ -8,12 +8,14 @@
|
||||
|
||||
class XNode;
|
||||
|
||||
typedef Actor* (*CreateActorFn)(const RString& sDir, const XNode* pNode);
|
||||
typedef Actor* (*CreateActorFn)(const RString& sDir, const XNode* pNode, Actor* pParent);
|
||||
|
||||
// Each Actor class should have a REGISTER_ACTOR_CLASS in its CPP file.
|
||||
#define REGISTER_ACTOR_CLASS_WITH_NAME( className, externalClassName ) \
|
||||
Actor* Create##className(const RString& sDir, const XNode* pNode) { \
|
||||
Actor* Create##className(const RString& sDir, const XNode* pNode, Actor* pParent) { \
|
||||
className *pRet = new className; \
|
||||
if( pParent ) \
|
||||
pRet->SetParent( pParent ); \
|
||||
pRet->LoadFromNode(sDir, pNode); \
|
||||
return pRet; } \
|
||||
class Register##className { \
|
||||
@@ -41,7 +43,7 @@ namespace ActorUtil
|
||||
{
|
||||
// Every screen should register its class at program initialization.
|
||||
void Register( const RString& sClassName, CreateActorFn pfn );
|
||||
Actor* Create( const RString& sClassName, const RString& sDir, const XNode* pNode );
|
||||
Actor* Create( const RString& sClassName, const RString& sDir, const XNode* pNode, Actor *pParentActor );
|
||||
|
||||
|
||||
void SetXY( Actor& actor, const RString &sType );
|
||||
@@ -66,8 +68,8 @@ namespace ActorUtil
|
||||
inline void SetXYAndOnCommand( Actor* pActor, const RString &sType ) { if(pActor) SetXYAndOnCommand( *pActor, sType ); }
|
||||
|
||||
// Return a Sprite, BitmapText, or Model depending on the file type
|
||||
Actor* LoadFromNode( const RString& sAniDir, const XNode* pNode );
|
||||
Actor* MakeActor( const RString &sPath, const XNode *pParent = NULL );
|
||||
Actor* LoadFromNode( const RString& sAniDir, const XNode* pNode, Actor *pParentActor = NULL );
|
||||
Actor* MakeActor( const RString &sPath, const XNode *pParent = NULL, Actor *pParentActor = NULL );
|
||||
|
||||
void ResolvePath( RString &sPath, const RString &sName );
|
||||
|
||||
|
||||
Reference in New Issue
Block a user