I've recently added simple collision detection for my pong like game. Basically it works like i've got 800x600 frame and im checking if this big frame contains player sprite. Everything is working fine except bottom.
Here's sample code
sf::FloatRect frameBig(0,0,800,600);
if(!frameBig.contains(sprPlayer.getGlobalBounds().left,sprPlayer.getGlobalBounds().top)
||!frameBig.contains(sprPlayer.getGlobalBounds().left+sprPlayer.getGlobalBounds().width,sprPlayer.getGlobalBounds().top)
||!frameBig.contains(sprPlayer.getGlobalBounds().left+sprPlayer.getGlobalBounds().width,sprPlayer.getGlobalBounds().top+sprPlayer.getGlobalBounds().height)
||!frameBig.contains(sprPlayer.getGlobalBounds().left,sprPlayer.getGlobalBounds().top+sprPlayer.getGlobalBounds().height))
So checking top Left, top Right, bottom Right and bottom Left corners of the sprite if they are inside of frame. As I said left,top and right detection works perfectly ( pixel perfect ) but somehow when comming to bottom player sprite stops bit higher like one pixel is missing. Why is there a diffrence?
Here's pic:
Edit:
And the movement is set 1.0f per step.