SUPER DUPER ULTRA MERGE INCOMING

master
GammelJan 6 years ago
parent 37a74fe230
commit acdb934a34

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 250 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

@ -2,6 +2,7 @@ package com.dungeoncrawler.view;
import com.badlogic.gdx.Gdx; import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.GL20; import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.graphics.Pixmap; import com.badlogic.gdx.graphics.Pixmap;
import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.SpriteBatch; import com.badlogic.gdx.graphics.g2d.SpriteBatch;
@ -13,14 +14,14 @@ import com.dungeoncrawler.model.Entity;
public class MainMenu{ public class MainMenu{
//MENU-SCREEN //MENU-SCREEN
Texture b; Texture startButtonTexture;
Texture t; Texture quitButtonTexture;
Sprite button; Texture backgroundTexture;
Sprite title; Sprite startButtonSprite;
Sprite quitButtonSprite;
Sprite backgroundSprite;
//ENTITIES //ENTITIES
Texture[] entityTextures;
Sprite[] entitySprites;
//CURSOR //CURSOR
Texture c; Texture c;
@ -28,19 +29,38 @@ public class MainMenu{
float CursorMoveX; float CursorMoveX;
float CursorMoveY; float CursorMoveY;
//CAMERA
float w = Gdx.graphics.getWidth();
float h = Gdx.graphics.getHeight();
OrthographicCamera camera;
public MainMenu() { public MainMenu() {
//MENU-SCREEN //MENU-SCREEN
float w = Gdx.graphics.getWidth(); float w = Gdx.graphics.getWidth();
float h = Gdx.graphics.getHeight(); float h = Gdx.graphics.getHeight();
float wc = w/2; float wc = w/2;
b = new Texture("Button.png");
t = new Texture("Title.png");
button = new Sprite(b);
title = new Sprite(t); startButtonTexture = new Texture("startButton.png");
title.setX(wc - (title.getWidth()/2)); quitButtonTexture = new Texture("quitButton.png");
title.setY(h - 200); backgroundTexture = new Texture("MAINSCREEN.png");
button.setX(wc - (button.getWidth()/2));
button.setY(400); 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")); Pixmap pm = new Pixmap(Gdx.files.internal("cursor.png"));
Gdx.graphics.setCursor(Gdx.graphics.newCursor(pm, 0, 0)); Gdx.graphics.setCursor(Gdx.graphics.newCursor(pm, 0, 0));
@ -67,8 +87,10 @@ public class MainMenu{
cursor.setY(cursor.getY()+ CursorMoveY); cursor.setY(cursor.getY()+ CursorMoveY);
batch.begin(); batch.begin();
title.draw(batch); batch.setProjectionMatrix(camera.combined);
button.draw(batch); backgroundSprite.draw(batch);
startButtonSprite.draw(batch);
quitButtonSprite.draw(batch);
cursor.draw(batch); cursor.draw(batch);
batch.end(); batch.end();
} }
@ -103,10 +125,13 @@ public class MainMenu{
} }
public int click(){ // prueft ob cursor mit button (START) ueberlappt public int click(){ // prueft ob cursor mit button (START) ueberlappt
Rectangle rectangleCursor = cursor.getBoundingRectangle(); Rectangle rectangleCursor = cursor.getBoundingRectangle();
Rectangle rectangleButton = button.getBoundingRectangle(); boolean overlapsPlay = rectangleCursor.overlaps(startButtonSprite.getBoundingRectangle());
boolean overlapsPlay = rectangleCursor.overlaps(rectangleButton); boolean overlapsQuit = rectangleCursor.overlaps(quitButtonSprite.getBoundingRectangle());
if(overlapsPlay == true){ 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;} else{return -1;}
} }

@ -12,7 +12,7 @@ public class DesktopLauncher {
config.width = 1600; config.width = 1600;
config.height = 900; config.height = 900;
config.title = "The Restless Caverns"; config.title = "The Restless Caverns";
config.addIcon("icon.png", Files.FileType.Internal); config.addIcon("logo.png", Files.FileType.Internal);
new LwjglApplication(new Controller(), config); new LwjglApplication(new Controller(), config);
} }

Loading…
Cancel
Save