Skip to content

Instantly share code, notes, and snippets.

@mrp1q7z
Created August 30, 2014 13:49
Show Gist options
  • Save mrp1q7z/7e8d424a6858737dbc93 to your computer and use it in GitHub Desktop.
Save mrp1q7z/7e8d424a6858737dbc93 to your computer and use it in GitHub Desktop.
libGDX sample
package name.taoka.ugeee.basicgraphics;
import com.badlogic.gdx.ApplicationAdapter;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.Sprite;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
public class MyGdxGame extends ApplicationAdapter {
SpriteBatch batch;
Texture img;
private Sprite sprite;
@Override
public void create () {
batch = new SpriteBatch();
img = new Texture(Gdx.files.internal("jet.png"));
sprite = new Sprite(img);
}
@Override
public void render () {
Gdx.gl.glClearColor(1, 1, 1, 1);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
batch.begin();
sprite.draw(batch);
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