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

buttons, teilw screens

paused angefangen
shipselector ohne schiffe
anfang anfang gamescreen
parent 8909229e
No related branches found
No related tags found
No related merge requests found
Showing
with 101 additions and 137 deletions
core/assets/continue.png

3.26 KiB

[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
core/assets/shippick_on.png

2.92 KiB

core/assets/startgame.png

3.22 KiB

core/assets/yes.png

2.93 KiB

......@@ -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();
}
......
......@@ -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();
}
});
}
}
......@@ -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()
......
......@@ -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();
}
});
}
}
......@@ -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();
}
});
}
}
......@@ -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();
}
});
}
}
......@@ -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();
}
});
}
}
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