Friday, March 20, 2009

Tga & imageset for CEGUI

Add static images to the CEGUI used in Ogre, we need assemble images into a tga files in the imageset form.

First, create a tga image file containing all the needed images.

1) Using Photoshop, create a new document with transparent background.

2) Put all the images in that document and arrange them in a good order and position;

3) Select only those will not be transparent parts and all these kinds of parts, in the channel frame, click the button"Save Selection as Channel" the one which is shown as a dark rectangle with whit circle. After clicking this button, a new alpha  channel will be created. Note, if there already exists an alpha channel delete it.

4) Save the document as tga file format. And this step is done.

Second, create a *.imageset file, which is a XML based file to describe the tga file, the format is something like this:

   1: <?xml version="1.0" ?>

   2: <Imageset Name="ShapeGUI" Imagefile="ShapeGUI.tga" NativeHorzRes="800" NativeVertRes="600" AutoScaled="true">

   3:       <Image Name="ShapeLabel" XPos="0" YPos="2" Width="190" Height="40" />

   4: </Imageset>


Finally, we can use those images in CEGUI.

When create a staticImage window, set the Image property to something like this:

   1: set:ShapeGUI image:ShapeLabel


Then it's done.

No comments:

Post a Comment