Postby TheGilb » Fri May 06, 2005 19:35
Ok peeps, I got bored of waiting for a response (I know, I know, I'm really impatient!) so I went right ahead and found out how to do it myself, and it's great because now my program looks more professional ;)
I'm actually here to document exactly how you do this. Perhaps someone will migrate this post to the wiki some day?... I know I rely on wiki's and forums for a lot of my information these days. Someone will appreciate this some day!
First set up your xml file (You're already working on your GUI at this stage!) with the following lines of code:
<Window Type="TaharezLook/StaticImage" Name="Application/Titlebar/TitleImage">
<Property Name="Alpha" Value="0.750000" />
<Property Name="RelativeRect" Value="l:0.000000 t:0.000000 r:1 b:1" />
</Window>
That is, you create a StaticImage in your GUI. This is step 1, and probably the most obvious. Now you jump into C++ and right after your CEGUI init (You've already got this far!):
/* Create CEGUI texture (file must be in resource dir) */
CEGUI::Texture* mtitletex = mGUIRenderer->createTexture("orbapptitle.tga");
/* Get handle to CEGUI widget */
CEGUI::StaticImage* mtitlestatic = (CEGUI::StaticImage*)CEGUI::WindowManager::getSingleton().getWindow("Application/Titlebar/TitleImage");
/* Create an imageset called RttImageset */
CEGUI::Imageset* rttImageSet = CEGUI::ImagesetManager::getSingleton().createImageset((CEGUI::utf8*)"RttImageset",mtitletex);
/* Define a single image in the set which fills it */
rttImageSet->defineImage((CEGUI::utf8*)"ORBAppTitleImage",
CEGUI::Point(0.0f, 0.0f),
CEGUI::Size(mtitletex->getWidth(), mtitletex->getHeight()),
CEGUI::Point(0.0f,0.0f));
/* Now set the image property of the CEGUI widget and you're done! */
mtitlestatic->setImage("RttImageset", "ORBAppTitleImage");
And that's it! References include CEGUI API Reference and Ogre GUI demo. Thanks!