commit 847eb66a69ced101e2bc42bc9096a54a35ba1a96 Author: Anna Fossen-Helle <36955504+annafossen@users.noreply.github.com> Date: Tue Jan 28 14:50:45 2020 +0100 Initial commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c38c7b9 --- /dev/null +++ b/.gitignore @@ -0,0 +1,27 @@ +# Compiled class file +*.class + +# Log file +*.log + +# BlueJ files +*.ctxt + +# Mobile Tools for Java (J2ME) +.mtj.tmp/ + +# Package Files # +*.jar +*.war +*.nar +*.ear +*.zip +*.tar.gz +*.rar + +target +.iml +.idea + +# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml +hs_err_pid* diff --git a/README.md b/README.md new file mode 100644 index 0000000..f2518ec --- /dev/null +++ b/README.md @@ -0,0 +1,8 @@ +# INF112 Maven template +Simple skeleton with libgdx. + + +## Known bugs +Currently throws "WARNING: An illegal reflective access operation has occurred", +when the java version used is >8. This has no effect on function or performance, and is just a warning. + diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..f569f03 --- /dev/null +++ b/pom.xml @@ -0,0 +1,95 @@ + + + + 4.0.0 + + inf112.skeleton.app + mvn-app + 1.0-SNAPSHOT + + mvn-app + + http://www.example.com + + + UTF-8 + 1.7 + 1.7 + + + + + + com.badlogicgames.gdx + gdx + 1.9.9 + + + + com.badlogicgames.gdx + gdx-backend-lwjgl + 1.9.9 + + + + com.badlogicgames.gdx + gdx-platform + 1.9.9 + natives-desktop + + + + junit + junit + 4.11 + test + + + + + + + + + maven-clean-plugin + 3.1.0 + + + + maven-resources-plugin + 3.0.2 + + + maven-compiler-plugin + 3.8.0 + + + maven-surefire-plugin + 2.22.1 + + + maven-jar-plugin + 3.0.2 + + + maven-install-plugin + 2.5.2 + + + maven-deploy-plugin + 2.8.2 + + + + maven-site-plugin + 3.7.1 + + + maven-project-info-reports-plugin + 3.0.0 + + + + + diff --git a/src/main/java/inf112/skeleton/app/HelloWorld.java b/src/main/java/inf112/skeleton/app/HelloWorld.java new file mode 100644 index 0000000..266481a --- /dev/null +++ b/src/main/java/inf112/skeleton/app/HelloWorld.java @@ -0,0 +1,48 @@ +package inf112.skeleton.app; + +import com.badlogic.gdx.ApplicationListener; +import com.badlogic.gdx.Gdx; +import com.badlogic.gdx.graphics.Color; +import com.badlogic.gdx.graphics.GL20; +import com.badlogic.gdx.graphics.g2d.BitmapFont; +import com.badlogic.gdx.graphics.g2d.SpriteBatch; + +public class HelloWorld implements ApplicationListener { + private SpriteBatch batch; + private BitmapFont font; + + @Override + public void create() { + batch = new SpriteBatch(); + font = new BitmapFont(); + font.setColor(Color.RED); + } + + @Override + public void dispose() { + batch.dispose(); + font.dispose(); + } + + @Override + public void render() { + Gdx.gl.glClearColor(1, 1, 1, 1); + Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); + + batch.begin(); + font.draw(batch, "Hello World", 200, 200); + batch.end(); + } + + @Override + public void resize(int width, int height) { + } + + @Override + public void pause() { + } + + @Override + public void resume() { + } +} diff --git a/src/main/java/inf112/skeleton/app/Main.java b/src/main/java/inf112/skeleton/app/Main.java new file mode 100644 index 0000000..68266b2 --- /dev/null +++ b/src/main/java/inf112/skeleton/app/Main.java @@ -0,0 +1,16 @@ +package inf112.skeleton.app; + +import com.badlogic.gdx.backends.lwjgl.LwjglApplication; +import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration; + + +public class Main { + public static void main(String[] args) { + LwjglApplicationConfiguration cfg = new LwjglApplicationConfiguration(); + cfg.title = "hello-world"; + cfg.width = 480; + cfg.height = 320; + + new LwjglApplication(new HelloWorld(), cfg); + } +} \ No newline at end of file diff --git a/src/test/java/inf112/skeleton/app/AppTest.java b/src/test/java/inf112/skeleton/app/AppTest.java new file mode 100644 index 0000000..fedfe2a --- /dev/null +++ b/src/test/java/inf112/skeleton/app/AppTest.java @@ -0,0 +1,19 @@ +package inf112.skeleton.app; + +import static org.junit.Assert.assertTrue; +import org.junit.Test; + +/** + * Unit test for simple App. + */ +public class AppTest +{ + /** + * Rigorous Test :-) + */ + @Test + public void shouldAnswerWithTrue() + { + assertTrue( true ); + } +}