C++, SDL and Box2D game

Discussion in 'Game programming' started by ryaneoghan, Jan 4, 2012.

  1. ryaneoghan

    ryaneoghan New Member

    Joined:
    Jan 4, 2012
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    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.

    thanks,

    eoghan
     
  2. mialuzzatto

    mialuzzatto New Member

    Joined:
    Aug 5, 2015
    Messages:
    122
    Likes Received:
    5
    Trophy Points:
    0
    Occupation:
    Work at https://www.idevelopersquare.com
    Location:
    Waltham, MA, USA
    Home Page:
    https://www.idevelopersquare.com
    Hello,

    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)
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice