Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Main extends ApplicationAdapter {
- SpriteBatch batch;
- Sprite sprite;
- private final int number = 10;
- private final float texWidth = 32;
- private final float texHeight = 32;
- @Override
- public void create() {
- batch = new SpriteBatch();
- sprite = new Sprite();
- sprite.setRegion(new Texture("badlogic.jpg"));
- sprite.setBounds(0, 0, texWidth * number, texHeight);
- sprite.getTexture().setWrap(Texture.TextureWrap.Repeat, Texture.TextureWrap.Repeat);
- sprite.setU(-number);
- }
- @Override
- public void render() {
- float delta = Gdx.graphics.getDeltaTime();
- Gdx.gl.glClearColor(1, 0, 0, 1);
- Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
- batch.begin();
- sprite.draw(batch);
- batch.end();
- }
- @Override
- public void dispose() {
- batch.dispose();
- sprite.getTexture().dispose();
- }
Advertisement
Add Comment
Please, Sign In to add comment