Hi!
Well, im doing a Function for the pj, i want it to return the IAnimatedMeshSceneNode *hero so i can check input, and more, in the Main Loop, this is a little part of the function:
int Pj(IrrlichtDevice *device,IVideoDriver *driver,ISceneManager *smgr)
{
struct{
int HP=1500;
int MP=540;
} self;
IAnimatedMeshSceneNode *hero = smgr->addAnimatedMeshSceneNode(smgr->getMesh("../media/dwarf2.x"));
hero->setMaterialFlag(EMF_LIGHTING,false);
hero->setMaterialTexture(0,driver->getTexture("../media/dwarf2.jpg"));
return hero;
}
Thats is what i need: return hero;
but the function returns INT, so i cant do it.
i tried doing: IAnimatedMeshSceneNode Pj(Irr...)
Like it returns an IAnimatedMeshSceneNode but it doesnt work, can help me please?
Thanks.
How to return an IAnimatedMeshSceneNode
Did you use or You need to use a pointer.
Code: Select all
IAnimatedMeshSceneNode Pj(Irr...)Code: Select all
IAnimatedMeshSceneNode* Pj(Irr...)-
rogerborg
- Admin
- Posts: 3590
- Joined: Mon Oct 09, 2006 9:36 am
- Location: Scotland - gonnae no slag aff mah Engleesh
- Contact:
Re: How to return an IAnimatedMeshSceneNode
Incidentally, this is not standard C++, either ANSI/ISO/IEC 14882:1998 or (AFAIK) 2003. Out of interest, does this actually compile for you, and if so, with what compiler?Necrozard wrote: struct{
int HP=1500;
int MP=540;
} self;
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
rep
Code: Select all
IrrlichtDevice* device;
IVideoDriver* driver;
ISceneManager* smgr;
class Hero {
int hp, mp;
IAnimatedMeshSceneNode *hero;
public:
Hero();
IAnimatedMeshSceneNode* returnNode();
} self;
Hero::Hero()
{
hp=1500;mp=540;
hero = smgr->addAnimatedMeshSceneNode(smgr->getMesh("../media/dwarf2.x"));
hero->setMaterialFlag(EMF_LIGHTING,false);
hero->setMaterialTexture(0,driver->getTexture("../media/dwarf2.jpg"));
}
Hero::IAnimatedMeshSceneNode* returnNode()
{
return hero;
}