Hi zsbzsb. Thanks for your reply.
I think i tried almost all tricks now, been on this for ages. Now i am doing the following before drawing:
- Position of the player is rounded. (I should remove this, since the position of the camera, that is centered around the player, is also rounded before drawing)
- Center of the view is set rounded(player position + half its size).
- Positions of all entities (mobs, tiles) are rounded, then vec2f (0.375, 0.375) is added to their position.
Since those are drawn relative to the camera, they should have 0.375 offset.
This is pixel perfect, as long as i don't zoom in/out.
For zooming, i dont like use Zoom() as this zooms in/out relative to the currenct zoom level. E.g., if i zoom using Zoom(0.96f) i'd have to undo it setting Zoom(1/0.96f) which can not be represented as float (with finite mantisse
without introducing rounding error.
Instead of zooming from the default view, i am just setting the Size of the View. I am using a tweening lib for a smooth QuadInOut effect, and - again - rounding the Size vec. So all the entity boundaries should hit x.375, y.375 relative to the camera.
Still the issue consists.
Where do i go wrong with the zooming?