GuiBitmapCtrl setValue(x, y) how does it work
by JuanMa · in Game Design and Creative Issues · 02/19/2008 (11:01 am) · 2 replies
I have been having a hard time trying to understand how to use the setValue method from guiBitmapCtrl.
I have been trying to use it but every time I get different behavior. According to the documentation the setValue should "modify the positioning of the bitmap this control displays."
Now it does not give any details on how it should be used, well x and y are the offset. Apparently the offset uses the right bottom corner of the image as the starting point (0, 0), but as I said it before, I get very strange and different behavior. For example, negative values do not work. Values over 256 will take the image back to the origin. That was last week, this week no values move the bitmap anywhere...
As you can tell I am very confused with this and all I want to do is move an image around to a specific position of the GuiBitmapCtrl. A good explanation on how to do it would be appreciated.
Thank you
Juan
I have been trying to use it but every time I get different behavior. According to the documentation the setValue should "modify the positioning of the bitmap this control displays."
Now it does not give any details on how it should be used, well x and y are the offset. Apparently the offset uses the right bottom corner of the image as the starting point (0, 0), but as I said it before, I get very strange and different behavior. For example, negative values do not work. Values over 256 will take the image back to the origin. That was last week, this week no values move the bitmap anywhere...
As you can tell I am very confused with this and all I want to do is move an image around to a specific position of the GuiBitmapCtrl. A good explanation on how to do it would be appreciated.
Thank you
Juan
#2
In gui/controls/guiBitmapCtrl.cc I added the following code, It is just like setValue but with slight modifications that Orion Elenzil suggested.
The result is an image that its top left corner is displace from the center of the control, positives are LEFT and UP. I am still testing since I have been getting some strange results.
Juan
02/21/2008 (10:52 am)
Thx Orion. I made these changesIn gui/controls/guiBitmapCtrl.cc I added the following code, It is just like setValue but with slight modifications that Orion Elenzil suggested.
ConsoleMethod( GuiBitmapCtrl, setUnwrapedValue, void, 4, 4, "(int xAxis, int yAxis)"
"Set the offset of the bitmap no wrap.")
{
object->setUnwrapedValue(dAtoi(argv[2]), dAtoi(argv[3]));
}void GuiBitmapCtrl::setUnwrapedValue(S32 x, S32 y)
{
if (mTextureHandle)
{
TextureObject* texture = (TextureObject *) mTextureHandle;
x+=texture->bitmapWidth/2;
y+=texture->bitmapHeight/2;
}
/*while (x < 0)
x += 256;
*/
startPoint.x = x;// % 256;
/*while (y < 0)
y += 256;
*/
startPoint.y = y;// % 256;
}The result is an image that its top left corner is displace from the center of the control, positives are LEFT and UP. I am still testing since I have been getting some strange results.
Juan
Associate Orion Elenzil
Real Life Plus
i can confirm that that routine is indeed wrapping the offsets so that they lie within 0 to 255.
juan,
i see that you own the SDK;
if you're able to recompile, i would recommend just yanking out that stuff and seeing if it works.
if you'd like assistance w/ the yanking out part, post in the SDK private forum and i can show you the lines to yank. then you'll be a line-yanker.