Page 1 of 1

using RenderableImage

Posted: Sun Feb 13, 2005 20:31
by thumperj
Ok, I'm going a little nutty here....

I want to use RenderableImage instead of Image for some things but am missing something because I can't seem to get the image to appear on screen.

In my constructor of the containing object I have:
Imageset* iset = ImagesetManager::getSingleton().getImageset( ImagesetName );
myImage.setImage( &iset->getImage( StaticImageName ) );
myImage.setPosition( Point( 0, 0 ) );
myImage.setHorzFormatting( RenderableImage::HorzStretched );
myImage.setVertFormatting( RenderableImage::VertStretched );

Then, in the drawSelf() funtion of the containing object I have:
Size sz = getSize();
myImage.setSize( sz );

Rect clipper( getPixelRect() );
Rect absrect(getUnclippedPixelRect());
Vector3 pos( absrect.d_left, absrect.d_top, z );
myImage.draw( pos, clipper );

And nothing shows up. I can simply change this to an Image (with the appropriate code) and it works as I'd expect. Any hints? (No errors in the log, btw, and all numbers look reasonable when inspected.)

Thanks,
Chris

Re: using RenderableImage

Posted: Sun Feb 13, 2005 20:49
by CrazyEddie
Is the containing Window object using Relative or Absolute metrics? If Relative, then that's your problem - to fix, simply use the getAbsoluteSize() method instead of getSize() when setting the size of the RenderableImage. You probably already thought of this though :?

Your code looks good (you're basically doing the same as what is done in StaticImage), so if it's not the above I'll have to delve into things a little deeper tomorrow.

CE.

Re: using RenderableImage

Posted: Sun Feb 13, 2005 21:12
by thumperj
<slapping forehead>DOH!

:oops: That's exactly what it was. Geeesh....

Thanks very much,
Chris