problem of destroyAllImagesets method

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

chendot
Just popping in
Just popping in
Posts: 10
Joined: Wed Jan 09, 2008 13:22

problem of destroyAllImagesets method

Postby chendot » Thu Jan 17, 2008 16:36

I got a StaticImage to show the map picture, and the picture is changed accroding to a map list. So I wrote a function for subscribing the list Selected event. Each time the user selects a map from the list, the staticImage would show the relevant map picture.

I wanted to implement map picture changing as below.

Code: Select all

bool OnSceneListSelectedClicked(const CEGUI::EventArgs& e)
{
    ...
    ImagesetManager::getSingleton().destroyAllImagesets();
    ImagesetManager::getSingleton().createImagesetFromImageFile("map", mapfile);
    WindowManager::getSingleton().getWindow("SceneSImg")->setProperty("Image", "set:map image:full_image");
    ...
}


but it cause a error from "destroyAllImagesets()" function. It seems that CEGUI::System::getSingleton().renderGUI() get a NULL Image pointer error after doing that.

Any help please....

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Postby CrazyEddie » Fri Jan 18, 2008 09:36

If any other part of the UI is using imagery your call to destoryAllImagesets is destroying that imagery so when it tries to draw something (static image frame?) the imagery no longer exists.

Don't call destroyAllImagesets - be more selective in what you destroy :)

CE.

chendot
Just popping in
Just popping in
Posts: 10
Joined: Wed Jan 09, 2008 13:22

Postby chendot » Fri Jan 18, 2008 17:26

CrazyEddie wrote:If any other part of the UI is using imagery your call to destoryAllImagesets is destroying that imagery so when it tries to draw something (static image frame?) the imagery no longer exists.

Don't call destroyAllImagesets - be more selective in what you destroy :)

CE.


Thank you, CrazyEddie,
I've changed my code as below, and it works.

Code: Select all

if (ImagesetManager::getSingleton().isImagesetPresent("map"))
      {
         Imageset* imgset = ImagesetManager::getSingleton().getImageset("map");
         ImagesetManager::getSingleton().destroyImageset(imgset);
      }
      ImagesetManager::getSingleton().createImagesetFromImageFile("map", mapView);
      WindowManager::getSingleton().getWindow("SceneSImg")->setProperty("Image", "set:map image:full_image");

but I still feel a little confounded.
Except the imageset used by the StaticImage, I did not create other imagesets. So are there some default imagesets that be used by UI?

Rackle
CEGUI Team (Retired)
Posts: 534
Joined: Mon Jan 16, 2006 11:59
Location: Montréal

Postby Rackle » Fri Jan 18, 2008 17:54

A scheme (Taharez, Windows, or other) makes use of an image to visually describe the components of widgets (corners of a button). This image may be created automatically and may be what gets destroyed through destoryAllImagesets().

In terms of code cleanliness this version is much better. Imagine in a month or two adding another image and some of the time this new image bugs out. This code is more precise.


Return to “Help”

Who is online

Users browsing this forum: No registered users and 11 guests