loading static image at runtime (SOLVED)
Posted: Wed Jun 13, 2007 19:51
hey im trying to change a static image defined in a layout file at runtime with several different pictures depending on user input ive read as many forum posts as i can so far but its still not working right
for instance i have a set of 5 map images each click swaps to the relevant image but the code is crashing i think when the image has already been loaded before and we try to set to it again and the image size is wrong
this is my layout info for the static image
can someone tell me the code for the layout file that determines the size of the image btw all my images are 150x150 and i think im loading them as backgrounds so it makes them way to huge
this is the code which switchs the images with a new image
can someone show me a simple easy way of making the images display right that will work for redisplaying them as well not just the initial set
please and so the images are set in the code using the filename
thankyou if you can help
for instance i have a set of 5 map images each click swaps to the relevant image but the code is crashing i think when the image has already been loaded before and we try to set to it again and the image size is wrong
this is my layout info for the static image
Code: Select all
<Window Type="TaharezLook/StaticImage" Name="createmapimage" >
<Property Name="Image" Value="set:BackgroundImage image:full_image" />
<Property Name="FrameEnabled" Value="False" />
<Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
<Property Name="UnifiedAreaRect" Value="{{0.57,0},{0.1,0},{0.98,0},{0.25,0}}" />
<Property Name="BackgroundEnabled" Value="False" />
</Window>
can someone tell me the code for the layout file that determines the size of the image btw all my images are 150x150 and i think im loading them as backgrounds so it makes them way to huge
this is the code which switchs the images with a new image
Code: Select all
string maploc = "../datafiles/maps/" + maps[id].mapimage;
ImagesetManager::getSingleton().createImagesetFromImageFile("ImageForStaticImage",maploc);
CEGUI::DefaultWindow* win = static_cast<CEGUI::DefaultWindow*>(WindowManager::getSingleton().getWindow("createmapimage"));
win->setSize(CEGUI::UVector2(CEGUI::UDim(150,1),CEGUI::UDim(150,1)));
win->setProperty("Image","set:ImageForStaticImage image:full_image");
can someone show me a simple easy way of making the images display right that will work for redisplaying them as well not just the initial set
please and so the images are set in the code using the filename
thankyou if you can help