Advertisement
Guest User

Untitled

a guest
Sep 1st, 2014
248
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. public class GameScreen implements Screen {
  2. SlingshotSteve game;
  3.  
  4. public void Menu(SlingshotSteve game){
  5. this.game = game;
  6. }
  7.  
  8. OrthographicCamera camera;
  9.  
  10. SpriteBatch batch;
  11. TextureRegion backgroundTexture;
  12. Texture texture;
  13.  
  14. GameScreen(final SlingshotSteve gam) {
  15. this.game = gam;
  16.  
  17. camera = new OrthographicCamera(800, 480);
  18.  
  19. batch = new SpriteBatch();
  20.  
  21. Texture texture = new Texture(Gdx.files.internal("background.jpg"));
  22. backgroundTexture = new TextureRegion(texture, 0, 0, 500, 500);
  23.  
  24. }
  25.  
  26. public void render(float delta) {
  27. Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
  28.  
  29. camera.update();
  30. batch.setProjectionMatrix(camera.combined);
  31.  
  32. batch.begin();
  33. batch.draw(backgroundTexture, 0, 0, SlingshotSteve.WIDTH, SlingshotSteve.HEIGHT);
  34. batch.end();
  35.  
  36. }
  37.  
  38. @Override
  39. public void dispose() {
  40. batch.dispose();
  41. texture.dispose();
  42.  
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement