Page 1 of 1

CEGUI 0.8.7 and SFML 2.4.2 - load imageset

Posted: Tue Jul 11, 2017 17:18
by HawkDeath
Hi,
I try to use CEGUI in my program when I try to load a TaharezLook.imageset a program return this exception.
What I do wrong? How to fix this?

Code: Select all

//this code load a resources
   CEGUI::SchemeManager::getSingletonPtr()->createFromFile("bin/TaharezLook.scheme");
   CEGUI::ImageManager::getSingletonPtr()->loadImageset("bin/TaharezLook.imageset");      
   CEGUI::FontManager::getSingletonPtr()->createFromFile("bin/DejaVuSans-10.font");
   
   CEGUI::Font::setDefaultResourceGroup("fonts");
   CEGUI::Scheme::setDefaultResourceGroup("schemes");
   CEGUI::WidgetLookManager::setDefaultResourceGroup("looknfeel");
   CEGUI::WindowManager::setDefaultResourceGroup("layouts");
   CEGUI::ImageManager::setImagesetDefaultResourceGroup("imagesets");


Code: Select all

//this code creates a button
      CEGUI::WindowManager &wmgr = CEGUI::WindowManager::getSingleton();
      CEGUI::Window *sheet = wmgr.createWindow("DefaultWindow", "CEGUIDemo/Sheet");
      CEGUI::Window *quit = wmgr.createWindow("TaharezLook/Button", "CEGUIDemo/QuitButton");
      quit->setText("Quit");
      quit->setSize(CEGUI::USize(CEGUI::UDim(0.15, 0), CEGUI::UDim(0.05, 0)));
      sheet->addChild(quit);
      CEGUI::System::getSingleton().getDefaultGUIContext().setRootWindow(sheet);

      auto quitFunc = [](const CEGUI::EventArgs &)->bool {
         exit(0);
      };
      quit->subscribeEvent(CEGUI::PushButton::EventClicked,
         CEGUI::Event::Subscriber(&quitFunc));


Code: Select all

CEGUI::FileIOException in function 'void __thiscall CEGUI::DefaultResourceProvid
er::loadRawDataContainer(const class CEGUI::String &,class CEGUI::RawDataContain
er &,const class CEGUI::String &)' (C:\programming\gits\cegui-0.8.7\cegui\src\De
faultResourceProvider.cpp:66) : TaharezLook.imageset does not exist
CEGUI::UnknownObjectException in function 'class CEGUI::WindowFactory *__thiscal
l CEGUI::WindowFactoryManager::getFactory(const class CEGUI::String &) const' (C
:\programming\gits\cegui-0.8.7\cegui\src\WindowFactoryManager.cpp:186) : A Windo
wFactory object, an alias, or mapping for 'TaharezLook/Button' Window objects is
 not registered with the system.

Have you forgotten to load a scheme using CEGUI::SchemeManager::createFromFile(..)?

Re: CEGUI 0.8.7 and SFML 2.4.2 - load imageset

Posted: Tue Jul 11, 2017 17:35
by Ident
I guess what it says is correct: the files are not in the specified path. Can't tell you anything other than that from a remote view.

Re: CEGUI 0.8.7 and SFML 2.4.2 - load imageset

Posted: Thu Jul 13, 2017 18:36
by lucebac
Usually, this is because your datafiles folder is not where CEGUI expects it. If you use Visual Studio and just clicked "debug" or "run", the working directory is set "wrong". You can either set the Debug directory of VS to "$(OutDir)" or launch the executable manually.
The datafiles folder should be placed next to your main executable and I strongly recommend you to not change the directory layout unless you know what you are doing. For now, please just copy over the whole datafiles folder to your e.g. Debug directory. Also, you can have a look at one of the application templates and see how resource initialization is done there.

Re: CEGUI 0.8.7 and SFML 2.4.2 - load imageset

Posted: Thu Aug 17, 2017 19:58
by Ident
What lucebac said sounds correct, forgot about that very important aspect.

Did that solve your issue?