StaticImage, setting the image in xml

For help with anything that CEGUI doesn't offer straight out-of-the-box, e.g.:
- Implementation of new features, such as new Core classes, widgets, WindowRenderers, etc. ...
- Modification of any existing features for specific purposes
- Integration of CEGUI in new engines or frameworks and writing of new plugins (Renderer, Parser, ...) or modules

Moderators: CEGUI MVP, CEGUI Team

User avatar
Clay
Not too shy to talk
Not too shy to talk
Posts: 24
Joined: Sun Feb 13, 2005 04:20
Contact:

StaticImage, setting the image in xml

Postby Clay » Thu Mar 31, 2005 09:27

I used the LayoutEditor on this site to setup my GUI. I added a StaticImage to the top of the screen along with a lot of other stuffs.

I can't seem to figure out how to tell the widget what image to use (the GUI doesn't seem to have a field for specifying that information). The XML generated for the StaticImage is this:

Code: Select all

      <Window Type="TaharezLook/StaticImage" Name="TitleImage">
         <Property Name="AbsoluteHeight" Value="96.000000" />
         <Property Name="AbsolutePosition" Value="x:160.000000 y:12.000000" />
         <Property Name="AbsoluteRect" Value="l:160.000000 t:12.000000 r:480.000000 b:108.000000" />
         <Property Name="AbsoluteSize" Value="w:320.000000 h:96.000000" />
         <Property Name="AbsoluteWidth" Value="320.000000" />
         <Property Name="AbsoluteXPosition" Value="160.000000" />
         <Property Name="AbsoluteYPosition" Value="12.000000" />
         <Property Name="FrameEnabled" Value="False" />
         <Property Name="Height" Value="0.200000" />
         <Property Name="Position" Value="x:0.250000 y:0.025000" />
         <Property Name="Rect" Value="l:0.250000 t:0.025000 r:0.750000 b:0.225000" />
         <Property Name="RelativeHeight" Value="0.200000" />
         <Property Name="RelativePosition" Value="x:0.250000 y:0.025000" />
         <Property Name="RelativeRect" Value="l:0.250000 t:0.025000 r:0.750000 b:0.225000" />
         <Property Name="RelativeSize" Value="w:0.500000 h:0.200000" />
         <Property Name="RelativeWidth" Value="0.500000" />
         <Property Name="RelativeXPosition" Value="0.250000" />
         <Property Name="RelativeYPosition" Value="0.025000" />
         <Property Name="Size" Value="w:0.500000 h:0.200000" />
         <Property Name="Width" Value="0.500000" />
         <Property Name="XPosition" Value="0.250000" />
         <Property Name="YPosition" Value="0.025000" />
         </Window>


Any idea what property tag I should add?

Thanks!

Guest

Re: StaticImage, setting the image in xml

Postby Guest » Thu Mar 31, 2005 09:58


User avatar
Clay
Not too shy to talk
Not too shy to talk
Posts: 24
Joined: Sun Feb 13, 2005 04:20
Contact:

Re: StaticImage, setting the image in xml

Postby Clay » Thu Mar 31, 2005 16:28

I tried that one:

Code: Select all

      <Window Type="TaharezLook/StaticImage" Name="TitleImage">
         <Property Name="Image" Value="title.png" />


But it gave an exception:

Code: Select all

31/03/2005 16:21:40 (InfL2)   Window 'TitleImage' of type 'TaharezLook/StaticImage' has been created.
31/03/2005 16:21:40 (Error)   Exception: ImagesetManager::getImageset - No Imageset named '̌̌̌̌̌̌̌̌̌̌̌̌̌̌̌̌̌̌̌̌̌̌̌̌̌̌̌̌̌̌̌̌̌̌̌̌̌̌̌̌̌̌̌̌̌̌̌̌̌̌̌̌̌̌̌̌̌̌̌̌̌̌̌̌̌̌' is present in the system.
31/03/2005 16:21:40 (InfL1)   ---- Successfully completed loading of GUI layout from 'MainMenu.xml' ----


Am I using this wrong?

Guest

Re: StaticImage, setting the image in xml

Postby Guest » Thu Mar 31, 2005 17:17

Indeed it's wrong. The right syntax is explained in the link i gave you (see "Detailed Description" section).

You have to write something like that :
<Property Name="Image" Value="set:TaharezLook image:ClientBrush" />

Hope this helps.

--
Chris

Guest

Re: StaticImage, setting the image in xml

Postby Guest » Thu Mar 31, 2005 17:22

If forgot to say something :
The image you want to use in your StaticImage widget is probably not ClientBrush and is maybe not even in an existing imageset. If it's the case, there's a great example of dynamically created imageset in the Demo_Gui of Ogre.
Don't hesitate to have a look at it.

--
Chris

User avatar
Clay
Not too shy to talk
Not too shy to talk
Posts: 24
Joined: Sun Feb 13, 2005 04:20
Contact:

Re: StaticImage, setting the image in xml

Postby Clay » Thu Mar 31, 2005 22:28

I did have a look at the Ogre GUI demo (which is exactly what I'm doing for my render to texture StaticImages), but for regular images that would require me to manually set up every image I use. I'd rather just define them in the xml file.

I didn't realize you HAD to have an ImageSet for this to work, what a PITA for the images I have. So if I have two images for the title screen (title.png, logo.png), I'd have to do this:

Code: Select all

<Imageset Name="SomeSet1" Imagefile="title.png" NativeHorzRes="200" NativeVertRes="100" AutoScaled="true">
   <Image Name="TitleImage" XPos="0" YPos="0" Width="200" Height="100" />
</Imageset>

<Imageset Name="SomeSet2" Imagefile="logo.png" NativeHorzRes="80" NativeVertRes="80" AutoScaled="true">
   <Image Name="LogoImage" XPos="0" YPos="0" Width="80" Height="80" />
</Imageset>


To be able to use it in the XML layout file I'm defining? That just seems like a lot of uneccissary work. There's not some simpler way?

User avatar
Clay
Not too shy to talk
Not too shy to talk
Posts: 24
Joined: Sun Feb 13, 2005 04:20
Contact:

Re: StaticImage, setting the image in xml

Postby Clay » Fri Apr 01, 2005 02:01

Thanks for all of your help, I finally got this working in XML land.

Clay

Guest

Re: StaticImage, setting the image in xml

Postby Guest » Fri Apr 01, 2005 08:40

I'm interested in your solution. Did you find a way to load images without creating a new imageset each time?

--
Chris

User avatar
Clay
Not too shy to talk
Not too shy to talk
Posts: 24
Joined: Sun Feb 13, 2005 04:20
Contact:

Re: StaticImage, setting the image in xml

Postby Clay » Sat Apr 02, 2005 03:48

I didn't get it working without it. =*(

I merged my smaller image into one image file, for the larger ones I just have a TON of image sets that contain only one image.


Return to “Modifications / Integrations / Customisations”

Who is online

Users browsing this forum: No registered users and 4 guests