Iterate through MouseCursor Images

For help with general CEGUI usage:
- Questions about the usage of CEGUI and its features, if not explained in the documentation.
- Problems with the CMAKE configuration or problems occuring during the build process/compilation.
- Errors or unexpected behaviour.

Moderators: CEGUI MVP, CEGUI Team

UNKLE
Just popping in
Just popping in
Posts: 2
Joined: Thu Feb 01, 2007 08:47

Iterate through MouseCursor Images

Postby UNKLE » Thu Feb 01, 2007 09:56

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.

Pompei2
Home away from home
Home away from home
Posts: 489
Joined: Tue May 23, 2006 16:31

Postby Pompei2 » Thu Feb 01, 2007 13:04

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.

UNKLE
Just popping in
Just popping in
Posts: 2
Joined: Thu Feb 01, 2007 08:47

Postby UNKLE » Fri Feb 02, 2007 13:18

Thanks, it works :).
I cant understand why I'd never tried it this way... :oops:


Return to “Help”

Who is online

Users browsing this forum: No registered users and 27 guests