From e7874ef8db277c7fae6534e0b788692dd67a433d Mon Sep 17 00:00:00 2001 From: GammelJan Date: Wed, 1 Apr 2020 11:31:40 +0200 Subject: [PATCH] Klasse Grafik erstellt --- core/src/com/dungeoncrawler/Grafik.java | 33 +++++++++++++++++++++++++ core/src/com/dungeoncrawler/Main.java | 26 ------------------- 2 files changed, 33 insertions(+), 26 deletions(-) create mode 100644 core/src/com/dungeoncrawler/Grafik.java diff --git a/core/src/com/dungeoncrawler/Grafik.java b/core/src/com/dungeoncrawler/Grafik.java new file mode 100644 index 0000000..08a0175 --- /dev/null +++ b/core/src/com/dungeoncrawler/Grafik.java @@ -0,0 +1,33 @@ +package com.dungeoncrawler; + +import com.badlogic.gdx.ApplicationAdapter; +import com.badlogic.gdx.Gdx; +import com.badlogic.gdx.graphics.GL20; +import com.badlogic.gdx.graphics.Texture; +import com.badlogic.gdx.graphics.g2d.SpriteBatch; + +public class Grafik extends ApplicationAdapter { + SpriteBatch batch; + Texture img; + + @Override + public void create () { + batch = new SpriteBatch(); + img = new Texture("badlogic.jpg"); + } + + @Override + public void render () { + Gdx.gl.glClearColor(1, 0, 0, 1); + Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); + batch.begin(); + batch.draw(img, 0, 0); + batch.end(); + } + + @Override + public void dispose () { + batch.dispose(); + img.dispose(); + } +} diff --git a/core/src/com/dungeoncrawler/Main.java b/core/src/com/dungeoncrawler/Main.java index 0b9e642..47e78e0 100644 --- a/core/src/com/dungeoncrawler/Main.java +++ b/core/src/com/dungeoncrawler/Main.java @@ -1,33 +1,7 @@ package com.dungeoncrawler; import com.badlogic.gdx.ApplicationAdapter; -import com.badlogic.gdx.Gdx; -import com.badlogic.gdx.graphics.GL20; -import com.badlogic.gdx.graphics.Texture; -import com.badlogic.gdx.graphics.g2d.SpriteBatch; public class Main extends ApplicationAdapter { - SpriteBatch batch; - Texture img; - @Override - public void create () { - batch = new SpriteBatch(); - img = new Texture("badlogic.jpg"); - } - - @Override - public void render () { - Gdx.gl.glClearColor(1, 0, 0, 1); - Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); - batch.begin(); - batch.draw(img, 0, 0); - batch.end(); - } - - @Override - public void dispose () { - batch.dispose(); - img.dispose(); - } }