Crystal Space
Welcome, Guest. Please login or register.
April 23, 2014, 09:08:05 pm

Login with username, password and session length
Search:     Advanced search
8990 Posts in 2037 Topics by 7618 Members
Latest Member: Tymqwaro
* Home Help Search Login Register
+  Crystal Space
|-+  Crystal Space Development
| |-+  General Crystal Space Discussion
| | |-+  Help with static image in cegui
« previous next »
Pages: [1] Print
Author Topic: Help with static image in cegui  (Read 7047 times)
raq77
Newbie
*
Posts: 41


View Profile Email
« on: March 27, 2008, 05:01:34 pm »

Hello, I am writing code that will allow me to show a picture or another depending on the button pressed. When I press the first button image is displayed in a new window perfectly, but when I hit another button for the second time, I get the follow error:
Microsoft C++ exception: CEGUI::AlreadyExistsException @ 0x0012f734

I suppose the problem is that whenever I pulse a button creates a new ImagesetManager, but I don't know how to delete the manager ever, because I don't know how many times you can press a button.


This is the code:
CEGUI::Imageset* set;
   CEGUI::DefaultWindow* win;
   
   if (formaCarcasa == 1){
      win = static_cast<CEGUI::DefaultWindow*>(CEGUI::WindowManager::getSingleton().getWindow("Window2/Image2"));       
      set = CEGUI::ImagesetManager::getSingleton().createImagesetFromImageFile("ImageForStaticImage2","/lib/escenario/fuegos2.jpg");
      win->setProperty("Image","set:ImageForStaticImage2 image:full_image");
   }
   else if (formaCarcasa == 4){
      win = static_cast<CEGUI::DefaultWindow*>(CEGUI::WindowManager::getSingleton().getWindow("Window2/Image2"));       
      set = CEGUI::ImagesetManager::getSingleton().createImagesetFromImageFile("ImageForStaticImage2","/lib/escenario/fuegos3.jpg");
      win->setProperty("Image","set:ImageForStaticImage2 image:full_image");
   }


Can somebody help me, please? Thanks in advance.
Logged
raq77
Newbie
*
Posts: 41


View Profile Email
« Reply #1 on: April 01, 2008, 05:21:08 pm »

Ok, this is the solution:

if (CEGUI::ImagesetManager::getSingletonPtr()->isImagesetPresent("ImageForStaticImage2") == true)
     CEGUI::ImagesetManager::getSingletonPtr()->destroyImageset("ImageForStaticImage2");   
win = static_cast<CEGUI::DefaultWindow*>(CEGUI::WindowManager::getSingleton().getWindow("Window2/Image2"));
   
if (type == 1){
     set = CEGUI::ImagesetManager::getSingleton().createImagesetFromImageFile("ImageForStaticImage2","/lib/escenario/fuegos2.jpg");
}else if (type == 2){
     set = CEGUI::ImagesetManager::getSingleton().createImagesetFromImageFile("ImageForStaticImage2","/lib/escenario/fuegos3.jpg");
}

Greetings.
Logged
Pages: [1] Print 
« previous next »
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Page created in 4.132 seconds with 16 queries.