diff --git a/Ressourcen/Rainmeter-skin/resources/game_data/img/buttons/FTL/FTL_JUMP.png b/core/assets/FTL_JUMP.png similarity index 100% rename from Ressourcen/Rainmeter-skin/resources/game_data/img/buttons/FTL/FTL_JUMP.png rename to core/assets/FTL_JUMP.png diff --git a/Ressourcen/Rainmeter-skin/resources/game_data/img/ipad/systemUI/autofire_on.png b/core/assets/autofire_on.png similarity index 100% rename from Ressourcen/Rainmeter-skin/resources/game_data/img/ipad/systemUI/autofire_on.png rename to core/assets/autofire_on.png diff --git a/core/assets/continue.png b/core/assets/continue.png new file mode 100644 index 0000000000000000000000000000000000000000..cd3c275ecab1abfcb7098cb91d92e7ed4d5a2fbb Binary files /dev/null and b/core/assets/continue.png differ diff --git a/Ressourcen/Rainmeter-skin/resources/game_data/img/main_menus/continue_on.png b/core/assets/continue_on.png similarity index 100% rename from Ressourcen/Rainmeter-skin/resources/game_data/img/main_menus/continue_on.png rename to core/assets/continue_on.png diff --git a/core/assets/desktop.ini b/core/assets/desktop.ini new file mode 100644 index 0000000000000000000000000000000000000000..227ca5f2021ac245666e8e110a2d51da2cccefa6 --- /dev/null +++ b/core/assets/desktop.ini @@ -0,0 +1,7 @@ +[LocalizedFileNames] +autofire_on.png=@autofire_on,0 +store_close_on.png=@store_close_on,0 +top_ship_on.png=@top_ship_on,0 +sell_buy_on.png=@sell_buy_on,0 +continue_on.png=@continue_on,0 +pause.png=@pause,0 diff --git a/Ressourcen/Rainmeter-skin/resources/game_data/img/optionsUI/escape_continue_on.png b/core/assets/ingame_continue.png similarity index 100% rename from Ressourcen/Rainmeter-skin/resources/game_data/img/optionsUI/escape_continue_on.png rename to core/assets/ingame_continue.png diff --git a/Ressourcen/Rainmeter-skin/resources/game_data/img/pause.png b/core/assets/pause.png similarity index 100% rename from Ressourcen/Rainmeter-skin/resources/game_data/img/pause.png rename to core/assets/pause.png diff --git a/Ressourcen/Rainmeter-skin/resources/game_data/img/upgradeUI/Equipment/tabButtons/sell_buy_on.png b/core/assets/sell_buy_on.png similarity index 100% rename from Ressourcen/Rainmeter-skin/resources/game_data/img/upgradeUI/Equipment/tabButtons/sell_buy_on.png rename to core/assets/sell_buy_on.png diff --git a/core/assets/shippick_on.png b/core/assets/shippick_on.png new file mode 100644 index 0000000000000000000000000000000000000000..b9eb655ad403cc6722cc5837d34cb1c61321f333 Binary files /dev/null and b/core/assets/shippick_on.png differ diff --git a/core/assets/startgame.png b/core/assets/startgame.png new file mode 100644 index 0000000000000000000000000000000000000000..041c7f0dd1f9044c668468c1049fae1fbb69fe61 Binary files /dev/null and b/core/assets/startgame.png differ diff --git a/Ressourcen/Rainmeter-skin/resources/game_data/img/storeUI/store_close_on.png b/core/assets/store_close_on.png similarity index 100% rename from Ressourcen/Rainmeter-skin/resources/game_data/img/storeUI/store_close_on.png rename to core/assets/store_close_on.png diff --git a/Ressourcen/Rainmeter-skin/resources/game_data/img/statusUI/top_ship_on.png b/core/assets/top_ship_on.png similarity index 100% rename from Ressourcen/Rainmeter-skin/resources/game_data/img/statusUI/top_ship_on.png rename to core/assets/top_ship_on.png diff --git a/core/assets/yes.png b/core/assets/yes.png new file mode 100644 index 0000000000000000000000000000000000000000..b6f8d7b869b6cc21219c28d595d195e9a392f1fd Binary files /dev/null and b/core/assets/yes.png differ diff --git a/core/src/com/galaxytrucker/galaxytruckerreloaded/View/Buttons/InGameButtons/AutofireButton.java b/core/src/com/galaxytrucker/galaxytruckerreloaded/View/Buttons/InGameButtons/AutofireButton.java index 9fed8d8816a738e917a0d9170abbb1ad2f4e29a7..040f21856610b3f70a04b56c228514df2b60403c 100644 --- a/core/src/com/galaxytrucker/galaxytruckerreloaded/View/Buttons/InGameButtons/AutofireButton.java +++ b/core/src/com/galaxytrucker/galaxytruckerreloaded/View/Buttons/InGameButtons/AutofireButton.java @@ -6,35 +6,24 @@ import com.badlogic.gdx.audio.Sound; import com.badlogic.gdx.graphics.OrthographicCamera; import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.graphics.g2d.SpriteBatch; +import com.badlogic.gdx.scenes.scene2d.InputEvent; +import com.badlogic.gdx.scenes.scene2d.utils.ClickListener; import com.galaxytrucker.galaxytruckerreloaded.Main; import com.galaxytrucker.galaxytruckerreloaded.Model.Weapons.Weapon; import com.galaxytrucker.galaxytruckerreloaded.View.Buttons.Button; +import com.galaxytrucker.galaxytruckerreloaded.View.Buttons.ImButton; import com.galaxytrucker.galaxytruckerreloaded.View.UI.Ship.ShipView; /** * Button to activate Autofire-Function during fights */ -public class AutofireButton extends Button +public class AutofireButton extends ImButton { - /** - * Sprite batch - */ - private SpriteBatch batch; - /** - * Orthographic camera - */ - private OrthographicCamera camera; - /** - * Background - */ - private Texture background; /** * Click sound effect */ private Sound clickSound; - boolean down = false; - /** * the ui this button is on */ @@ -43,27 +32,21 @@ public class AutofireButton extends Button /** * Constructor * - * @param main - main class * @param ui the ui this button is on */ - public AutofireButton(Main main, ShipView ui) { - -// /** -// * Send data to server -// */ -// private void sendData(Packet data) { -// } -// -// /** -// * Receive data from server -// */ -// private Packet receiveData() { -// return null; + public AutofireButton(float x, float y, float width, float height, ShipView ui) { + super(new Texture("autofire_on.png"), x, y, width, height); + this.ui = ui; + this.addListener(new ClickListener() { + public void clicked(InputEvent event, float x, float y) { + leftClick(); + } + }); } public void leftClick() { - down = !down; + ui.autofire(); } diff --git a/core/src/com/galaxytrucker/galaxytruckerreloaded/View/Buttons/InGameButtons/ContinueButton.java b/core/src/com/galaxytrucker/galaxytruckerreloaded/View/Buttons/InGameButtons/ContinueButton.java index 9cd99f2b65079657c5b852ecd87c4cea0a10702a..925711fc79b38c91bbeafa29cf8b65a9b851c7db 100644 --- a/core/src/com/galaxytrucker/galaxytruckerreloaded/View/Buttons/InGameButtons/ContinueButton.java +++ b/core/src/com/galaxytrucker/galaxytruckerreloaded/View/Buttons/InGameButtons/ContinueButton.java @@ -4,34 +4,24 @@ import com.badlogic.gdx.audio.Sound; import com.badlogic.gdx.graphics.OrthographicCamera; import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.graphics.g2d.SpriteBatch; +import com.badlogic.gdx.scenes.scene2d.InputEvent; +import com.badlogic.gdx.scenes.scene2d.ui.ImageButton; +import com.badlogic.gdx.scenes.scene2d.utils.ClickListener; import com.galaxytrucker.galaxytruckerreloaded.Main; import com.galaxytrucker.galaxytruckerreloaded.View.Buttons.Button; +import com.galaxytrucker.galaxytruckerreloaded.View.Buttons.ImButton; import com.galaxytrucker.galaxytruckerreloaded.View.UI.Options.OptionsUI; /** * continue button for ingame options */ -public class ContinueButton extends Button { +public class ContinueButton extends ImButton { - /** - * Sprite batch - */ - private SpriteBatch batch; - /** - * Orthographic camera - */ - private OrthographicCamera camera; - /** - * Background - */ - private Texture background; /** * Click sound effect */ private Sound clickSound; - boolean down = false; - /** * the options ui this button is on */ @@ -40,17 +30,20 @@ public class ContinueButton extends Button { /** * Left-Click action of the Button. */ - @Override public void leftClick() { - } /** * constructor - * @param main the main class * @param ui the ui this is on */ - public ContinueButton(Main main, OptionsUI ui) { - + public ContinueButton(float x, float y, float width, float height, OptionsUI ui) { + super(new Texture("ingame_continue.png"), x, y, width, height); + this.ui = ui; + this.addListener(new ClickListener() { + public void clicked(InputEvent event, float x, float y) { + leftClick(); + } + }); } } diff --git a/core/src/com/galaxytrucker/galaxytruckerreloaded/View/Buttons/InGameButtons/CrewDismissButton.java b/core/src/com/galaxytrucker/galaxytruckerreloaded/View/Buttons/InGameButtons/CrewDismissButton.java index a139d6e0b1fd29f5f967f1ae910951adb5f88b83..bc4e95cc3fc47e19eb9a2053e360ce8200400a60 100644 --- a/core/src/com/galaxytrucker/galaxytruckerreloaded/View/Buttons/InGameButtons/CrewDismissButton.java +++ b/core/src/com/galaxytrucker/galaxytruckerreloaded/View/Buttons/InGameButtons/CrewDismissButton.java @@ -4,24 +4,18 @@ import com.badlogic.gdx.audio.Sound; import com.badlogic.gdx.graphics.OrthographicCamera; import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.graphics.g2d.SpriteBatch; +import com.badlogic.gdx.scenes.scene2d.InputEvent; +import com.badlogic.gdx.scenes.scene2d.utils.ClickListener; import com.galaxytrucker.galaxytruckerreloaded.Main; import com.galaxytrucker.galaxytruckerreloaded.Model.Crew.Crew; import com.galaxytrucker.galaxytruckerreloaded.View.Buttons.Button; +import com.galaxytrucker.galaxytruckerreloaded.View.Buttons.ImButton; /** * Button for dismissing a Crew Member */ -public class CrewDismissButton extends Button +public class CrewDismissButton extends ImButton { - - /** - * Sprite batch - */ - private SpriteBatch batch; - /** - * Orthographic camera - */ - private OrthographicCamera camera; /** * Background */ @@ -36,10 +30,16 @@ public class CrewDismissButton extends Button /** * Constructor * - * @param main - main class * @param crew the crew member */ - public CrewDismissButton(Main main, int crew) { + public CrewDismissButton(Texture texture, float x, float y, float width, float height, int crew) { + super(texture, x, y, width, height); + this.crewID = crew; + this.addListener(new ClickListener() { + public void clicked(InputEvent event, float x, float y) { + leftClick(); + } + }); } public void leftClick() diff --git a/core/src/com/galaxytrucker/galaxytruckerreloaded/View/Buttons/InGameButtons/EventPageButton.java b/core/src/com/galaxytrucker/galaxytruckerreloaded/View/Buttons/InGameButtons/EventPageButton.java index 26b091b1455ff05f553dec22aad5ac170bc95f64..d80e0379a48dce58635945aa3d6734fa0be2b239 100644 --- a/core/src/com/galaxytrucker/galaxytruckerreloaded/View/Buttons/InGameButtons/EventPageButton.java +++ b/core/src/com/galaxytrucker/galaxytruckerreloaded/View/Buttons/InGameButtons/EventPageButton.java @@ -4,31 +4,20 @@ import com.badlogic.gdx.audio.Sound; import com.badlogic.gdx.graphics.OrthographicCamera; import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.graphics.g2d.SpriteBatch; +import com.badlogic.gdx.scenes.scene2d.InputEvent; +import com.badlogic.gdx.scenes.scene2d.utils.ClickListener; import com.galaxytrucker.galaxytruckerreloaded.Main; import com.galaxytrucker.galaxytruckerreloaded.View.Buttons.Button; +import com.galaxytrucker.galaxytruckerreloaded.View.Buttons.ImButton; import com.galaxytrucker.galaxytruckerreloaded.View.UI.Events.EventGUI; -public class EventPageButton extends Button { +public class EventPageButton extends ImButton { - /** - * Sprite batch - */ - private SpriteBatch batch; - /** - * Orthographic camera - */ - private OrthographicCamera camera; - /** - * Background - */ - private Texture background; /** * Click sound effect */ private Sound clickSound; - boolean down = false; - /** * the ui the button is on */ @@ -37,16 +26,23 @@ public class EventPageButton extends Button { /** * what happens when there is a left click on the button */ - public void leftClick() {down=!down;} + public void leftClick() { + eventgui.nextPage(); + } /** * constructor * - * @param main the main class - * * @param eventgui the ui the button is on */ - public EventPageButton(Main main, EventGUI eventgui) { + public EventPageButton(float x, float y, float width, float height, EventGUI eventgui) { + super(new Texture("continue_on.png"), x, y, width, height); + this.eventgui = eventgui; + this.addListener(new ClickListener() { + public void clicked(InputEvent event, float x, float y) { + leftClick(); + } + }); } } diff --git a/core/src/com/galaxytrucker/galaxytruckerreloaded/View/Buttons/InGameButtons/InventoryCloseButton.java b/core/src/com/galaxytrucker/galaxytruckerreloaded/View/Buttons/InGameButtons/InventoryCloseButton.java index 060093f947eff44c7799ab44c7dbc4150547fdaa..5b05dd5e0925b5bdedbf370c917b1ec5efb006ed 100644 --- a/core/src/com/galaxytrucker/galaxytruckerreloaded/View/Buttons/InGameButtons/InventoryCloseButton.java +++ b/core/src/com/galaxytrucker/galaxytruckerreloaded/View/Buttons/InGameButtons/InventoryCloseButton.java @@ -4,35 +4,24 @@ import com.badlogic.gdx.audio.Sound; import com.badlogic.gdx.graphics.OrthographicCamera; import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.graphics.g2d.SpriteBatch; +import com.badlogic.gdx.scenes.scene2d.InputEvent; +import com.badlogic.gdx.scenes.scene2d.utils.ClickListener; import com.galaxytrucker.galaxytruckerreloaded.Main; import com.galaxytrucker.galaxytruckerreloaded.View.Buttons.Button; +import com.galaxytrucker.galaxytruckerreloaded.View.Buttons.ImButton; import com.galaxytrucker.galaxytruckerreloaded.View.UI.Events.ShopUI; import com.galaxytrucker.galaxytruckerreloaded.View.UI.Inventory.InventoryUI; /** * used to close the inventory */ -public class InventoryCloseButton extends Button { +public class InventoryCloseButton extends ImButton { - /** - * Sprite batch - */ - private SpriteBatch batch; - /** - * Orthographic camera - */ - private OrthographicCamera camera; - /** - * Background - */ - private Texture background; /** * Click sound effect */ private Sound clickSound; - boolean down = false; - /** * shop ui, if button on shop * otherwise null @@ -50,16 +39,27 @@ public class InventoryCloseButton extends Button { */ @Override public void leftClick() { + if(shop != null) { + } + else if(inventory != null) { + + } } /** * constructor - * @param main the main class * @param ui the shop ui this is on, or null * @param inventory the inventory ui this is on, or null */ - public InventoryCloseButton(Main main, ShopUI ui, InventoryUI inventory) { - + public InventoryCloseButton(float x, float y, float width, float height, ShopUI ui, InventoryUI inventory) { + super(new Texture("close_on.png"), x, y, width, height); + shop = ui; + this.inventory = inventory; + this.addListener(new ClickListener() { + public void clicked(InputEvent event, float x, float y) { + leftClick(); + } + }); } } 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 862c0eec5fa736ce06135f39d9c806c5de81e564..7114d6f9df596bfa7d38f0952149d75f79b87f5f 100644 --- a/core/src/com/galaxytrucker/galaxytruckerreloaded/View/Buttons/InGameButtons/MainMenuButton.java +++ b/core/src/com/galaxytrucker/galaxytruckerreloaded/View/Buttons/InGameButtons/MainMenuButton.java @@ -4,35 +4,22 @@ import com.badlogic.gdx.audio.Sound; import com.badlogic.gdx.graphics.OrthographicCamera; import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.graphics.g2d.SpriteBatch; +import com.badlogic.gdx.scenes.scene2d.InputEvent; +import com.badlogic.gdx.scenes.scene2d.utils.ClickListener; import com.galaxytrucker.galaxytruckerreloaded.Main; import com.galaxytrucker.galaxytruckerreloaded.View.Buttons.Button; +import com.galaxytrucker.galaxytruckerreloaded.View.Buttons.ImButton; import com.galaxytrucker.galaxytruckerreloaded.View.UI.Events.GameOver; /*** * button used to return to the main menu */ -public class MainMenuButton extends Button { - - /** - * Sprite batch - */ - private SpriteBatch batch; - /** - * Orthographic camera - */ - private OrthographicCamera camera; - /** - * Background - */ - private Texture background; +public class MainMenuButton extends ImButton { /** * Click sound effect */ private Sound clickSound; - boolean down = false; - - /** * Left-Click action of the Button. opens the main menu screen */ @@ -43,9 +30,13 @@ public class MainMenuButton extends Button { /** * constructor - * @param main the main class */ - public MainMenuButton(Main main) { - + public MainMenuButton(float x, float y, float width, float height) { + super(new Texture("sd"), x, y, width, height); + this.addListener(new ClickListener() { + public void clicked(InputEvent event, float x, float y) { + leftClick(); + } + }); } } diff --git a/core/src/com/galaxytrucker/galaxytruckerreloaded/View/Buttons/InGameButtons/MoveButton.java b/core/src/com/galaxytrucker/galaxytruckerreloaded/View/Buttons/InGameButtons/MoveButton.java index 3b62e99ea33aa219378a9a2a7094fabdd58be03d..6ced27fb5e84bfea3f11eff55e5faddf97cf5542 100644 --- a/core/src/com/galaxytrucker/galaxytruckerreloaded/View/Buttons/InGameButtons/MoveButton.java +++ b/core/src/com/galaxytrucker/galaxytruckerreloaded/View/Buttons/InGameButtons/MoveButton.java @@ -4,34 +4,23 @@ import com.badlogic.gdx.audio.Sound; import com.badlogic.gdx.graphics.OrthographicCamera; import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.graphics.g2d.SpriteBatch; +import com.badlogic.gdx.scenes.scene2d.InputEvent; +import com.badlogic.gdx.scenes.scene2d.utils.ClickListener; import com.galaxytrucker.galaxytruckerreloaded.Main; import com.galaxytrucker.galaxytruckerreloaded.View.Buttons.Button; +import com.galaxytrucker.galaxytruckerreloaded.View.Buttons.ImButton; import com.galaxytrucker.galaxytruckerreloaded.View.UI.Ship.ShipView; /** * button used to move the ship. upper middle corner, opens the map */ -public class MoveButton extends Button { +public class MoveButton extends ImButton { - /** - * Sprite batch - */ - private SpriteBatch batch; - /** - * Orthographic camera - */ - private OrthographicCamera camera; - /** - * Background - */ - private Texture background; /** * Click sound effect */ private Sound clickSound; - boolean down = false; - /** * the ui this button is on */ @@ -47,10 +36,15 @@ public class MoveButton extends Button { /** * constructor - * @param main the main class * @param ui the ui this button is on */ - public MoveButton(Main main, ShipView ui) { - + public MoveButton(float x, float y, float width, float height, ShipView ui) { + super(new Texture("FTL_JUMP.png"), x, y, width, height); + this.ui = ui; + this.addListener(new ClickListener() { + public void clicked(InputEvent event, float x, float y) { + leftClick(); + } + }); } } diff --git a/core/src/com/galaxytrucker/galaxytruckerreloaded/View/Buttons/InGameButtons/ShipButton.java b/core/src/com/galaxytrucker/galaxytruckerreloaded/View/Buttons/InGameButtons/ShipButton.java index eb6cc83ea6f722c4e9938738dec79fd407fe9260..6f0eeaa5606680ba1d6bece5df5641a34e9a160e 100644 --- a/core/src/com/galaxytrucker/galaxytruckerreloaded/View/Buttons/InGameButtons/ShipButton.java +++ b/core/src/com/galaxytrucker/galaxytruckerreloaded/View/Buttons/InGameButtons/ShipButton.java @@ -4,28 +4,19 @@ import com.badlogic.gdx.audio.Sound; import com.badlogic.gdx.graphics.OrthographicCamera; import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.graphics.g2d.SpriteBatch; +import com.badlogic.gdx.scenes.scene2d.InputEvent; +import com.badlogic.gdx.scenes.scene2d.utils.ClickListener; import com.galaxytrucker.galaxytruckerreloaded.Main; import com.galaxytrucker.galaxytruckerreloaded.Model.Ship; import com.galaxytrucker.galaxytruckerreloaded.View.Buttons.Button; +import com.galaxytrucker.galaxytruckerreloaded.View.Buttons.ImButton; import com.galaxytrucker.galaxytruckerreloaded.View.UI.Ship.ShipView; /** * Button for opening the Ship-Interface * */ -public class ShipButton extends Button +public class ShipButton extends ImButton { - /** - * Sprite batch - */ - private SpriteBatch batch; - /** - * Orthographic camera - */ - private OrthographicCamera camera; - /** - * Background - */ - private Texture background; /** * Click sound effect */ @@ -39,10 +30,16 @@ public class ShipButton extends Button /** * Constructor * - * @param main - main class * @param ui the ui this button is on */ - public ShipButton(Main main, ShipView ui) { + public ShipButton(float x, float y, float width, float height, ShipView ui) { + super(new Texture("top_ship_on.png"), x, y, width, height); + this.ui = ui; + this.addListener(new ClickListener() { + public void clicked(InputEvent event, float x, float y) { + leftClick(); + } + }); } diff --git a/core/src/com/galaxytrucker/galaxytruckerreloaded/View/Buttons/InGameButtons/ShopBuyButton.java b/core/src/com/galaxytrucker/galaxytruckerreloaded/View/Buttons/InGameButtons/ShopBuyButton.java index 93f732b35f2ae7a45e86c9271555f4af67322a7c..e0fed47c47ed1bf3e102a7a3293ffb1dcd61a8be 100644 --- a/core/src/com/galaxytrucker/galaxytruckerreloaded/View/Buttons/InGameButtons/ShopBuyButton.java +++ b/core/src/com/galaxytrucker/galaxytruckerreloaded/View/Buttons/InGameButtons/ShopBuyButton.java @@ -4,34 +4,23 @@ import com.badlogic.gdx.audio.Sound; import com.badlogic.gdx.graphics.OrthographicCamera; import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.graphics.g2d.SpriteBatch; +import com.badlogic.gdx.scenes.scene2d.InputEvent; +import com.badlogic.gdx.scenes.scene2d.utils.ClickListener; import com.galaxytrucker.galaxytruckerreloaded.Main; import com.galaxytrucker.galaxytruckerreloaded.View.Buttons.Button; +import com.galaxytrucker.galaxytruckerreloaded.View.Buttons.ImButton; import com.galaxytrucker.galaxytruckerreloaded.View.UI.Events.ShopUI; /** * button used to buy something in the shop */ -public class ShopBuyButton extends Button { +public class ShopBuyButton extends ImButton { - /** - * Sprite batch - */ - private SpriteBatch batch; - /** - * Orthographic camera - */ - private OrthographicCamera camera; - /** - * Background - */ - private Texture background; /** * Click sound effect */ private Sound clickSound; - boolean down = false; - /** * the item this button belongs to * index of list in shopui @@ -46,16 +35,22 @@ public class ShopBuyButton extends Button { /** * Constructor * - * @param main - main class * @param item the item * @param ui the ui this button is on */ - public ShopBuyButton(Main main, int item, ShopUI ui) { - + public ShopBuyButton(float x, float y, float width, float height, int item, ShopUI ui) { + super(new Texture("sell_buy_on.png"), x, y, width, height); + this.item = item; + shop = ui; + this.addListener(new ClickListener() { + public void clicked(InputEvent event, float x, float y) { + leftClick(); + } + }); } public void leftClick() { - down = !down; + shop.buy(item); } } diff --git a/core/src/com/galaxytrucker/galaxytruckerreloaded/View/Buttons/InGameButtons/SystemButton.java b/core/src/com/galaxytrucker/galaxytruckerreloaded/View/Buttons/InGameButtons/SystemButton.java index 51029a3b41648cfaeac84d2933c26013a566e55c..5632b25b902f0f3a44e4d2a15f2893f4d6c9d162 100644 --- a/core/src/com/galaxytrucker/galaxytruckerreloaded/View/Buttons/InGameButtons/SystemButton.java +++ b/core/src/com/galaxytrucker/galaxytruckerreloaded/View/Buttons/InGameButtons/SystemButton.java @@ -1,41 +1,28 @@ package com.galaxytrucker.galaxytruckerreloaded.View.Buttons.InGameButtons; import com.badlogic.gdx.Gdx; +import com.badlogic.gdx.Input; import com.badlogic.gdx.audio.Sound; import com.badlogic.gdx.graphics.OrthographicCamera; import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.graphics.g2d.SpriteBatch; +import com.badlogic.gdx.scenes.scene2d.InputEvent; +import com.badlogic.gdx.scenes.scene2d.utils.ClickListener; import com.galaxytrucker.galaxytruckerreloaded.Main; import com.galaxytrucker.galaxytruckerreloaded.View.Buttons.Button; +import com.galaxytrucker.galaxytruckerreloaded.View.Buttons.ImButton; import com.galaxytrucker.galaxytruckerreloaded.View.UI.ShipInformation.SubsystemUI; /** * Button for regulation of (Sub)-System energie supplyment */ -public class SystemButton extends Button +public class SystemButton extends ImButton { - /** - * Sprite batch - */ - private SpriteBatch batch; - /** - * Orthographic camera - */ - private OrthographicCamera camera; - /** - * Background - */ - private Texture background; /** * Click sound effect */ private Sound clickSound; - private Texture image_off; - private Texture image_hover_off; - - Texture glow; - /** * the ui this button belongs to */ @@ -44,21 +31,21 @@ public class SystemButton extends Button /** * Constructor * - * @param main - main class * @param ui the ui this button belongs to */ - public SystemButton(Main main, SubsystemUI ui) { - } - - public void setGlowTexture(Texture glow) - { - this.glow = glow; - } - - public void setOffTextures(Texture image_off, Texture image_hover_off) - { - this.image_off = image_off; - this.image_hover_off = image_hover_off; + public SystemButton(Texture texture, float x, float y, float width, float height, SubsystemUI ui) { + super(texture, x, y, width, height); + this.ui = ui; + this.addListener(new ClickListener() { + public void clicked(InputEvent event, float x, float y) { + if(event.getButton() == Input.Buttons.RIGHT) { + rightClick(); + } + else if(event.getButton() == Input.Buttons.LEFT) { + leftClick(); + } + } + }); } @@ -67,82 +54,13 @@ public class SystemButton extends Button */ public void rightClick() { -// int power = -1; -// if(system instanceof ShieldSystem) -// power = -2; -// -// if(system instanceof WeaponSystem) -// { -// WeaponSystem weaponSystem = (WeaponSystem)system; -// for(int i = 3; i >= 0; i--) -// { -// if(weaponSystem.getWeapon(i) != null && weaponSystem.getWeapon(i).isPowered()) -// { -// int prevPower = system.getPower(); -// weaponSystem.powerDownWeapon(i); -// if(prevPower != system.getPower()) -// { -// Sounds.playSound("buttonOff"); -// } -// break; -// } -// } -// } -// else -// { -// int prevPower = system.getPower(); -// system.addPower(power); -// if(prevPower != system.getPower()) -// { -// Sounds.playSound("buttonOff"); -// } -// } + } /** * increases the Energie provided for a System */ - @Override - public void leftClick(){ -// { -// int power = 1; -// if(system instanceof ShieldSystem) -// power = 2; -// -// if(system instanceof WeaponSystem) -// { -// WeaponSystem weaponSystem = (WeaponSystem)system; -// for(int i = 0; i < 4; i++) -// { -// if(!weaponSystem.getWeapon(i).isPowered()) -// { -// int prevPower = system.getPower(); -// weaponSystem.powerOnWeapon(i); -// if(prevPower != system.getPower()) -// { -// Sounds.playSound("buttonOn"); -// } -// else -// { -// Sounds.playSound("buttonFail"); -// } -// break; -// } -// } -// } -// else -// { -// int prevPower = system.getPower(); -// system.addPower(power); -// if(prevPower != system.getPower()) -// { -// Sounds.playSound("buttonOn"); -// } -// else -// { -// Sounds.playSound("buttonFail"); -// } -// } -// } -} + public void leftClick() { + + } } diff --git a/core/src/com/galaxytrucker/galaxytruckerreloaded/View/Buttons/InGameButtons/WeaponActivateButton.java b/core/src/com/galaxytrucker/galaxytruckerreloaded/View/Buttons/InGameButtons/WeaponActivateButton.java index 40ea4db5ccaa974341a0e36f78875825998454e5..4ca9745be2f7f12ec8917f990a1b9101ab663923 100644 --- a/core/src/com/galaxytrucker/galaxytruckerreloaded/View/Buttons/InGameButtons/WeaponActivateButton.java +++ b/core/src/com/galaxytrucker/galaxytruckerreloaded/View/Buttons/InGameButtons/WeaponActivateButton.java @@ -6,6 +6,7 @@ import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.graphics.g2d.SpriteBatch; import com.galaxytrucker.galaxytruckerreloaded.Main; import com.galaxytrucker.galaxytruckerreloaded.View.Buttons.Button; +import com.galaxytrucker.galaxytruckerreloaded.View.Buttons.ImButton; import com.galaxytrucker.galaxytruckerreloaded.View.UI.ShipInformation.WeaponUI; import java.io.BufferedWriter; @@ -13,27 +14,13 @@ import java.io.BufferedWriter; /** * button used to activate/deactivate weapon */ -public class WeaponActivateButton extends Button { +public class WeaponActivateButton extends ImButton { - /** - * Sprite batch - */ - private SpriteBatch batch; - /** - * Orthographic camera - */ - private OrthographicCamera camera; - /** - * Background - */ - private Texture background; /** * Click sound effect */ private Sound clickSound; - boolean down = false; - /** * the ui this button belongs to */ @@ -49,10 +36,10 @@ public class WeaponActivateButton extends Button { /** * constructor - * @param main the main class * @param ui the ui this button belongs to */ - public WeaponActivateButton(Main main, WeaponUI ui) { - + public WeaponActivateButton(Texture texture, float x, float y, float width, float height, WeaponUI ui) { + super(texture, x, y, width, height); + this.ui = ui; } } diff --git a/core/src/com/galaxytrucker/galaxytruckerreloaded/View/Buttons/MenuButtons/DifficultyButton.java b/core/src/com/galaxytrucker/galaxytruckerreloaded/View/Buttons/MenuButtons/DifficultyButton.java index c1d9672a1a95f091384737d156b201a470dcc550..b40733ba94e99001961fe0d7d4b7c48e486b17dd 100644 --- a/core/src/com/galaxytrucker/galaxytruckerreloaded/View/Buttons/MenuButtons/DifficultyButton.java +++ b/core/src/com/galaxytrucker/galaxytruckerreloaded/View/Buttons/MenuButtons/DifficultyButton.java @@ -4,32 +4,26 @@ import com.badlogic.gdx.audio.Sound; import com.badlogic.gdx.graphics.OrthographicCamera; import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.graphics.g2d.SpriteBatch; +import com.badlogic.gdx.scenes.scene2d.InputEvent; +import com.badlogic.gdx.scenes.scene2d.utils.ClickListener; import com.galaxytrucker.galaxytruckerreloaded.Main; import com.galaxytrucker.galaxytruckerreloaded.View.Buttons.Button; +import com.galaxytrucker.galaxytruckerreloaded.View.Buttons.ImButton; import com.galaxytrucker.galaxytruckerreloaded.View.Screen.ShipSelector; /** * Button for setting the degree of diffiulty */ -public class DifficultyButton extends Button +public class DifficultyButton extends ImButton { - /** - * Sprite batch - */ - private SpriteBatch batch; - /** - * Orthographic camera - */ - private OrthographicCamera camera; - /** - * Background - */ - private Texture background; /** * Click sound effect */ private Sound clickSound; + /** + * the difficulty + */ private int difficulty; /** @@ -40,11 +34,17 @@ public class DifficultyButton extends Button /** * Constructor * - * @param main - main class - * @param difficulty the difficulty this button represents * @param screen the screen this button is on */ - public DifficultyButton(Main main, int difficulty, ShipSelector screen) { + public DifficultyButton(float x, float y, float width, float height, ShipSelector screen, int difficulty) { + super(new Texture("yes.png"), x, y, width, height); + this.screen = screen; + this.difficulty = difficulty; + this.addListener(new ClickListener() { + public void clicked(InputEvent event, float x, float y) { + leftClick(); + } + }); } /** @@ -53,7 +53,7 @@ public class DifficultyButton extends Button @Override public void leftClick() { - // setDifficulty(difficulty); + screen.setDifficulty(difficulty); } } diff --git a/core/src/com/galaxytrucker/galaxytruckerreloaded/View/Buttons/MenuButtons/LoginButton.java b/core/src/com/galaxytrucker/galaxytruckerreloaded/View/Buttons/MenuButtons/LoginButton.java index b577b59bd156879b9120b0d2cac15fa476ab03fa..0679459c4304b0d8cc754b145e94df21e9e33052 100644 --- a/core/src/com/galaxytrucker/galaxytruckerreloaded/View/Buttons/MenuButtons/LoginButton.java +++ b/core/src/com/galaxytrucker/galaxytruckerreloaded/View/Buttons/MenuButtons/LoginButton.java @@ -4,27 +4,18 @@ import com.badlogic.gdx.audio.Sound; import com.badlogic.gdx.graphics.OrthographicCamera; import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.graphics.g2d.SpriteBatch; +import com.badlogic.gdx.scenes.scene2d.InputEvent; +import com.badlogic.gdx.scenes.scene2d.utils.ClickListener; import com.galaxytrucker.galaxytruckerreloaded.Main; import com.galaxytrucker.galaxytruckerreloaded.View.Buttons.Button; +import com.galaxytrucker.galaxytruckerreloaded.View.Buttons.ImButton; import com.galaxytrucker.galaxytruckerreloaded.View.Screen.LoginScreen; /** * the login button for the login screen */ -public class LoginButton extends Button { +public class LoginButton extends ImButton { - /** - * Sprite batch - */ - private SpriteBatch batch; - /** - * Orthographic camera - */ - private OrthographicCamera camera; - /** - * Background - */ - private Texture background; /** * Click sound effect */ @@ -41,15 +32,20 @@ public class LoginButton extends Button { */ @Override public void leftClick() { - + screen.login(); } /** * the constructor - * @param main the main class * @param screen the login screen this button belongs to */ - public LoginButton(Main main, LoginScreen screen) { - + public LoginButton(float x, float y, float width, float height, LoginScreen screen) { + super(new Texture("yes.png"), x, y, width, height); + this.screen = screen; + this.addListener(new ClickListener() { + public void clicked(InputEvent event, float x, float y) { + leftClick(); + } + }); } } diff --git a/core/src/com/galaxytrucker/galaxytruckerreloaded/View/Buttons/MenuButtons/ShipSelectButton.java b/core/src/com/galaxytrucker/galaxytruckerreloaded/View/Buttons/MenuButtons/ShipSelectButton.java index 8f8916bdfa98057d11582e0248ed47ea29cd83e0..f130674403963489af33795a2efdb225c1fcb6cf 100644 --- a/core/src/com/galaxytrucker/galaxytruckerreloaded/View/Buttons/MenuButtons/ShipSelectButton.java +++ b/core/src/com/galaxytrucker/galaxytruckerreloaded/View/Buttons/MenuButtons/ShipSelectButton.java @@ -4,27 +4,18 @@ import com.badlogic.gdx.audio.Sound; import com.badlogic.gdx.graphics.OrthographicCamera; import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.graphics.g2d.SpriteBatch; +import com.badlogic.gdx.scenes.scene2d.InputEvent; +import com.badlogic.gdx.scenes.scene2d.utils.ClickListener; import com.galaxytrucker.galaxytruckerreloaded.Main; import com.galaxytrucker.galaxytruckerreloaded.View.Buttons.Button; +import com.galaxytrucker.galaxytruckerreloaded.View.Buttons.ImButton; import com.galaxytrucker.galaxytruckerreloaded.View.Screen.ShipSelector; /** * the button representing one ship in the ship selector */ -public class ShipSelectButton extends Button { +public class ShipSelectButton extends ImButton { - /** - * Sprite batch - */ - private SpriteBatch batch; - /** - * Orthographic camera - */ - private OrthographicCamera camera; - /** - * Background - */ - private Texture background; /** * Click sound effect */ @@ -45,16 +36,22 @@ public class ShipSelectButton extends Button { */ @Override public void leftClick() { - + screen.setShip(ship); } /** * constructor - * @param main the main class * @param ship the ship, (index of ship in list in shipselector) * @param screen the screen this button is on */ - public ShipSelectButton(Main main, int ship, ShipSelector screen) { - + public ShipSelectButton(float x, float y, float width, float height, int ship, ShipSelector screen) { + super(new Texture("yes.png"), x, y, width, height); + this.screen = screen; + this.ship = ship; + this.addListener(new ClickListener() { + public void clicked(InputEvent event, float x, float y) { + leftClick(); + } + }); } } diff --git a/core/src/com/galaxytrucker/galaxytruckerreloaded/View/Buttons/MenuButtons/SinglePlayerButton.java b/core/src/com/galaxytrucker/galaxytruckerreloaded/View/Buttons/MenuButtons/SinglePlayerButton.java index 074080462523542726b6d1962d675c6ce058abc1..a7b06f37b4bbc0b53122a097a3da3cc1de91caf9 100644 --- a/core/src/com/galaxytrucker/galaxytruckerreloaded/View/Buttons/MenuButtons/SinglePlayerButton.java +++ b/core/src/com/galaxytrucker/galaxytruckerreloaded/View/Buttons/MenuButtons/SinglePlayerButton.java @@ -4,27 +4,17 @@ import com.badlogic.gdx.audio.Sound; import com.badlogic.gdx.graphics.OrthographicCamera; import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.graphics.g2d.SpriteBatch; +import com.badlogic.gdx.scenes.scene2d.InputEvent; +import com.badlogic.gdx.scenes.scene2d.utils.ClickListener; import com.galaxytrucker.galaxytruckerreloaded.Main; import com.galaxytrucker.galaxytruckerreloaded.View.Buttons.Button; +import com.galaxytrucker.galaxytruckerreloaded.View.Buttons.ImButton; import com.galaxytrucker.galaxytruckerreloaded.View.Screen.ShipSelector; /** * button to choose single player in the ship selector */ -public class SinglePlayerButton extends Button { - - /** - * Sprite batch - */ - private SpriteBatch batch; - /** - * Orthographic camera - */ - private OrthographicCamera camera; - /** - * Background - */ - private Texture background; +public class SinglePlayerButton extends ImButton { /** * Click sound effect */ @@ -45,16 +35,22 @@ public class SinglePlayerButton extends Button { */ @Override public void leftClick() { - + singlePlayer = !singlePlayer; + screen.setSinglePlayer(singlePlayer); } /** * constructor * * @param screen the screen this button is on - * @param main the main class */ - public SinglePlayerButton(Main main, ShipSelector screen) { - + public SinglePlayerButton(float x, float y, float width, float height, ShipSelector screen) { + super(new Texture("yes.png"), x, y, width, height); + this.screen = screen; + this.addListener(new ClickListener() { + public void clicked(InputEvent event, float x, float y) { + leftClick(); + } + }); } } diff --git a/core/src/com/galaxytrucker/galaxytruckerreloaded/View/Buttons/MenuButtons/StartButton.java b/core/src/com/galaxytrucker/galaxytruckerreloaded/View/Buttons/MenuButtons/StartButton.java index eb9e3328a43c69c04695bfec224b86f182da49f8..a20dbb8a626d634cf85f8ccdb05b7b462e1973ff 100644 --- a/core/src/com/galaxytrucker/galaxytruckerreloaded/View/Buttons/MenuButtons/StartButton.java +++ b/core/src/com/galaxytrucker/galaxytruckerreloaded/View/Buttons/MenuButtons/StartButton.java @@ -1,30 +1,22 @@ package com.galaxytrucker.galaxytruckerreloaded.View.Buttons.MenuButtons; +import com.badlogic.gdx.Screen; import com.badlogic.gdx.audio.Sound; import com.badlogic.gdx.graphics.OrthographicCamera; import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.graphics.g2d.SpriteBatch; +import com.badlogic.gdx.scenes.scene2d.InputEvent; +import com.badlogic.gdx.scenes.scene2d.utils.ClickListener; import com.galaxytrucker.galaxytruckerreloaded.Main; import com.galaxytrucker.galaxytruckerreloaded.View.Buttons.Button; +import com.galaxytrucker.galaxytruckerreloaded.View.Buttons.ImButton; import com.galaxytrucker.galaxytruckerreloaded.View.Screen.MainMenu; /** * Starts a new Game */ -public class StartButton extends Button +public class StartButton extends ImButton { - /** - * Sprite batch - */ - private SpriteBatch batch; - /** - * Orthographic camera - */ - private OrthographicCamera camera; - /** - * Background - */ - private Texture background; /** * Click sound effect */ @@ -35,35 +27,26 @@ public class StartButton extends Button */ private MainMenu screen; - /** * Constructor * - * @param main - main class * @param screen the screen this button is on */ - public StartButton(Main main, MainMenu screen) { + public StartButton(float x, float y, float width, float height, MainMenu screen) { + super(new Texture("continue.png"), x, y, width, height); + this.screen = screen; + this.addListener(new ClickListener() { + public void clicked(InputEvent event, float x, float y) { + leftClick(); + } + }); } -// /** -// * Send data to server -// */ -// private void sendData(Packet data) { -// } -// -// /** -// * Receive data from server -// */ -// private Packet receiveData() { -// return null; -// } - /** * Creates s a new Instance of PLayer an an new Ship */ public void leftClick() { - // FTLGame.instance().setPlayer(hanger.getShip()); - // FTLView.instance().setScreen(new SpaceScreen()); + screen.resumeGame(); } } \ No newline at end of file diff --git a/core/src/com/galaxytrucker/galaxytruckerreloaded/View/Screen/GamePlay.java b/core/src/com/galaxytrucker/galaxytruckerreloaded/View/Screen/GamePlay.java index 2b6bc82049a9e714811e1373cd20e6c848c2a9c7..77149d5ed036a40fc7c7e5067606d7717171454b 100644 --- a/core/src/com/galaxytrucker/galaxytruckerreloaded/View/Screen/GamePlay.java +++ b/core/src/com/galaxytrucker/galaxytruckerreloaded/View/Screen/GamePlay.java @@ -1,8 +1,10 @@ package com.galaxytrucker.galaxytruckerreloaded.View.Screen; +import com.badlogic.gdx.Gdx; 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.OrthographicCamera; import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.graphics.g2d.SpriteBatch; @@ -17,16 +19,6 @@ import com.galaxytrucker.galaxytruckerreloaded.View.UI.Ship.ShipView; */ public class GamePlay implements Screen { - /** - * SpriteBatch - */ - private SpriteBatch batch; - - /** - * Orthographic camera - */ - private OrthographicCamera camera; - /** * Background texture */ @@ -43,9 +35,9 @@ public class GamePlay implements Screen { private Sound clickSound; /** - * MultiPlayer active + * single Player active */ - private boolean multiPlayer; + private boolean singlePlayer; /** * Current map @@ -57,6 +49,20 @@ public class GamePlay implements Screen { */ private ShipView player; + private Main main; + + /** + * Constructor + * + * @param main - main class + */ + public GamePlay(Main main) { + this.main = main; + background = new Texture("1080p.png"); + + player = new ShipView(main, null); //TODO wie schiff aus controller? + } + @Override public void show() { @@ -65,7 +71,11 @@ public class GamePlay implements Screen { @Override public void render(float delta) { - + Gdx.gl.glClearColor(1, 1, 1, 1); + Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); + main.batch.begin(); + main.batch.draw(background, 0, 0, main.WIDTH, main.HEIGHT); + main.batch.end(); } @Override @@ -90,7 +100,7 @@ public class GamePlay implements Screen { @Override public void dispose() { - + background.dispose(); } /** @@ -102,24 +112,4 @@ public class GamePlay implements Screen { this.background = background; } - /** - * Constructor - * - * @param main - main class - */ - public GamePlay(Main main) { - } - -// /** -// * Send data to server -// */ -// private void sendData(Packet data) { -// } -// -// /** -// * Receive data from server -// */ -// private Packet receiveData() { -// return null; -// } } diff --git a/core/src/com/galaxytrucker/galaxytruckerreloaded/View/Screen/LoginScreen.java b/core/src/com/galaxytrucker/galaxytruckerreloaded/View/Screen/LoginScreen.java index 1c5fac7654fd17cde62c123826d91520c3a94f16..32f9c5859317020234b3db9681220b2cdc2e918f 100644 --- a/core/src/com/galaxytrucker/galaxytruckerreloaded/View/Screen/LoginScreen.java +++ b/core/src/com/galaxytrucker/galaxytruckerreloaded/View/Screen/LoginScreen.java @@ -1,12 +1,17 @@ package com.galaxytrucker.galaxytruckerreloaded.View.Screen; +import com.badlogic.gdx.Gdx; import com.badlogic.gdx.Screen; +import com.badlogic.gdx.assets.loaders.AssetLoader; import com.badlogic.gdx.audio.Music; import com.badlogic.gdx.audio.Sound; +import com.badlogic.gdx.graphics.GL20; import com.badlogic.gdx.graphics.OrthographicCamera; import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.graphics.g2d.SpriteBatch; +import com.badlogic.gdx.scenes.scene2d.Stage; import com.badlogic.gdx.scenes.scene2d.ui.ImageButton; +import com.badlogic.gdx.scenes.scene2d.ui.Skin; import com.badlogic.gdx.scenes.scene2d.ui.TextField; import com.galaxytrucker.galaxytruckerreloaded.Main; import com.galaxytrucker.galaxytruckerreloaded.View.Buttons.MenuButtons.LoginButton; @@ -16,16 +21,6 @@ import com.galaxytrucker.galaxytruckerreloaded.View.Buttons.MenuButtons.LoginBut */ public class LoginScreen implements Screen { - /** - * SpriteBatch - */ - private SpriteBatch batch; - - /** - * Orthographic camera - */ - private OrthographicCamera camera; - /** * Background image */ @@ -51,6 +46,33 @@ public class LoginScreen implements Screen { */ private Sound clickSound; + /** + * the main game class + */ + private Main main; + + /** + * the stage + */ + private Stage stage; + + /** + * Constructor + * + * @param main - main class + */ + public LoginScreen(Main main) { + this.main = main; + background = new Texture("1080p.png"); + loginButton = new LoginButton(main.WIDTH/2, main.HEIGHT/2, 248, 50, this); + username = new TextField("", new Skin()); + + stage = new Stage(); + stage.addActor(loginButton); + + Gdx.input.setInputProcessor(stage); + } + @Override public void show() { @@ -58,7 +80,12 @@ public class LoginScreen implements Screen { @Override public void render(float delta) { - + Gdx.gl.glClearColor(1, 1, 1, 1); + Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); + main.batch.begin(); + main.batch.draw(background, 0, 0, main.WIDTH, main.HEIGHT); + main.batch.end(); + stage.draw(); } @Override @@ -83,21 +110,15 @@ public class LoginScreen implements Screen { @Override public void dispose() { - + background.dispose(); + stage.dispose(); } /** * login method, called by the button */ public void login() { - - } - - /** - * Constructor - * - * @param main - main class - */ - public LoginScreen(Main main) { + String name = username.getText(); + //TODO welcher controller?? } } diff --git a/core/src/com/galaxytrucker/galaxytruckerreloaded/View/Screen/MainMenu.java b/core/src/com/galaxytrucker/galaxytruckerreloaded/View/Screen/MainMenu.java index 9a3bd104c65e8203b8f7196f23b60d10882cf6c4..79c531e0047c12b9a101984bfc1c889a25315c3f 100644 --- a/core/src/com/galaxytrucker/galaxytruckerreloaded/View/Screen/MainMenu.java +++ b/core/src/com/galaxytrucker/galaxytruckerreloaded/View/Screen/MainMenu.java @@ -28,7 +28,7 @@ public class MainMenu implements Screen { this.main = main; background = new Texture("1080p.png"); newGame = new NewGameButton(main.WIDTH/2, main.HEIGHT/2, 248, 50, this); - quit = new QuitButton(main.WIDTH/2, main.HEIGHT/2-100, 248, 50, this); + quit = new QuitButton(main.WIDTH/2, main.HEIGHT/2 - 100, 248, 50, this); stage = new Stage(); stage.addActor(quit); @@ -107,7 +107,6 @@ public class MainMenu implements Screen { * called by button */ public void newGame() { - System.out.println("here"); main.setScreen(new ShipSelector(main)); dispose(); } diff --git a/core/src/com/galaxytrucker/galaxytruckerreloaded/View/Screen/PauseMenu.java b/core/src/com/galaxytrucker/galaxytruckerreloaded/View/Screen/PauseMenu.java index 5290086244da856b09424b5b1ef4a0b224c4160f..feb5615c27ddd404ae75bf633bb486ae1ae9d3ff 100644 --- a/core/src/com/galaxytrucker/galaxytruckerreloaded/View/Screen/PauseMenu.java +++ b/core/src/com/galaxytrucker/galaxytruckerreloaded/View/Screen/PauseMenu.java @@ -1,6 +1,8 @@ package com.galaxytrucker.galaxytruckerreloaded.View.Screen; +import com.badlogic.gdx.Gdx; import com.badlogic.gdx.Screen; +import com.badlogic.gdx.graphics.GL20; import com.badlogic.gdx.graphics.OrthographicCamera; import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.graphics.g2d.SpriteBatch; @@ -12,19 +14,22 @@ import com.galaxytrucker.galaxytruckerreloaded.Main; public class PauseMenu implements Screen { /** - * Sptire batch + * Game paused texture */ - private SpriteBatch batch; + private Texture pausedTexture; - /** - * Orthographic camera - */ - private OrthographicCamera camera; + private Main main; /** - * Game paused texture - */ - private Texture pausedTexture; + * Constructor + * + * @param main - main class + * + * */ + public PauseMenu(Main main) { + this.main = main; + pausedTexture = new Texture("pause.png"); + } @Override public void show() { @@ -33,7 +38,11 @@ public class PauseMenu implements Screen { @Override public void render(float delta) { - + Gdx.gl.glClearColor(1, 1, 1, 1); + Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); + main.batch.begin(); + main.batch.draw(pausedTexture, 0, 0, main.WIDTH, main.HEIGHT); + main.batch.end(); } @Override @@ -58,11 +67,6 @@ public class PauseMenu implements Screen { @Override public void dispose() { - - } - - /** Constructor - * @param main - main class */ - public PauseMenu(Main main) { + pausedTexture.dispose(); } } diff --git a/core/src/com/galaxytrucker/galaxytruckerreloaded/View/Screen/ShipSelector.java b/core/src/com/galaxytrucker/galaxytruckerreloaded/View/Screen/ShipSelector.java index fad4dda28480f243fce11043612ba1fda65165ac..ba8df00f584ea462f33249255b63874b2b96c49d 100644 --- a/core/src/com/galaxytrucker/galaxytruckerreloaded/View/Screen/ShipSelector.java +++ b/core/src/com/galaxytrucker/galaxytruckerreloaded/View/Screen/ShipSelector.java @@ -9,11 +9,15 @@ import com.badlogic.gdx.graphics.OrthographicCamera; import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.graphics.g2d.SpriteBatch; import com.badlogic.gdx.scenes.scene2d.Stage; -import com.badlogic.gdx.scenes.scene2d.ui.List; +import com.galaxytrucker.galaxytruckerreloaded.Controller.HangerController; import com.galaxytrucker.galaxytruckerreloaded.Main; import com.galaxytrucker.galaxytruckerreloaded.View.Buttons.MenuButtons.DifficultyButton; import com.galaxytrucker.galaxytruckerreloaded.View.Buttons.MenuButtons.ShipSelectButton; import com.galaxytrucker.galaxytruckerreloaded.View.Buttons.MenuButtons.SinglePlayerButton; +import jdk.internal.org.jline.utils.DiffHelper; + +import java.util.LinkedList; +import java.util.List; /** * Ship selector screen when creating new game @@ -49,15 +53,28 @@ public class ShipSelector implements Screen { */ private SinglePlayerButton singlePlayerButton; + private HangerController controller; + /** Constructor TODO wie werden die schiffe dargestellt * @param main - main class */ public ShipSelector(Main main){ this.main = main; + controller = new HangerController(); + //TODO methode um mögliche schiffe zu bekommen, dann für jeden eine Textur in liste + einen button background = new Texture("1080p.png"); stage = new Stage(); + singlePlayerButton = new SinglePlayerButton(main.WIDTH-100, main.HEIGHT-100, 248, 50, this); + stage.addActor(singlePlayerButton); + difficulties = new LinkedList<>(); + for(int i=0; i<=3; i++) { + DifficultyButton difficulty1 = new DifficultyButton(main.WIDTH-100, main.HEIGHT/2 - 100 - 75*i, 248, 50, this, i); + difficulties.add(difficulty1); + stage.addActor(difficulty1); + } + Gdx.input.setInputProcessor(stage); } @@ -115,7 +132,7 @@ public class ShipSelector implements Screen { * @param ship the index of the ship in the list of possible ships */ public void setShip(int ship) { - + //TODO was für 1 username?? } /** diff --git a/core/src/com/galaxytrucker/galaxytruckerreloaded/View/UI/Events/EventGUI.java b/core/src/com/galaxytrucker/galaxytruckerreloaded/View/UI/Events/EventGUI.java index fc9f5a3f08b4be110eab62c8eb0d4f2c3dcbcebb..964097c7fb1a9062a174925b8e222d90893e8e2a 100644 --- a/core/src/com/galaxytrucker/galaxytruckerreloaded/View/UI/Events/EventGUI.java +++ b/core/src/com/galaxytrucker/galaxytruckerreloaded/View/UI/Events/EventGUI.java @@ -85,7 +85,7 @@ public class EventGUI { * * called by button */ - private void nextPage() { + public void nextPage() { } /**