Skip to content
Snippets Groups Projects
Commit 17b9069d authored by Karl Aaron Rudkowski's avatar Karl Aaron Rudkowski
Browse files

buttons integrated so that they can do stuff

parent 7490b80d
No related branches found
No related tags found
No related merge requests found
Showing
with 253 additions and 34 deletions
......@@ -9,6 +9,7 @@ import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.galaxytrucker.galaxytruckerreloaded.Main;
import com.galaxytrucker.galaxytruckerreloaded.Model.Weapons.Weapon;
import com.galaxytrucker.galaxytruckerreloaded.View.Buttons.Button;
import com.galaxytrucker.galaxytruckerreloaded.View.UI.Ship.ShipView;
/**
* Button to activate Autofire-Function during fights
......@@ -33,14 +34,19 @@ public class AutofireButton extends Button
private Sound clickSound;
boolean down = false;
Weapon weapon;
/**
* the ui this button is on
*/
private ShipView ui;
/**
* Constructor
*
* @param main - main class
* @param ui the ui this button is on
*/
public AutofireButton(Main main, Weapon weapon) {
public AutofireButton(Main main, ShipView ui) {
// /**
// * Send data to server
......
......@@ -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.UI.Options.OptionsUI;
/**
* continue button for ingame options
......@@ -31,6 +32,11 @@ public class ContinueButton extends Button {
boolean down = false;
/**
* the options ui this button is on
*/
private OptionsUI ui;
/**
* Left-Click action of the Button.
*/
......@@ -42,8 +48,9 @@ public class ContinueButton extends Button {
/**
* constructor
* @param main the main class
* @param ui the ui this is on
*/
public ContinueButton(Main main) {
public ContinueButton(Main main, OptionsUI ui) {
}
}
......@@ -37,8 +37,9 @@ public class CrewDismissButton extends Button
* Constructor
*
* @param main - main class
* @param crew the crew member
*/
public CrewDismissButton(Main main, Crew crew) {
public CrewDismissButton(Main main, int crew) {
}
public void leftClick()
......
......@@ -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.UI.Events.EventGUI;
public class EventPageButton extends Button {
......@@ -28,6 +29,11 @@ public class EventPageButton extends Button {
boolean down = false;
/**
* the ui the button is on
*/
private EventGUI eventgui;
/**
* what happens when there is a left click on the button
*/
......@@ -35,9 +41,12 @@ public class EventPageButton extends Button {
/**
* constructor
*
* @param main the main class
*
* @param eventgui the ui the button is on
*/
public EventPageButton(Main main) {
public EventPageButton(Main main, EventGUI eventgui) {
}
}
......@@ -6,6 +6,8 @@ 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.UI.Events.ShopUI;
import com.galaxytrucker.galaxytruckerreloaded.View.UI.Inventory.InventoryUI;
/**
* used to close the inventory
......@@ -31,6 +33,18 @@ public class InventoryCloseButton extends Button {
boolean down = false;
/**
* shop ui, if button on shop
* otherwise null
*/
private ShopUI shop;
/**
* the inventory ui, if button on inventory
* otherwise null
*/
private InventoryUI inventory;
/**
* Left-Click action of the Button.
*/
......@@ -42,8 +56,10 @@ public class InventoryCloseButton extends Button {
/**
* 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) {
public InventoryCloseButton(Main main, ShopUI ui, InventoryUI inventory) {
}
}
......@@ -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.UI.Events.GameOver;
/***
* button used to return to the main menu
......@@ -31,8 +32,9 @@ public class MainMenuButton extends Button {
boolean down = false;
/**
* Left-Click action of the Button.
* Left-Click action of the Button. opens the main menu screen
*/
@Override
public void leftClick() {
......
......@@ -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.UI.Ship.ShipView;
/**
* button used to move the ship. upper middle corner, opens the map
......@@ -31,6 +32,11 @@ public class MoveButton extends Button {
boolean down = false;
/**
* the ui this button is on
*/
private ShipView ui;
/**
* Left-Click action of the Button.
*/
......@@ -42,8 +48,9 @@ public class MoveButton extends Button {
/**
* constructor
* @param main the main class
* @param ui the ui this button is on
*/
public MoveButton(Main main) {
public MoveButton(Main main, ShipView ui) {
}
}
......@@ -7,6 +7,7 @@ import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.galaxytrucker.galaxytruckerreloaded.Main;
import com.galaxytrucker.galaxytruckerreloaded.Model.Ship;
import com.galaxytrucker.galaxytruckerreloaded.View.Buttons.Button;
import com.galaxytrucker.galaxytruckerreloaded.View.UI.Ship.ShipView;
/**
* Button for opening the Ship-Interface
......@@ -30,14 +31,18 @@ public class ShipButton extends Button
*/
private Sound clickSound;
private Ship ship;
/**
* the ui this button is on
*/
private ShipView ui;
/**
* Constructor
*
* @param main - main class
* @param ship - the current Ship
* @param ui the ui this button is on
*/
public ShipButton(Main main, Ship ship) {
public ShipButton(Main main, ShipView ui) {
}
......
......@@ -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.UI.Events.ShopUI;
/**
* button used to buy something in the shop
......@@ -31,14 +32,25 @@ public class ShopBuyButton extends Button {
boolean down = false;
//Attribut um zu speichern zu welchem item dieser knopf gehört
/**
* the item this button belongs to
* index of list in shopui
*/
private int item;
/**
* the ui this button is on
*/
private ShopUI shop;
/**
* Constructor
*
* @param main - main class
* @param item the item
* @param ui the ui this button is on
*/
public ShopBuyButton(Main main) {
public ShopBuyButton(Main main, int item, ShopUI ui) {
}
......
......@@ -7,6 +7,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.UI.ShipInformation.SubsystemUI;
/**
* Button for regulation of (Sub)-System energie supplyment
......@@ -30,20 +31,23 @@ public class SystemButton extends Button
*/
private Sound clickSound;
private System system;
private Texture image_off;
private Texture image_hover_off;
Texture glow;
/**
* the ui this button belongs to
*/
private SubsystemUI ui;
/**
* Constructor
*
* @param main - main class
* @param ui the ui this button belongs to
*/
public SystemButton(Main main) {
public SystemButton(Main main, SubsystemUI ui) {
}
public void setGlowTexture(Texture glow)
......
......@@ -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.UI.ShipInformation.WeaponUI;
import java.io.BufferedWriter;
......@@ -33,7 +34,10 @@ public class WeaponActivateButton extends Button {
boolean down = false;
//TODO attribut welches weapon dieser knopf ist
/**
* the ui this button belongs to
*/
private WeaponUI ui;
/**
* Left-Click action of the Button.
......@@ -46,8 +50,9 @@ public class WeaponActivateButton extends Button {
/**
* constructor
* @param main the main class
* @param ui the ui this button belongs to
*/
public WeaponActivateButton(Main main) {
public WeaponActivateButton(Main main, WeaponUI ui) {
}
}
......@@ -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.Screen.ShipSelector;
/**
* Button for setting the degree of diffiulty
......@@ -31,13 +32,20 @@ public class DifficultyButton extends Button
private int difficulty;
/**
* Constructor
*
* @param main - main class
*/
public DifficultyButton(Main main) {
}
/**
* the screen this button is on
*/
private ShipSelector screen;
/**
* 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) {
}
/**
* Sets difficutly to a specific level
......
package com.galaxytrucker.galaxytruckerreloaded.View.Buttons.MenuButtons;
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.galaxytrucker.galaxytruckerreloaded.Main;
import com.galaxytrucker.galaxytruckerreloaded.View.Buttons.Button;
import com.galaxytrucker.galaxytruckerreloaded.View.Screen.LoginScreen;
import sun.rmi.runtime.Log;
/**
* the login button for the login screen
*/
public class LoginButton extends Button {
private String username;
/**
* Sprite batch
*/
private SpriteBatch batch;
/**
* Orthographic camera
*/
private OrthographicCamera camera;
/**
* Background
*/
private Texture background;
/**
* Click sound effect
*/
private Sound clickSound;
/**
* the screen from which this was called
*/
private LoginScreen screen;
/**
* Left-Click action of the Button.
* calls method in the screen
*/
@Override
public void leftClick() {
......@@ -21,8 +48,9 @@ public class LoginButton extends Button {
/**
* the constructor
* @param main the main class
* @param screen the login screen this button belongs to
*/
public LoginButton(Main main) {
public LoginButton(Main main, LoginScreen screen) {
}
}
......@@ -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.Screen.MainMenu;
/**
* Starts a new Game
......@@ -29,12 +30,18 @@ public class NewGameButton extends Button
*/
private Sound clickSound;
/**
* the screen this button is on
*/
private MainMenu screen;
/**
* Constructor
*
* @param main - main class
* @param screen the screen this button is on
*/
public NewGameButton(Main main) {
public NewGameButton(Main main, MainMenu screen) {
}
// /**
......
......@@ -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.Screen.MainMenu;
/**
* Ends the Game
......@@ -29,12 +30,18 @@ public class QuitButton extends Button
*/
private Sound clickSound;
/**
* the screen this button is on
*/
private MainMenu screen;
/**
* Constructor
*
* @param main - main class
* @param screen the screen this button is on
*/
public QuitButton(Main main) {
public QuitButton(Main main, MainMenu screen) {
}
// /**
......
package com.galaxytrucker.galaxytruckerreloaded.View.Buttons.MenuButtons;
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.galaxytrucker.galaxytruckerreloaded.Main;
import com.galaxytrucker.galaxytruckerreloaded.View.Buttons.Button;
import com.galaxytrucker.galaxytruckerreloaded.View.Screen.ShipSelector;
/**
* the button representing one ship in the ship selector
*/
public class ShipSelectButton extends Button {
/**
* Sprite batch
*/
private SpriteBatch batch;
/**
* Orthographic camera
*/
private OrthographicCamera camera;
/**
* Background
*/
private Texture background;
/**
* Click sound effect
*/
private Sound clickSound;
/**
* the ship this button represents in the ship selector
*/
private int ship;
/**
* the screen this button is on
*/
private ShipSelector screen;
/**
* Left-Click action of the Button.
*/
......@@ -24,9 +51,10 @@ public class ShipSelectButton extends Button {
/**
* constructor
* @param main the main class
* @param ship the ship id TODO wie werden die unterschiedlichen schiffe aus denen ausgewählt wird dargestellt?
* @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) {
public ShipSelectButton(Main main, int ship, ShipSelector screen) {
}
}
package com.galaxytrucker.galaxytruckerreloaded.View.Buttons.MenuButtons;
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.galaxytrucker.galaxytruckerreloaded.Main;
import com.galaxytrucker.galaxytruckerreloaded.View.Buttons.Button;
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;
/**
* Click sound effect
*/
private Sound clickSound;
/**
* the screen this button is on
*/
private ShipSelector screen;
/**
* whether or not it is single player
*/
......@@ -23,9 +50,11 @@ public class SinglePlayerButton extends Button {
/**
* constructor
*
* @param screen the screen this button is on
* @param main the main class
*/
public SinglePlayerButton(Main main) {
public SinglePlayerButton(Main main, ShipSelector screen) {
}
}
......@@ -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.Screen.MainMenu;
/**
* Starts a new Game
......@@ -29,13 +30,19 @@ public class StartButton extends Button
*/
private Sound clickSound;
/**
* the screen this button is on
*/
private MainMenu screen;
/**
* Constructor
*
* @param main - main class
* @param screen the screen this button is on
*/
public StartButton(Main main) {
public StartButton(Main main, MainMenu screen) {
}
// /**
......
......@@ -86,6 +86,13 @@ public class LoginScreen implements Screen {
}
/**
* login method, called by the button
*/
public void login() {
}
/**
* Constructor
*
......
......@@ -90,6 +90,30 @@ public class MainMenu implements Screen {
}
/**
* starts a new game.
* called by button
*/
public void newGame() {
}
/**
* resumes the existing game.
* called by button
*/
public void resumeGame() {
}
/**
* quits.
* called by button
*/
public void quit() {
}
/** Constructor
* @param main - main class */
public MainMenu(Main main){}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment