I'm sure this is something stupid that I have overlooked, but as it stands no solution comes to mind.
This is what I use to create images:
Code: Select all
void GUIManager::createImage(char* winName, char* imageFile, float x, float y, float w, float h) {
if(imageFile) {
StaticImage* newWindow = (StaticImage*)mWmgr->createWindow("TaharezLook/StaticImage", winName);
loadTextureImageSet(imageFile, imageFile);
applyTexture(winName, imageFile);
mRoot->addChildWindow(newWindow);
//turn off the taharezlook frame
newWindow->setFrameEnabled(false);
//use pixels rather than fractions
newWindow->setMetricsMode((CEGUI::MetricsMode)0);
//set the image position to x, y, in pixels
newWindow->setPosition(Point(x,y));
//check if width and/or height is 0. if so, use the image width
float width, height;
if(w==0)
width = ImagesetManager::getSingleton().getImageset(imageFile)->getImageWidth(imageFile) / mGUIRenderer->getWidth();
else
width = w;
if(h==0)
height = ImagesetManager::getSingleton().getImageset(imageFile)->getImageHeight(imageFile) / mGUIRenderer->getHeight();
else
height = h;
newWindow->setSize(Size(width,height));
newWindow->setRiseOnClickEnabled(false);
newWindow->setBackgroundEnabled(false);
} else {
Window* newWindow = mWmgr->createWindow("DefaultWindow", winName);
mRoot->addChildWindow(newWindow);
newWindow->setMetricsMode((CEGUI::MetricsMode)0);
newWindow->setPosition(Point(x,y));
newWindow->setSize(Size(w,h));
}
}