| 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 DrawSprite extends ApplicationAdapter { | |
| SpriteBatch spriteBatch; | |
| Sprite mySprite; | |
| @Override | |
| public void create() { | |
| spriteBatch = new SpriteBatch(); | |
| mySprite = new Sprite(new Texture(Gdx.files.internal("badlogic.jpg"))); | |
| mySprite.setSize(100, 100); | |
| } | |
| @Override | |
| public void render() { | |
| Gdx.gl.glClearColor(1, 0, 0, 1); | |
| Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); | |
| spriteBatch.begin(); | |
| mySprite.draw(spriteBatch); | |
| spriteBatch.end(); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment