Advertisement
Guest User

Untitled

a guest
Oct 24th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 5 1.27 KB | None | 0 0
  1. package com.mygdx.game;
  2.  
  3. import com.badlogic.gdx.graphics.Texture;
  4. import com.badlogic.gdx.graphics.g2d.Batch;
  5. import com.badlogic.gdx.graphics.g2d.Sprite;
  6. import com.badlogic.gdx.graphics.g2d.TextureRegion;
  7.  
  8. public class DopClass {
  9.  
  10.     Sprite badlogic;
  11.     TextureRegion youPicture = new TextureRegion(new Texture("badlogic.jpg"));
  12.  
  13.     public DopClass(){
  14.  
  15.         badlogic = new Sprite();
  16.         badlogic.setRegion(youPicture);
  17.         badlogic.setBounds(10,10,50,50);
  18.     }
  19.  
  20.     public void render(Batch b){
  21.         badlogic.draw(b);
  22.         //b.draw(badlogic,badlogic.getX(),badlogic.getY());
  23.     }
  24.  
  25. }
  26.  
  27. package com.mygdx.game;
  28.  
  29. import com.badlogic.gdx.ApplicationAdapter;
  30. import com.badlogic.gdx.Gdx;
  31. import com.badlogic.gdx.graphics.GL20;
  32. import com.badlogic.gdx.graphics.Texture;
  33. import com.badlogic.gdx.graphics.g2d.SpriteBatch;
  34.  
  35. public class Main extends ApplicationAdapter {
  36.     SpriteBatch batch;
  37.  
  38.     DopClass dc = new DopClass();
  39.  
  40.    
  41.     @Override
  42.     public void create () {
  43.         batch = new SpriteBatch();
  44.     }
  45.  
  46.     @Override
  47.     public void render () {
  48.         Gdx.gl.glClearColor(1, 0, 0, 1);
  49.         Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
  50.         batch.begin();
  51.         dc.render(batch);
  52.         batch.end();
  53.     }
  54.    
  55.     @Override
  56.     public void dispose () {
  57.         batch.dispose();
  58.     }
  59. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement