diff --git a/Ressourcen/Rainmeter-skin/resources/game_data/img/box_text_sectors.png b/Ressourcen/Rainmeter-skin/resources/game_data/img/box_text_sectors.png deleted file mode 100644 index d1978b2d3ad482b24fab54ac24126272231a5fd0..0000000000000000000000000000000000000000 Binary files a/Ressourcen/Rainmeter-skin/resources/game_data/img/box_text_sectors.png and /dev/null differ diff --git a/core/assets/control/escape_mainmenu_on.png b/core/assets/control/mainmenu.png similarity index 100% rename from core/assets/control/escape_mainmenu_on.png rename to core/assets/control/mainmenu.png diff --git a/core/assets/map/map_overlay.png b/core/assets/map/map_overlay.png index 51017bee376fdeff0876f2358a260ac937983846..d1978b2d3ad482b24fab54ac24126272231a5fd0 100644 Binary files a/core/assets/map/map_overlay.png and b/core/assets/map/map_overlay.png differ diff --git a/core/assets/map/map_overlay1.png b/core/assets/map/map_overlay1.png new file mode 100644 index 0000000000000000000000000000000000000000..51017bee376fdeff0876f2358a260ac937983846 Binary files /dev/null and b/core/assets/map/map_overlay1.png differ diff --git a/core/src/com/galaxytrucker/galaxytruckerreloaded/Model/Map/Planet.java b/core/src/com/galaxytrucker/galaxytruckerreloaded/Model/Map/Planet.java index 7e51cccf3f684f86f3374b69af9bc685eb2fb36a..ffae61e3ca30c48ada2ba3eea85f7389f8f30cb3 100644 --- a/core/src/com/galaxytrucker/galaxytruckerreloaded/Model/Map/Planet.java +++ b/core/src/com/galaxytrucker/galaxytruckerreloaded/Model/Map/Planet.java @@ -1,11 +1,11 @@ package com.galaxytrucker.galaxytruckerreloaded.Model.Map; -import com.badlogic.gdx.scenes.scene2d.ui.List; import com.galaxytrucker.galaxytruckerreloaded.Model.Ship; import com.j256.ormlite.field.DatabaseField; import lombok.*; import java.io.Serializable; +import java.util.List; @NoArgsConstructor(access = AccessLevel.PUBLIC) @RequiredArgsConstructor(access = AccessLevel.PUBLIC) diff --git a/core/src/com/galaxytrucker/galaxytruckerreloaded/View/Buttons/InGameButtons/MainMenuButton.java b/core/src/com/galaxytrucker/galaxytruckerreloaded/View/Buttons/InGameButtons/MainMenuButton.java index 75cfdffe01ff3ed4979ed2bf1fb251bfdcaddde8..e17a65014d733b58e47683b197aaa4ebc4b762f2 100644 --- a/core/src/com/galaxytrucker/galaxytruckerreloaded/View/Buttons/InGameButtons/MainMenuButton.java +++ b/core/src/com/galaxytrucker/galaxytruckerreloaded/View/Buttons/InGameButtons/MainMenuButton.java @@ -35,7 +35,7 @@ public class MainMenuButton extends ImButton { * constructor */ public MainMenuButton(float x, float y, float width, float height, Main main) { - super(new Texture("sd"), x, y, width, height); + super(new Texture("control/mainmenu.png"), x, y, width, height); this.main = main; this.addListener(new ClickListener() { public void clicked(InputEvent event, float x, float y) { diff --git a/core/src/com/galaxytrucker/galaxytruckerreloaded/View/Buttons/InGameButtons/MapButton.java b/core/src/com/galaxytrucker/galaxytruckerreloaded/View/Buttons/InGameButtons/MapButton.java index 7e93ca28a98151d815fd8744860465e1994ed445..37a35a40dd7061606c5f2977c528c39c77572b58 100644 --- a/core/src/com/galaxytrucker/galaxytruckerreloaded/View/Buttons/InGameButtons/MapButton.java +++ b/core/src/com/galaxytrucker/galaxytruckerreloaded/View/Buttons/InGameButtons/MapButton.java @@ -13,11 +13,6 @@ import com.galaxytrucker.galaxytruckerreloaded.View.UI.Map.MapUI; */ public class MapButton extends ImButton { - /** - * location planet - */ - private float x, y; - /** * planet */ @@ -41,12 +36,10 @@ public class MapButton extends ImButton { * @param width width of button * @param height height of button */ - public MapButton(Texture texture, float x, float y, float width, float height, MapUI ui, float px, float py, Planet planet) { + public MapButton(Texture texture, float x, float y, float width, float height, MapUI ui, Planet planet) { super(texture, x, y, width, height); this.ui = ui; this.planet = planet; - this.x = px; - this.y = py; this.addListener(new ClickListener() { public void clicked(InputEvent event, float x, float y) { diff --git a/core/src/com/galaxytrucker/galaxytruckerreloaded/View/Screen/GamePlay.java b/core/src/com/galaxytrucker/galaxytruckerreloaded/View/Screen/GamePlay.java index 210c70735505450f6f8c540e90efdad86c41da50..61eb2234280035c43a1594eb3f17d5a18c889519 100644 --- a/core/src/com/galaxytrucker/galaxytruckerreloaded/View/Screen/GamePlay.java +++ b/core/src/com/galaxytrucker/galaxytruckerreloaded/View/Screen/GamePlay.java @@ -1,12 +1,16 @@ package com.galaxytrucker.galaxytruckerreloaded.View.Screen; import com.badlogic.gdx.Gdx; +import com.badlogic.gdx.Input; import com.badlogic.gdx.Screen; import com.badlogic.gdx.audio.Music; import com.badlogic.gdx.audio.Sound; import com.badlogic.gdx.graphics.GL20; import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.scenes.scene2d.Stage; +import com.badlogic.gdx.utils.viewport.FitViewport; +import com.badlogic.gdx.utils.viewport.ScreenViewport; +import com.badlogic.gdx.utils.viewport.Viewport; import com.galaxytrucker.galaxytruckerreloaded.Main; import com.galaxytrucker.galaxytruckerreloaded.Model.Crew.Crew; import com.galaxytrucker.galaxytruckerreloaded.Model.Map.Overworld; @@ -26,6 +30,7 @@ import com.galaxytrucker.galaxytruckerreloaded.View.UI.Options.OptionsUI; import com.galaxytrucker.galaxytruckerreloaded.View.UI.Ship.EnemyShip; import com.galaxytrucker.galaxytruckerreloaded.View.UI.Ship.ShipView; +import java.util.HashMap; import java.util.LinkedList; import java.util.List; @@ -99,7 +104,7 @@ public class GamePlay implements Screen { */ public Stage stage; - private AutofireButton autofire; + private Viewport viewport; /** * Constructor @@ -110,9 +115,10 @@ public class GamePlay implements Screen { this.main = main; background = new Texture("1080p.png"); - stage = new Stage(); + viewport = new FitViewport(main.WIDTH, main.HEIGHT); + stage = new Stage(viewport); - player = new ShipView(main, fakeShip(), stage, map, this); //TODO wie schiff aus controller? + player = new ShipView(main, fakeShip(), stage, fakeMap(), this); //TODO wie schiff aus controller? Gdx.input.setInputProcessor(stage); } @@ -132,14 +138,43 @@ public class GamePlay implements Screen { return new Ship(1, "aaron", 100, 49, 5, 5, 7, 9, 23, 6f, planet, 6, 6, rooms, weapons, false); } + /** + * später durch laden aus controller ersetzen + */ + public Overworld fakeMap() { + HashMap<float[], Planet> hmap = new HashMap<>(); + Planet sp = new Planet("planet1", (float) 78, (float) 199, PlanetEvent.SHOP, new LinkedList<Ship>()); + float[] f = new float[2]; + f[0] = 78; + f[1] = 199; + hmap.put(f, sp); + Planet sp1 = new Planet("planet2", (float) 200, (float) 154, PlanetEvent.COMBAT, new LinkedList<Ship>()); + float[] f1 = new float[2]; + f1[0] = 200; + f1[1] = 154; + hmap.put(f1, sp1); + Overworld res = new Overworld(2); + res.setPlanetMap(hmap); + res.setStartPlanet(sp); + + return res; + } + @Override public void show() { } + @Override + public void resize(int width, int height) { + viewport.update(width, height); + } + @Override public void render(float delta) { + updateInput(); + Gdx.gl.glClearColor(1, 1, 1, 1); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); @@ -168,6 +203,20 @@ public class GamePlay implements Screen { stage.dispose(); } + /** + * handles input to pause game, open options + */ + public void updateInput() { + System.out.println("touched"); + if(Gdx.input.isKeyPressed(Input.Keys.O)) { + System.out.println("Where"); + createOptions(); + } + if(Gdx.input.isKeyPressed(Input.Keys.P)) { + //paused + } + } + /** * new event ui */ @@ -208,6 +257,7 @@ public class GamePlay implements Screen { */ public void createOptions() { optionsUI = new OptionsUI(main, stage, this); + //TODO controller sagen dass spiel "pausiert"? } public void deleteOptions() { @@ -267,16 +317,28 @@ public class GamePlay implements Screen { */ public void weaponShot(int id, Room room) {} //call controller - public List<Crew> loadCrew(int shipId) { return null;} - public List<Weapon> loadWeapons(int shipId) { return null;} + public List<Crew> loadCrew(int shipId) { //TODO call controller + List<Crew> result = new LinkedList<>(); + int[] arr = new int[4]; + arr[0] = 3; + arr[1] = 7; + arr[2] = 8; + arr[3] = 6; + Crew c1 = new Crew(1, "ana", 7, 10, arr); + result.add(c1); + Crew c2 = new Crew(2, "battle", 8, 10, arr); + result.add(c2); + return result; + } + public List<Weapon> loadWeapons(int shipId) { + List<Weapon> weapons = new LinkedList<>(); + weapons.add(new LaserBlaster("karl")); + weapons.add(new LaserBlaster("test")); + return weapons; + } public int loadMissiles(int shipId) { return 0; } public int loadFuel(int shipId) { return 0; } - @Override - public void resize(int width, int height) { - - } - @Override public void pause() { diff --git a/core/src/com/galaxytrucker/galaxytruckerreloaded/View/UI/Inventory/InventoryCrewSlotUI.java b/core/src/com/galaxytrucker/galaxytruckerreloaded/View/UI/Inventory/InventoryCrewSlotUI.java index bb7f0f6660933bd1a9abea043f18215597c88a68..23202b09d033832ca2bbc65983bbc92572a5da11 100644 --- a/core/src/com/galaxytrucker/galaxytruckerreloaded/View/UI/Inventory/InventoryCrewSlotUI.java +++ b/core/src/com/galaxytrucker/galaxytruckerreloaded/View/UI/Inventory/InventoryCrewSlotUI.java @@ -55,8 +55,7 @@ public class InventoryCrewSlotUI extends InventorySlotUI { name = crew.getName(); health = crew.getHealth(); maxhealth = crew.getMaxhealth(); - - currTexture = (health/maxhealth) * 10; + currTexture = (int) (((float) health/maxhealth) * 10); healthStatus = new Texture("gameuis/energybar.png"); healthBox = new Texture("crew/health_box.png"); @@ -79,12 +78,12 @@ public class InventoryCrewSlotUI extends InventorySlotUI { public void render() { super.render(); main.batch.begin(); - main.batch.draw(crewTexture, 0, 0, 0, 0); //TODO xywh - main.batch.draw(healthBox, 0, 0, 10, 10); - float x = 0; + main.batch.draw(crewTexture, posX, posY, 72, 72); //48 + main.batch.draw(healthBox, posX+5, posY-15, 50, 15); + float x = posX+11; for(int i=0;i<currTexture;i++) { - main.batch.draw(healthStatus, x, 0, 0, 0); //TODO whxy - x+=5; + main.batch.draw(healthStatus, x, posY-10, 4, 5); + x+=4; } main.batch.end(); } diff --git a/core/src/com/galaxytrucker/galaxytruckerreloaded/View/UI/Inventory/InventorySlotUI.java b/core/src/com/galaxytrucker/galaxytruckerreloaded/View/UI/Inventory/InventorySlotUI.java index 874e48293f3e711dc737e4aa7215b4d214793d65..ae6f80c72b99524701036634ce483301dd948fa2 100644 --- a/core/src/com/galaxytrucker/galaxytruckerreloaded/View/UI/Inventory/InventorySlotUI.java +++ b/core/src/com/galaxytrucker/galaxytruckerreloaded/View/UI/Inventory/InventorySlotUI.java @@ -10,12 +10,12 @@ public abstract class InventorySlotUI { /** * Inventory slot position x */ - private float posX; + protected float posX; /** * Inventory slot position y */ - private float posY; + protected float posY; /** * Inventory slot background diff --git a/core/src/com/galaxytrucker/galaxytruckerreloaded/View/UI/Inventory/InventoryUI.java b/core/src/com/galaxytrucker/galaxytruckerreloaded/View/UI/Inventory/InventoryUI.java index 100ac88966f90df323fe7ad4f283a0b01db00b05..1f5804f9454689358d5a9e56261470c2b10b1f26 100644 --- a/core/src/com/galaxytrucker/galaxytruckerreloaded/View/UI/Inventory/InventoryUI.java +++ b/core/src/com/galaxytrucker/galaxytruckerreloaded/View/UI/Inventory/InventoryUI.java @@ -10,7 +10,6 @@ import com.galaxytrucker.galaxytruckerreloaded.Main; import com.galaxytrucker.galaxytruckerreloaded.Model.Crew.Crew; import com.galaxytrucker.galaxytruckerreloaded.Model.Weapons.Weapon; import com.galaxytrucker.galaxytruckerreloaded.View.Buttons.InGameButtons.InventoryCloseButton; -import com.galaxytrucker.galaxytruckerreloaded.View.Screen.GamePlay; import com.galaxytrucker.galaxytruckerreloaded.View.UI.Ship.ShipView; public class InventoryUI { @@ -36,6 +35,8 @@ public class InventoryUI { private ShipView shipView; + private float x, y; + /** * Constructor * @@ -48,20 +49,29 @@ public class InventoryUI { this.stage = stage; this.shipView = shipView; - closeButton = new InventoryCloseButton(0, 0, 0, 0, null, this); //TODO xywh - stage.addActor(closeButton); - inventoryBackground = new Texture("inventory/inventory.png"); + x = main.WIDTH/2 - inventoryBackground.getWidth()/2; + y = main.HEIGHT/2 - inventoryBackground.getHeight()/2; + + closeButton = new InventoryCloseButton(x+750, y+5, 248, 50, null, this); + stage.addActor(closeButton); + slots = new LinkedList<>(); + float cx = x + 25; + float cy = y + 560; for(Crew c : crew) { - slots.add(new InventoryCrewSlotUI(main, c, 0, 0)); //TODO xy + slots.add(new InventoryCrewSlotUI(main, c, cx, cy)); + cy -= 80; } + float wy = y + 550; + float wx = cx + 200; for(Weapon w : weapons) { - slots.add(new InventoryWeaponSlotUI(main, w, 0, 0)); //TODO xy + slots.add(new InventoryWeaponSlotUI(main, w, wx, wy)); + wy -=90; } - slots.add(new InventoryIntSlotUI(main, fuel, 0, 0, "fuel")); //TODO xy - slots.add(new InventoryIntSlotUI(main, missiles, 0, 0, "missiles")); //TODO xy + slots.add(new InventoryIntSlotUI(main, fuel, wx+200, y+550, "fuel")); //TODO xy + slots.add(new InventoryIntSlotUI(main, missiles, wx+200, y+750, "missiles")); //TODO xy } /** @@ -70,7 +80,7 @@ public class InventoryUI { */ public void render() { main.batch.begin(); - main.batch.draw(inventoryBackground, 0, 0, 0, 0); //TODO xywh + main.batch.draw(inventoryBackground, x, y, 900, 706); main.batch.end(); for(InventorySlotUI u : slots) { diff --git a/core/src/com/galaxytrucker/galaxytruckerreloaded/View/UI/Inventory/InventoryWeaponSlotUI.java b/core/src/com/galaxytrucker/galaxytruckerreloaded/View/UI/Inventory/InventoryWeaponSlotUI.java index 846e86eedeed5c12d6715d1d494309dbeca4b338..b38e81405471aa4e52332e5bf2d2215f7202d706 100644 --- a/core/src/com/galaxytrucker/galaxytruckerreloaded/View/UI/Inventory/InventoryWeaponSlotUI.java +++ b/core/src/com/galaxytrucker/galaxytruckerreloaded/View/UI/Inventory/InventoryWeaponSlotUI.java @@ -60,7 +60,7 @@ public class InventoryWeaponSlotUI extends InventorySlotUI { public void render() { super.render(); main.batch.begin(); - main.batch.draw(weaponTexture, 0, 0, 0, 0); //TODO whxy + main.batch.draw(weaponTexture, posX, posY, 22, 67); main.batch.end(); } diff --git a/core/src/com/galaxytrucker/galaxytruckerreloaded/View/UI/Map/MapUI.java b/core/src/com/galaxytrucker/galaxytruckerreloaded/View/UI/Map/MapUI.java index 9df2e0939534cfed957bb2ddae8b60a95f52cd2a..dfc9206d572522921ccd5c57eedf24d571d6f315 100644 --- a/core/src/com/galaxytrucker/galaxytruckerreloaded/View/UI/Map/MapUI.java +++ b/core/src/com/galaxytrucker/galaxytruckerreloaded/View/UI/Map/MapUI.java @@ -27,6 +27,9 @@ public class MapUI { private ShipView shipView; + private float x; + private float y; + /** * Constructor * @param main - main class @@ -38,9 +41,12 @@ public class MapUI { mapTexture = new Texture("map/map_overlay.png"); + x = main.WIDTH/2 - mapTexture.getWidth()/2; + y = main.HEIGHT/2 - mapTexture.getHeight()/2; + locations = new LinkedList<>(); for(float[] f : map.getPlanetMap().keySet()) { - MapButton mb = new MapButton(new Texture("map/map_button.png"), 0, 0, 0, 0, this, f[0], f[1], map.getPlanetMap().get(f)); + MapButton mb = new MapButton(new Texture("map/map_button.png"), (x+f[0]), (y+f[1]), 10, 10, this, map.getPlanetMap().get(f)); locations.add(mb); stage.addActor(mb); } @@ -52,7 +58,7 @@ public class MapUI { */ public void render() { main.batch.begin(); - main.batch.draw(mapTexture, 0, 0, 0, 0); //TODO whxy + main.batch.draw(mapTexture, x, y, 1160, 626); main.batch.end(); } diff --git a/core/src/com/galaxytrucker/galaxytruckerreloaded/View/UI/Options/OptionsUI.java b/core/src/com/galaxytrucker/galaxytruckerreloaded/View/UI/Options/OptionsUI.java index 5062899c9efa06a4324574accb334cafde468060..f0656f1ff8dc54ac6608b4ea167d40915608dc7a 100644 --- a/core/src/com/galaxytrucker/galaxytruckerreloaded/View/UI/Options/OptionsUI.java +++ b/core/src/com/galaxytrucker/galaxytruckerreloaded/View/UI/Options/OptionsUI.java @@ -32,10 +32,10 @@ public class OptionsUI { private Main main; - private Stage stage; - private GamePlay game; + private float x, y; + /** * Constructor * @@ -43,16 +43,18 @@ public class OptionsUI { */ public OptionsUI(Main main, Stage stage, GamePlay game) { this.main = main; - this.stage = stage; this.game = game; - continueButton = new ContinueButton(0, 0, 10, 10, this); - mainMenuButton = new MainMenuButton(0, 0, 10, 10, main); //TODO whxy + optionsBackgroundTexture = new Texture("options/options.png"); + + x = main.WIDTH/2 - optionsBackgroundTexture.getWidth()/2; + y = main.HEIGHT/2 - optionsBackgroundTexture.getHeight()/2; + + continueButton = new ContinueButton(x+10, y+20, 10, 10, this); + mainMenuButton = new MainMenuButton(x+10, y+50, 10, 10, main); //TODO whxy stage.addActor(continueButton); stage.addActor(mainMenuButton); - - optionsBackgroundTexture = new Texture("options/options.png"); } /** @@ -61,7 +63,7 @@ public class OptionsUI { */ public void render() { main.batch.begin(); - main.batch.draw(optionsBackgroundTexture, 0, 0, 10, 10); //TODO whxy + main.batch.draw(optionsBackgroundTexture, x, y, 601, 471); main.batch.end(); } diff --git a/core/src/com/galaxytrucker/galaxytruckerreloaded/View/UI/Ship/ShipView.java b/core/src/com/galaxytrucker/galaxytruckerreloaded/View/UI/Ship/ShipView.java index c4b2a3e08e779514181be09c864cfffe2f5c5422..06fc12cc9948ed0544c91253bb6ab663b0175bf6 100644 --- a/core/src/com/galaxytrucker/galaxytruckerreloaded/View/UI/Ship/ShipView.java +++ b/core/src/com/galaxytrucker/galaxytruckerreloaded/View/UI/Ship/ShipView.java @@ -110,8 +110,8 @@ public class ShipView extends AbstractShip { } weaponAutofire = new AutofireButton(1020, 130, 248, 50, this); - moveButton = new MoveButton(850, main.HEIGHT - 90, 300, 500, this); //TODO same here - inventory = new ShipButton(750,main.HEIGHT - 80, 450, 500, this); //TODO warum ändert sich die größe nicht + moveButton = new MoveButton(850, main.HEIGHT - 90, 150, 92, this); //TODO same here + inventory = new ShipButton(750,main.HEIGHT - 80, 50, 92, this); //TODO warum ändert sich die größe nicht money = new ScrapUI(main, ship.getCoins()); hull = new HullUI(main, ship.getHp()); @@ -122,8 +122,8 @@ public class ShipView extends AbstractShip { weaponGeneralBackground = new Texture("shipsys/weapon/generalbox.png"); stage.addActor(weaponAutofire); - stage.addActor(moveButton); stage.addActor(inventory); + stage.addActor(moveButton); } /** @@ -201,8 +201,7 @@ public class ShipView extends AbstractShip { * called by ship button */ public void openInventory() { - inventoryUI = new InventoryUI(main, game.loadCrew(id), game.loadWeapons(id), game.loadFuel(id), game.loadMissiles(id), stage, this); //TODO aus controller? aus ship? - //evtl zur sicherheit aus controller um aktuelle daten zu haben + inventoryUI = new InventoryUI(main, game.loadCrew(id), game.loadWeapons(id), game.loadFuel(id), game.loadMissiles(id), stage, this); } public void deleteInventory() {