I would like to add a Rect to IW2D so that I can do collision detection between two images. I created a struct Rect(x,y,width,height)
I'm rendering using the following code:
Transform.SetRot(Angle);
Transform.ScaleRot(Scale);
Transform.SetTrans(Position);
Iw2DSetTransformMatrix(Transform);
Iw2DSetColour(Colour);
// Render image
if (ShipBullet != 0)
Iw2DDrawImage(ShipBullet, CIwFVec2(Position.x, Position.y));
boundingRect.srcX = Position.x;
boundingRect.SrcY = Position.y;
Iw2DSetColour(0xff0000ff); // Set red
Iw2DDrawRect(CIwFVec2(boundingRect.srcX, boundingRect.SrcY),
CIwFVec2(boundingRect.Width, boundingRect.Height));
but I still don't know how to update boundingRect of the sprite. I added a debug code IW2DDrawRect to draw the bounding rect, but the rect doesn't bound the image, it's actually drawn somewhere else.