How To Get Irrlicht List Item

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
doctorzeus
Posts: 13
Joined: Sun Jan 12, 2014 3:39 pm

How To Get Irrlicht List Item

Post by doctorzeus »

Ok stupid question,

But how would I access the first item of an irr::core::list?

More specifically there is one ISceneNode animator which has been added to a scene node and I want to get a pointer to it?

Many Thanks

DoctorZeus
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: How To Get Irrlicht List Item

Post by CuteAlien »

Did not compile, so might contain typos:

Code: Select all

 
const core::list<ISceneNodeAnimator *>& myAnimators = sceneNode->getAnimators ();
 
// only the first
if (!myAnimators.empty())
    ISceneNodeAnimator * animator = *myAnimators.begin ();
 
// All of them
for (const core::list<ISceneNodeAnimator *>::Iterator iter=myAnimators.begin (); iter != myAnimators.end(); ++iter)
{
    ISceneNodeAnimator * animator = *iter;
}
 
Also check the docs: http://irrlicht.sourceforge.net/docu/cl ... 1list.html
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
doctorzeus
Posts: 13
Joined: Sun Jan 12, 2014 3:39 pm

Re: How To Get Irrlicht List Item

Post by doctorzeus »

CuteAlien wrote:Did not compile, so might contain typos:

Code: Select all

 
const core::list<ISceneNodeAnimator *>& myAnimators = sceneNode->getAnimators ();
 
// only the first
if (!myAnimators.empty())
    ISceneNodeAnimator * animator = *myAnimators.begin ();
 
// All of them
for (const core::list<ISceneNodeAnimator *>::Iterator iter=myAnimators.begin (); iter != myAnimators.end(); ++iter)
{
    ISceneNodeAnimator * animator = *iter;
}
 
Also check the docs: http://irrlicht.sourceforge.net/docu/cl ... 1list.html
Thats seems to work!

Many Thanks! :)
Post Reply