Page 1 of 1

Animated images.

Posted: Tue May 10, 2005 20:12
by charmy
Is there any support for a sort of "animated image" like a compass for example? Taking an example from EQ, the compass is just a single strip image that scrolls back and forth, or in a loop, depending on your direction, I am curious if CEGUI has any implentation of somthing like this yet or if it needs to be designed.

Thanks Much.

Compass Strip Example.

Image

EDIT: After doing a little research I find that Eq loads the same image twice, i.e. two instances of the compass strip, like so:

Image

My question would now be more so. Does CEGUI have any support for creating an overlay ontop of the image, and is there anyway yet to have them in a sort of "scrolling" effect, or perhaps how to tell what part of the image is showing.. if you understand what i mean... :)

Thanks again for any suggestions.

Re: Animated images.

Posted: Wed May 11, 2005 01:14
by gcarlton
There are widgets that do this, the ScrollablePane is a perfect example.

Try this. Create a window of a small size and then put that long static image into it as child. The smaller parent's clipping size should mean that the child image gets cropped to a subset, and then by moving the child position around you should get the desired result.

Re: Animated images.

Posted: Wed May 11, 2005 03:01
by charmy
Thanks for the reply but for some odd reason when i load the image it gets all distorted =/.

Image

Here is the code used to load the static img.

Code: Select all

   CEGUI::Texture* stctex = this->slOgreRenderer->createTexture("compass.jpg");
   CEGUI::Imageset* rttImageSet = CEGUI::ImagesetManager::getSingleton().createImageset("CompassImg",stctex);
   rttImageSet->defineImage("compassStrip",Point(0.0f,0.0f),Size(355,20),Point(0.0,0.0));
   
   StaticImage* simg = (StaticImage*)wMgr.createWindow((utf8*)"TaharezLook/StaticImage", (utf8*)"Demo7/Window2/Image1");
   console->addChildWindow(simg);
   //simg->setAlpha(0.750000);
   simg->setMaximumSize(Size(1.0f, 1.0f));
   simg->setPosition(Point(0.56f, 0.35f));
   simg->setSize(Absolute ,Size(355, 20));
   simg->setFrameEnabled(false);
   simg->setBackgroundEnabled(false);
   simg->setImage((utf8*)"CompassImg",(utf8*)"compassStrip");


Thanks again for the help.

Re: Animated images.

Posted: Thu May 12, 2005 05:22
by gcarlton
Wierd. You might have to step into the library code and have a look at what its doing with the abs_rect structures and the like. I'm not sure why it would squash it like that.