Created
August 30, 2014 13:49
-
-
Save mrp1q7z/7e8d424a6858737dbc93 to your computer and use it in GitHub Desktop.
libGDX sample
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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