Skip to content

Instantly share code, notes, and snippets.

@11
Last active October 8, 2016 02:22
Show Gist options
  • Save 11/7cf7e46cb4dfffe73fd6a25744826798 to your computer and use it in GitHub Desktop.
Save 11/7cf7e46cb4dfffe73fd6a25744826798 to your computer and use it in GitHub Desktop.
Part 2 - Medium blog - Box2D & Box2d Lights
public class Box2DRunner extends ApplicationAdapter
{
private OrthographicCamera camera; //#1
private World world; //#2
private Box2DDebugRenderer debugRenderer; //#3
@Override
public void create()
{
camera = new OrthographicCamera(Gdx.graphics.getWidth(),
Gdx.graphics.getHeight()); //#4
world = new World(new Vector2(0,-9.8f), false); //#5
debugRenderer = new Box2DDebugRenderer(); //#6
}
@Override
public void render()
{
Gdx.gl.glClearColor(0,0,0,0); //#7
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); //#8
world.step(1/60f, 6, 2); //#9
debugRenderer.render(world, camera.combined); //#10
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment