With the talk of the SFML books I was thinking about collision detection and a simple solution.
I have created a function at the moment which accepts sfml shape objects. So you can also draw the shapes your using for debugging or in the actual game.
It works with all the shapes transformations. Such as translation, scale and rotation.
The actual code for this is about 100 lines
This is an example of an person collides with another object it will keep the object out of the wall.
sf::ConvexShape polygon;
sf::CircleShape person;
....
sf::Vector3f intersect;
sf::Vector2f pos;
if(collision(person,polygon,intersect,pos))//order of shapes is important as intersect direction will be reversed
{
person.move(intersect.x*intersect.z,intersect.y*intersect.z);
}
Here is a little demo I was testing. Warning the physics is not even an attempt at proper physics. Though the collision detection works well and you could expand on this with whatever logic you want.
http://www.youtube.com/watch?v=qz_-AqdDK5I&feature=youtu.beI am not sure what the plan should be next. Should I create Classes for these and that way classes can contain multiple convexShapes to make more usefull collision objects. Should I go as far as some lightweight physics? In any case I am not going to have it do any scene management.