Help with Iter

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

orion
Not too shy to talk
Not too shy to talk
Posts: 28
Joined: Fri Apr 24, 2020 15:56

Help with Iter

Postby orion » Thu Feb 11, 2021 22:08

Hi Guys,

i'm sure ive overlooked something but i'm not sure what :(

previously i would

Code: Select all

        // get ptr to named imageset - don't forget this throws if imageset is not present
   CEGUI::Imageset& imageset = CEGUI::ImagesetManager::getSingleton().get( "pics" );

        ItemListbox* Pics_names = static_cast<ItemListbox*>(winMgr.getWindow( "Pics_names"));

        Editbox* pics_txt = static_cast<Editbox*>(winMgr.getWindow( "pics_txt"));

        imageset.getName();

    // get iterator to iterate over defined images.
        Imageset::ImageIterator iter = imageset.getIterator();

    while ( !iter.isAtEnd() )
    {


to scan though an image set etc,etc

now imageset has been removed so tried

Code: Select all

CEGUI::Image& imageset = CEGUI::ImageManager::getSingleton().get("pics");
imageset.getName();
// get iterator to iterate over defined images.
      ImageManager::ImageIterator iter = imageset.getIterator();


but getiterator is not part of the image class

so what would be the way to go here ?

orion
Not too shy to talk
Not too shy to talk
Posts: 28
Joined: Fri Apr 24, 2020 15:56

Re: Help with Iter

Postby orion » Mon Feb 22, 2021 20:06

in case its not that clear what i wanted to do

i just need to grab the names of every images in an imageset
so i can can then select a diffrent image

niello
Quite a regular
Quite a regular
Posts: 76
Joined: Tue May 24, 2011 05:54
Contact:

Re: Help with Iter

Postby niello » Wed Jan 19, 2022 08:23

Hi.

Here is a quick solution I've found. It is for iterating all available images, and an imageset name is the first part of the image name, ending at "/". There likely is an iterator for images in a particular imageset but I don't know about it.

Code: Select all

    auto it = CEGUI::ImageManager::getSingleton().getIterator();
    while (!it.isAtEnd())
    {
        auto name = it.getCurrentKey();
        ++it;
    }


Return to “Help”

Who is online

Users browsing this forum: No registered users and 9 guests