[SOLVED] Image not defined on StaticImage

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

User avatar
thomas
Quite a regular
Quite a regular
Posts: 64
Joined: Thu Aug 22, 2013 22:11

[SOLVED] Image not defined on StaticImage

Postby thomas » Thu Apr 10, 2014 02:24

So I am trying to load a static image for a UI element in my game with this code:

Code: Select all

CEGUI::Window *myImageWindow = CEGUI::WindowManager::getSingleton().createWindow("TaharezLook/StaticImage","BloodUI");
myImageWindow->setPosition(CEGUI::UVector2(CEGUI::UDim(0, 0), CEGUI::UDim(0, 0)));
myImageWindow->setSize(CEGUI::USize(CEGUI::UDim(1, 0), CEGUI::UDim(1, 0)));
myImageWindow->setProperty("Image", "set:SpellByteImages image:full_image");
APP->ceguiContext->getRootWindow()->addChild(myImageWindow);


Which came from:
http://cegui.org.uk/wiki/CEGUI_In_Practice_-_Creating_widgets

I made my own scheme and imageset like so:

Code: Select all

<?xml version="1.0" ?>
<GUIScheme version="5" name="SpellByte">
   <Imageset filename="SpellByte.imageset" />
</GUIScheme>


Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<Imageset version="2" name="SpellByteImages" imagefile="blood.png" nativeHorzRes="1600" nativeVertRes="900" autoScaled="true" >
    <Image name="Blood" xPos="0" yPos="0" width="1600" height="900" />
</Imageset>


And here is my log:

Code: Select all

09/04/2014 20:20:53 (Std)    * -------- START OF ESSENTIAL SECTION TO BE POSTED ON THE FORUM       -------- *
09/04/2014 20:20:53 (Std)    ********************************************************************************
09/04/2014 20:20:53 (Std)    ---- Version: 0.8.2 (Build: Aug 28 2013 Debug Microsoft Windows g++ 4.7.2 32 bit) ----
09/04/2014 20:20:53 (Std)    ---- Renderer module is: CEGUI::OgreRenderer - Official OGRE based 2nd generation renderer module. ----
09/04/2014 20:20:53 (Std)    ---- XML Parser module is: CEGUI::RapidXMLParser - Official RapidXML based parser module for CEGUI ----
09/04/2014 20:20:53 (Std)    ---- Image Codec module is: OgreImageCodec - Integrated ImageCodec using the Ogre engine. ----
09/04/2014 20:20:53 (Std)    ---- Scripting module is: None ----
09/04/2014 20:20:53 (Std)    ********************************************************************************
09/04/2014 20:20:53 (Std)    * -------- END OF ESSENTIAL SECTION TO BE POSTED ON THE FORUM         -------- *
09/04/2014 20:20:54 (Std)    Started creation of Scheme from XML specification:
09/04/2014 20:20:54 (Std)    ---- CEGUI GUIScheme name: SpellByte
09/04/2014 20:20:54 (Std)    [ImageManager] Started creation of Imageset from XML specification:
09/04/2014 20:20:54 (Std)    [ImageManager] ---- CEGUI Imageset name: SpellByteImages
09/04/2014 20:20:54 (Std)    [ImageManager] ---- Source texture file: blood.png
09/04/2014 20:20:54 (Std)    [ImageManager] ---- Source texture resource group: (Default)
09/04/2014 20:20:54 (Std)    [OgreRenderer] Created texture: SpellByteImages
09/04/2014 20:20:54 (Std)    [ImageManager] Created image: 'SpellByteImages/Blood' (19447AF8) of type: BasicImage
09/04/2014 20:21:09 (Warn)   Property 'HorzExtent' is not writable so it's implicitly banned from XML. No need to ban it manually
09/04/2014 20:21:09 (Warn)   Property 'VertExtent' is not writable so it's implicitly banned from XML. No need to ban it manually
09/04/2014 20:21:09 (Std)    [OgreRenderer] Created texture: _ogre_tt_tex_0
09/04/2014 20:21:09 (Std)    [OgreRenderer] Created texture: Jura-10_auto_glyph_images_32
09/04/2014 20:21:09 (Std)    ---- Successfully completed loading of GUI layout from 'VanillaConsole.layout' ----
09/04/2014 20:21:17 (Error)   CEGUI::UnknownObjectException in function 'CEGUI::Image& CEGUI::ImageManager::get(const CEGUI::String&) const' (xxx) : Image not defined: set:SpellByteImages image:full_image
09/04/2014 20:21:19 (Std)    [OgreRenderer] Destroyed texture: _ogre_tt_tex_0


I have tried different images such as

Code: Select all

set:TaharezLook image:full_image
set:TaharezLook image:MenuTop
set:SpellByteImages image:Blood

