diff --git a/core/assets/Button.png b/core/assets/Button.png deleted file mode 100644 index c6bdc93..0000000 Binary files a/core/assets/Button.png and /dev/null differ diff --git a/core/assets/MAINSCREEN.png b/core/assets/MAINSCREEN.png new file mode 100644 index 0000000..15c20f4 Binary files /dev/null and b/core/assets/MAINSCREEN.png differ diff --git a/core/assets/Title.png b/core/assets/Title.png deleted file mode 100644 index e2df3a4..0000000 Binary files a/core/assets/Title.png and /dev/null differ diff --git a/core/assets/quitButton.png b/core/assets/quitButton.png new file mode 100644 index 0000000..ee2b467 Binary files /dev/null and b/core/assets/quitButton.png differ diff --git a/core/assets/startButton.png b/core/assets/startButton.png new file mode 100644 index 0000000..484a67d Binary files /dev/null and b/core/assets/startButton.png differ diff --git a/core/src/com/dungeoncrawler/view/MainMenu.java b/core/src/com/dungeoncrawler/view/MainMenu.java index 39e927b..09840e2 100644 --- a/core/src/com/dungeoncrawler/view/MainMenu.java +++ b/core/src/com/dungeoncrawler/view/MainMenu.java @@ -2,6 +2,7 @@ package com.dungeoncrawler.view; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.graphics.GL20; +import com.badlogic.gdx.graphics.OrthographicCamera; import com.badlogic.gdx.graphics.Pixmap; import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.graphics.g2d.SpriteBatch; @@ -13,14 +14,14 @@ import com.dungeoncrawler.model.Entity; public class MainMenu{ //MENU-SCREEN - Texture b; - Texture t; - Sprite button; - Sprite title; + Texture startButtonTexture; + Texture quitButtonTexture; + Texture backgroundTexture; + Sprite startButtonSprite; + Sprite quitButtonSprite; + Sprite backgroundSprite; //ENTITIES - Texture[] entityTextures; - Sprite[] entitySprites; //CURSOR Texture c; @@ -28,19 +29,38 @@ public class MainMenu{ float CursorMoveX; float CursorMoveY; + //CAMERA + float w = Gdx.graphics.getWidth(); + float h = Gdx.graphics.getHeight(); + OrthographicCamera camera; + public MainMenu() { //MENU-SCREEN float w = Gdx.graphics.getWidth(); float h = Gdx.graphics.getHeight(); float wc = w/2; - b = new Texture("Button.png"); - t = new Texture("Title.png"); - button = new Sprite(b); - title = new Sprite(t); - title.setX(wc - (title.getWidth()/2)); - title.setY(h - 200); - button.setX(wc - (button.getWidth()/2)); - button.setY(400); + + + + startButtonTexture = new Texture("startButton.png"); + quitButtonTexture = new Texture("quitButton.png"); + backgroundTexture = new Texture("MAINSCREEN.png"); + + startButtonSprite = new Sprite(startButtonTexture); + quitButtonSprite = new Sprite(quitButtonTexture); + backgroundSprite = new Sprite(backgroundTexture); + + startButtonSprite.setX(100f); + startButtonSprite.setY(350f); + quitButtonSprite.setX(50f); + quitButtonSprite.setY(50f); + backgroundSprite.setX(0f); + backgroundSprite.setY(0f); + + camera = new OrthographicCamera(1, h/w); + camera.zoom = 1200f; + camera.translate(backgroundSprite.getWidth()/2, backgroundSprite.getHeight()/2); + camera.update(); Pixmap pm = new Pixmap(Gdx.files.internal("cursor.png")); Gdx.graphics.setCursor(Gdx.graphics.newCursor(pm, 0, 0)); @@ -67,8 +87,10 @@ public class MainMenu{ cursor.setY(cursor.getY()+ CursorMoveY); batch.begin(); - title.draw(batch); - button.draw(batch); + batch.setProjectionMatrix(camera.combined); + backgroundSprite.draw(batch); + startButtonSprite.draw(batch); + quitButtonSprite.draw(batch); cursor.draw(batch); batch.end(); } @@ -103,10 +125,13 @@ public class MainMenu{ } public int click(){ // prueft ob cursor mit button (START) ueberlappt Rectangle rectangleCursor = cursor.getBoundingRectangle(); - Rectangle rectangleButton = button.getBoundingRectangle(); - boolean overlapsPlay = rectangleCursor.overlaps(rectangleButton); + boolean overlapsPlay = rectangleCursor.overlaps(startButtonSprite.getBoundingRectangle()); + boolean overlapsQuit = rectangleCursor.overlaps(quitButtonSprite.getBoundingRectangle()); if(overlapsPlay == true){ - return 0; // ints weil fuer mehr buttons eine ID festgelegt werden kann. 0 = START - -1 = kein button + return 0; // ints weil fuer mehr buttons eine ID festgelegt werden kann. 0 = START || 1 = QUIT ||| -1 = kein button + } + else if(overlapsQuit == true){ + return 1; } else{return -1;} } diff --git a/desktop/src/com/dungeoncrawler/desktop/DesktopLauncher.java b/desktop/src/com/dungeoncrawler/desktop/DesktopLauncher.java index 7efdcfc..7c91bf9 100644 --- a/desktop/src/com/dungeoncrawler/desktop/DesktopLauncher.java +++ b/desktop/src/com/dungeoncrawler/desktop/DesktopLauncher.java @@ -12,7 +12,7 @@ public class DesktopLauncher { config.width = 1600; config.height = 900; config.title = "The Restless Caverns"; - config.addIcon("icon.png", Files.FileType.Internal); + config.addIcon("logo.png", Files.FileType.Internal); new LwjglApplication(new Controller(), config); }