i'm currently trying to get box2d 2.0 work with the dark gdk sdk.
since the position of a simple sprite is always on the left corner, serialization with a b2body-coordinate turned out pretty easy:
void PaperSprite::SetPositionCenter(b2Vec2& position)
m_position = position;
m_position.x -= dbSpriteWidth(m_spriteNumber) / 2;
m_position.y -= dbSpriteHeight(m_spriteNumber) / 2;
dbSprite(m_spriteNumber, (int)m_position.x, (int)m_position.y, m_pictureNumber);
but unfortunately dark sdk isn't supporting any function to set the pivot point. i need to find a way to "calculate" the point to the center of the sprite.
currently my serialization with the b2body's rotation looks like that:
void PaperSprite::SetRotate(float angle)
angle *= -180 / b2_pi;
...but the rolling ball looks pretty awkward, since the pivot point of dbRotateSprite isn't in the center, but on the left corner of the sprite...
i know that there must be a way to calculate the center of the rotated sprite and set the position correctly, but unfortunately i wasn't able to get decent results...
and that's why i'm asking you: anybody here to help me out?