From 4e898d384f9c8442407d2461c2ad3f27706f28cf Mon Sep 17 00:00:00 2001 From: GammelJan Date: Wed, 1 Apr 2020 13:05:34 +0200 Subject: [PATCH] MainMenu created - no function yet --- core/src/com/dungeoncrawler/view/View.java | 17 ++++++++++------- .../dungeoncrawler/desktop/DesktopLauncher.java | 6 ++++-- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/core/src/com/dungeoncrawler/view/View.java b/core/src/com/dungeoncrawler/view/View.java index 01024e8..6884f34 100644 --- a/core/src/com/dungeoncrawler/view/View.java +++ b/core/src/com/dungeoncrawler/view/View.java @@ -17,19 +17,22 @@ public class View extends ApplicationAdapter { @Override public void create () { batch = new SpriteBatch(); - b = new Texture("button.png"); - t = new Texture("title.png"); + b = new Texture("Button.png"); + t = new Texture("Title.png"); button = new Sprite(b); title = new Sprite(t); - title.setX(0); - title.setY(0); - button.setX(75); - button.setY(150); + float w = Gdx.graphics.getWidth(); + float h = Gdx.graphics.getHeight(); + float wc = w/2; + title.setX(wc - (title.getWidth()/2)); + title.setY(h - 200); + button.setX(wc - (button.getWidth()/2)); + button.setY(400); } @Override public void render () { - Gdx.gl.glClearColor(1, 0, 0, 1); + Gdx.gl.glClearColor(0, 0, 0, 1); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); batch.begin(); diff --git a/desktop/src/com/dungeoncrawler/desktop/DesktopLauncher.java b/desktop/src/com/dungeoncrawler/desktop/DesktopLauncher.java index cd978d5..ffdbed2 100644 --- a/desktop/src/com/dungeoncrawler/desktop/DesktopLauncher.java +++ b/desktop/src/com/dungeoncrawler/desktop/DesktopLauncher.java @@ -2,11 +2,13 @@ package com.dungeoncrawler.desktop; import com.badlogic.gdx.backends.lwjgl.LwjglApplication; import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration; -import com.dungeoncrawler.Main; +import com.dungeoncrawler.view.View; public class DesktopLauncher { public static void main (String[] arg) { LwjglApplicationConfiguration config = new LwjglApplicationConfiguration(); - new LwjglApplication(new Main(), config); + config.width = 1600; + config.height = 900; + new LwjglApplication(new View(), config); } }