Page 1 of 1

Iterate through MouseCursor Images

Posted: Thu Feb 01, 2007 09:56
by UNKLE
Hi, I want to change the mouse-cursor-image every time, I click the right mouse button. My problem is, I dont know how to get the name of the images I need.

Code: Select all

      CEGUI::Imageset *imgSet = CEGUI::ImagesetManager::getSingleton().getImageset("TaharezLook");
      CEGUI::Imageset::ImageIterator itrImage = imgSet->getIterator();      
      if(!itrImage.isAtEnd() )
      {
         CEGUI::String testStr = imgSet->getName();
         itrImage++;
      }
      else
         itrImage.toStart();


This is how I want to implement it, but what

Code: Select all

imgSet->getName()
returns is the name of the Imageset, so it is "TaharezLook", which is a bit senseless ;)
What I want to get is the name of the actual image, like "MouseMoveCursor". Using

Code: Select all

imgSet->getImage()
is senseless too, because I have to give a searchstring to the method.

Posted: Thu Feb 01, 2007 13:04
by Pompei2
Hmm .. you notice that you never access your iterator ? :) Try replacing this

Code: Select all

         CEGUI::String testStr = imgSet->getName();

with this:

Code: Select all

         CEGUI::String testStr = (*itrImage).getName();


not tested, but it should work.

Posted: Fri Feb 02, 2007 13:18
by UNKLE
Thanks, it works :).
I cant understand why I'd never tried it this way... :oops: