5
« on: October 03, 2011, 08:19:56 pm »
Hi,
I have set up SFML for drawing 2D graphics purposes.
I can draw my sprites in what seem a good position, but when I scale them, they seem misplaced.
The thing is, I developed a game with a graphics module abstraction. So I first developed it with DX9 D3DXSprite underneath the graphics module.
Now I am adding SFML to the module. Everying SEEM to work the same, except for scaled sprites. Sprites which have scaling of 1 SEEM to work ok.
The issue is that I have a life bar by putting a top part, and a bottom part and filling it in the middle. The part in the middle is actually a sprite with some width and a height of 2. I then scale the sprite to fit the amount of life, taking into account the height of the image.
Well, the issue is that in SFML, the scaled sprite doesn't seem to be placed correctly.
I have tried to play with the SetCenter, SetPosition, even Move(which I am not sure what it is doing), but no luck. It just doesn't work.
I looked at the matrix by inheriting sf::Sprite, it looked lake the scaling is correct and the position is where the top of the sprite should be(I think).
Is there any place with documentation of an equation of what SetCenter, SetPosition exactly do?
Thank you