Skip to content

Instantly share code, notes, and snippets.

@sparkica
Created October 16, 2017 09:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sparkica/3ee45a49b7f73f27083c335c60bd94ab to your computer and use it in GitHub Desktop.
Save sparkica/3ee45a49b7f73f27083c335c60bd94ab to your computer and use it in GitHub Desktop.
Beginning game development with LibGDX - creating SpriteBatch
public class GameDemo extends ApplicationAdapter {
SpriteBatch batch;
Texture img;
@Override
public void create() {
batch = new SpriteBatch();
img = new Texture("badlogic.jpg");
}
@Override
public void render() {
Gdx.gl.glClearColor(1, 0, 0, 1);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
batch.begin();
batch.draw(img, 0, 0);
batch.end();
}
@Override
public void dispose() {
batch.dispose();
img.dispose();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment