vito-Z80

Untitled

Mar 6th, 2018
316
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.95 KB | None | 0 0
  1. public class Main extends ApplicationAdapter {
  2.     SpriteBatch batch;
  3.     Sprite sprite;
  4.  
  5.  
  6.     private final int number = 10;
  7.     private final float texWidth = 32;
  8.     private final float texHeight = 32;
  9.  
  10.  
  11.     @Override
  12.     public void create() {
  13.         batch = new SpriteBatch();
  14.         sprite = new Sprite();
  15.         sprite.setRegion(new Texture("badlogic.jpg"));
  16.         sprite.setBounds(0, 0, texWidth * number, texHeight);
  17.         sprite.getTexture().setWrap(Texture.TextureWrap.Repeat, Texture.TextureWrap.Repeat);
  18.         sprite.setU(-number);
  19.     }
  20.  
  21.     @Override
  22.     public void render() {
  23.         float delta = Gdx.graphics.getDeltaTime();
  24.         Gdx.gl.glClearColor(1, 0, 0, 1);
  25.         Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
  26.         batch.begin();
  27.         sprite.draw(batch);
  28.         batch.end();
  29.     }
  30.  
  31.     @Override
  32.     public void dispose() {
  33.         batch.dispose();
  34.         sprite.getTexture().dispose();
  35.     }
Advertisement
Add Comment
Please, Sign In to add comment