Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import com.badlogic.gdx.ApplicationListener;
- import com.badlogic.gdx.Gdx;
- import com.badlogic.gdx.graphics.GL10;
- import com.badlogic.gdx.graphics.OrthographicCamera;
- import com.badlogic.gdx.graphics.Texture;
- import com.badlogic.gdx.graphics.Texture.TextureFilter;
- import com.badlogic.gdx.graphics.g2d.Sprite;
- import com.badlogic.gdx.graphics.g2d.SpriteBatch;
- import com.badlogic.gdx.graphics.g2d.TextureRegion;
- public class GdxDemo implements ApplicationListener {
- private OrthographicCamera camera;
- private SpriteBatch batch;
- private Texture texture;
- @Override
- public void create() {
- float w = Gdx.graphics.getWidth();
- float h = Gdx.graphics.getHeight();
- camera = new OrthographicCamera(1, h/w);
- camera.zoom = - 100;
- batch = new SpriteBatch();
- texture = new Texture(Gdx.files.internal("data/libgdx.png"));
- texture.setFilter(TextureFilter.Linear, TextureFilter.Linear);
- TextureRegion region = new TextureRegion(texture, 0, 0, 512, 275);
- }
- @Override
- public void dispose() {
- batch.dispose();
- texture.dispose();
- }
- @Override
- public void render() {
- Gdx.gl.glClearColor(1, 1, 1, 1);
- Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
- System.out.println("zoom:" + camera.zoom);
- batch.setProjectionMatrix(camera.combined);
- batch.begin();
- batch.draw(region, 10, 10); // not sure where to draw it so maybe u should change these
- sprite.draw(batch);
- batch.end();
- }
- @Override
- public void resize(int width, int height) {
- }
- @Override
- public void pause() {
- }
- @Override
- public void resume() {
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement