Game Development Community

GuiBitmapCtrl setValue() - what gives?

by David Russell · in Torque Game Engine · 06/01/2005 (5:57 pm) · 2 replies

Hi,

I'm wondering what the purpose is of the lines

x+=texture->bitmapWidth/2;
y+=texture->bitmapHeight/2;

in GuiBitmapCtrl::setValue().

I'm using this control to display a rotating compass (like on flight sims). I have the 'wrap' flag turned on and use setValue() to update the current offset of the image. This works nicely, but there are problems, the most obvious of which is that the texture is drawn half way down. If I comment out these two lines then all works as I expect it to.

I'm just wondering what these lines were intended for in the first place?

Dave.

#1
06/02/2005 (10:13 am)
Images are normally placed using the upper left corner. I looks like this code places it using the center point. As for why it's messing up, I dunno.
#2
06/02/2005 (5:33 pm)
Not sure if this is related, but I just finished implementing the "Ultimate Compass" tutorial and was having a similar problem. After stepping through the code I found that the following two lines needed to be moved up above the calculations on textures:
struct CameraQuery query;
GameProcessCameraQuery(&query);

I never figured out why, but for some reason after executing these two lines, the positions in the texture were being affected.

Hope this is of some help.
John