Game Development Community

GuiChunkedBitmapCtrl not respecting bounds

by David Wyand · in Torque Game Engine Advanced · 10/04/2004 (5:05 pm) · 4 replies

Greetings!

In moving over from the TGE to the TSE, it looks like the guiChunkBitmapCtrl didn't quite make it. In its current incarnation (minus all the old commented code):

void GuiChunkedBitmapCtrl::onRender(Point2I offset, const RectI &updateRect)
{
   if( mTexHandle )
   {
      GFX->drawBitmapStretch( mTexHandle, mBounds );
   }

   renderChildControls(offset, updateRect);
}

direct use of mBounds doesn't respect the control's actual position in GUI. This means it works fine if it covers the whole screen, but doesn't work out with a smaller control.

Here's the fix (change in bold):

void GuiChunkedBitmapCtrl::onRender(Point2I offset, const RectI &updateRect)
{

   if( mTexHandle )
   {
      [b]RectI rect(offset, mBounds.extent);[/b]
      GFX->drawBitmapStretch( mTexHandle, [b]rect[/b] );
   }

   renderChildControls(offset, updateRect);
}

This ensures that the offset of the control wrt the screen is correct.

- LightWave Dave

About the author

A long time Associate of the GarageGames' community and author of the Torque 3D Game Development Cookbook. Buy it today from Packt Publishing!


#1
10/18/2004 (4:51 pm)
Hah, OK, I thought we had killed off this control. I'll check in the fix. FYI this control is not very efficient or necessary on hardware that supports texture sizes over 512x512. I'm guessing someone ported it just to make porting from TGE easier.
#2
10/18/2004 (5:15 pm)
What, this is still in? Check in the fix, then delete the control from CVS. :)
#3
10/19/2004 (12:29 am)
I think that Control is pretty cool myself. I hope you keep it.

www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=6493
#4
09/14/2007 (1:26 pm)
I'm chasing down a different problem where my bitmaps appear all black, not in the editor, but in the game.

Then I noticed that as of TGEA 1.0.3, this particular problem doesn't appear to be entirely fixed.

RectI rect(offset, mBounds.extent);
      GFX->drawBitmapStretch( mTexHandle, mBounds );