C++, SDL and Box2D game

ryaneoghan's Avatar, Join Date: Jan 2012
Newbie Member
Hello everyone, I'm in the process of trying to get some simple physics working in Box2D using SDL for rendering.
My question is this: how do I actually visualise the physics being done by Box2D using SDL? Is it a case of "grafting" bitmap graphics onto objects into the Box2D world?
Can anyone provide me with a simple code example? There is a shocking lack of tutorials online covering this so hopefully someone may be able to help.


mialuzzatto's Avatar, Join Date: Aug 2015
Ambitious contributor

Your game obects would probaly have to create both SDL(Example: SDL_Surface*) and Box2D(Example: b2Body*) as structure.

Each update you use the box2D's step (Example: b2World::Step()) and for drawing you use SDL (SDL_BlitSurface(), SDL_Flip(), etc)