The first thing you need in order to do this is an Imageset that defines the Image that you wish to use. When wanting to use an image file for this as you suggest, you basically have an imageset defined like this:
Code: Select all
<?xml version="1.0" ?>
<Imageset Name="BackdropImageset" Imagefile="backdrop.tga" NativeHorzRes="1024" NativeVertRes="768" AutoScaled="true">
<Image Name="Backdrop" XPos="0" YPos="0" Width="1024" Height="768" />
</Imageset>
What this does is define an Imageset using the backdrop.tga. A single image "Backdrop" is defined that starts at location (0,0) and is 1024 x 768 in size. You should be careful in that the source image file should have dimensions that are powers of two - this is because the image is loaded as a texture, and may be stretched if the powers-of-two requirement is not observed.
Once you have your imageset defined, you can load it either by adding a reference to it in whichever scheme you are loading, or manually using the ImagesetManager:
Code: Select all
CEGUI::ImagesetManager::getSingleton().createImageset("myImageset.imagset");
Once the thing is loaded, you set the image into the StaticImage like so:
Code: Select all
myStaticImage->setImage("BackdropImageset", "Backdrop");
Notice that the names we specify here are the ones that were originally specified in the imageset XML file.
There are other ways of going about this, you can create the whole lot dynamically in code, though you have to provide a pre-loaded image as a texture - so the above is probably the easiest way at the moment.
In 0.4.0 there will be support for creating Imagesets directly from images (in fact I added in CVS earlier today).
HTH
CE.