and no matter what, I get the same message "Image not defined"

Do I need to somehow initialize it or specifically load it?

Here is my initialization:

Code: Select all

LOG("Initializing CEGUI");
// Initialize CEGUI
ceguiRenderer = &CEGUI::OgreRenderer::bootstrapSystem();

// Tell CEGUI in which group to find its resources from Ogre
CEGUI::Font::setDefaultResourceGroup("Fonts");
CEGUI::Scheme::setDefaultResourceGroup("Schemes");
CEGUI::WidgetLookManager::setDefaultResourceGroup("LookNFeel");
CEGUI::WindowManager::setDefaultResourceGroup("Layouts");
CEGUI::ImageManager::setImagesetDefaultResourceGroup("Imagesets");

// Load CEGUI configurations and skin/interface
CEGUI::SchemeManager::getSingleton().createFromFile( "GameMenu.scheme" );
CEGUI::SchemeManager::getSingleton().createFromFile( "TaharezLook.scheme" );
CEGUI::SchemeManager::getSingleton().createFromFile( "VanillaSkin.scheme" );
CEGUI::SchemeManager::getSingleton().createFromFile( "SpellByte.scheme" );
ceguiContext = &CEGUI::System::getSingleton().getDefaultGUIContext();
ceguiContext->getMouseCursor().setDefaultImage( "GameMenuImages/MouseCursor" );
ceguiContext->injectMousePosition(0.0, 0.0);
ceguiContext->getMouseCursor().show();
LOG("CEGUI Initialized");


Thank you, Thomas
Last edited by thomas on Fri Apr 11, 2014 19:30, edited 1 time in total.

nicoo
Not too shy to talk
Not too shy to talk
Posts: 37
Joined: Mon Mar 24, 2014 03:29

Re: Image not defined on StaticImage

Postby nicoo » Thu Apr 10, 2014 02:46

I'm not sure this will solve your problem,

Code: Select all

myImageWindow->setSize(CEGUI::USize(CEGUI::UDim(1, 0), CEGUI::UDim(1, 0)));

in the example they use,

Code: Select all

myImageWindow->setSize(USize(UDim(0,150),UDim(0,100)));

yours are maybe too small... also, don't know if it's important or not, but you put "1", they are float, so put "1.0f"

User avatar
thomas
Quite a regular
Quite a regular
Posts: 64
Joined: Thu Aug 22, 2013 22:11

Re: Image not defined on StaticImage

Postby thomas » Thu Apr 10, 2014 02:49

The difference is the second number is for pixels, the first is for scaling. It states to use 1 in the first column if you want it to fill the whole window.

Thanks for pointing it out though it was worth a shot :)

User avatar
Ident
CEGUI Team
Posts: 1998
Joined: Sat Oct 31, 2009 13:57
Location: Austria

Re: Image not defined on StaticImage

Postby Ident » Thu Apr 10, 2014 23:14

Thanks for pointing that out, the wiki article was aged and no one had updated it. I fixed it myself. The issue was simple, instead of using "set:" and "image:" an image should be referenced like this: "TaharezLook/full_image" . We do not use "set:" anymore in 0.8.x. Please try it out and tell me if it works.

Also you can look at the update wiki article.
CrazyEddie: "I don't like GUIs"

User avatar
thomas
Quite a regular
Quite a regular
Posts: 64
Joined: Thu Aug 22, 2013 22:11

[SOLVED] Re: Image not defined on StaticImage

Postby thomas » Fri Apr 11, 2014 19:30

Awesome that did it.

Code: Select all

myImageWindow->setProperty("Image", "SpellByteImages/Blood");


Worked great, but "full_image" doesn't work, either with TaharezLook or SpellByteImages. Is that meant to be a keyword to refer to the entire image, or is that something which needs to be set in a layout or imageset?

Either way I will set this as solved, thanks very much you are awesome Ident :)

User avatar
Ident
CEGUI Team
Posts: 1998
Joined: Sat Oct 31, 2009 13:57
Location: Austria

Re: [SOLVED] Image not defined on StaticImage

Postby Ident » Sat Apr 12, 2014 00:58

It is the definition for the Image in the imageset's xml. So somewhere in your imageset you definied an <Image> with a name that is "whatever", and then you refer to it by "ImagesetName/whatever"
CrazyEddie: "I don't like GUIs"

User avatar
thomas
Quite a regular
Quite a regular
Posts: 64
Joined: Thu Aug 22, 2013 22:11

Re: [SOLVED] Image not defined on StaticImage

Postby thomas » Sat Apr 12, 2014 01:05

Ah I see, I just didn't have it defined. Makes sense now :)

Thanks!


Return to “Help”

Who is online

Users browsing this forum: No registered users and 9 guests