Skip to content
Snippets Groups Projects
Commit 37f6fdcb authored by Samuel Nejati Masouleh's avatar Samuel Nejati Masouleh
Browse files

VideoSettings

parent 6261ec0d
No related branches found
No related tags found
No related merge requests found
core/assets/options/escape_video_on.png

1.46 KiB | W: | H:

core/assets/options/escape_video_on.png

1.46 KiB | W: | H:

core/assets/options/escape_video_on.png
core/assets/options/escape_video_on.png
core/assets/options/escape_video_on.png
core/assets/options/escape_video_on.png
  • 2-up
  • Swipe
  • Onion skin
core/assets/options/video.png

218 KiB

...@@ -30,7 +30,7 @@ public class BackButton extends ImButton { ...@@ -30,7 +30,7 @@ public class BackButton extends ImButton {
@Override @Override
public void leftClick() { public void leftClick() {
// Einkommentieren wenn disposeVideoUI implementiert// videoUI.disposeVideoUI(); videoUI.disposeVideoUI();
optionUI.showOptionsUI(); optionUI.showOptionsUI();
} }
} }
package com.galaxytrucker.galaxytruckerreloaded.View.Buttons.InGameButtons.OptionButtons.Video;
import com.badlogic.gdx.audio.Sound;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.scenes.scene2d.InputEvent;
import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;
import com.galaxytrucker.galaxytruckerreloaded.View.Buttons.ImButton;
import com.galaxytrucker.galaxytruckerreloaded.View.UI.Options.OptionUI;
import com.galaxytrucker.galaxytruckerreloaded.View.UI.Options.PauseMenuUI;
public class VideoButton extends ImButton {
private Sound clickSound;
private OptionUI optionUI;
private PauseMenuUI pauseMenuUI;
public VideoButton(float x, float y, float width, float height, OptionUI optionUI) {
super(new Texture("options/escape_video_on.png"), x, y, width, height);
this.optionUI = optionUI;
this.addListener(new ClickListener() {
public void clicked(InputEvent event, float x, float y) {
leftClick();
}
});
}
@Override
public void leftClick() {
optionUI.openVideo();
}
}
...@@ -27,6 +27,7 @@ import com.galaxytrucker.galaxytruckerreloaded.View.UI.Events.ShopUI; ...@@ -27,6 +27,7 @@ import com.galaxytrucker.galaxytruckerreloaded.View.UI.Events.ShopUI;
import com.galaxytrucker.galaxytruckerreloaded.View.UI.Options.GeneralUI; import com.galaxytrucker.galaxytruckerreloaded.View.UI.Options.GeneralUI;
import com.galaxytrucker.galaxytruckerreloaded.View.UI.Options.OptionUI; import com.galaxytrucker.galaxytruckerreloaded.View.UI.Options.OptionUI;
import com.galaxytrucker.galaxytruckerreloaded.View.UI.Options.PauseMenuUI; import com.galaxytrucker.galaxytruckerreloaded.View.UI.Options.PauseMenuUI;
import com.galaxytrucker.galaxytruckerreloaded.View.UI.Options.VideoUI;
import com.galaxytrucker.galaxytruckerreloaded.View.UI.Ship.EnemyShip; import com.galaxytrucker.galaxytruckerreloaded.View.UI.Ship.EnemyShip;
import com.galaxytrucker.galaxytruckerreloaded.View.UI.Ship.ShipView; import com.galaxytrucker.galaxytruckerreloaded.View.UI.Ship.ShipView;
...@@ -90,10 +91,15 @@ public class GamePlay implements Screen { ...@@ -90,10 +91,15 @@ public class GamePlay implements Screen {
private GameOver gameOverUI; private GameOver gameOverUI;
/** /**
* in Options the GeneralUI * ingame general settings
*/ */
private GeneralUI generalUI; private GeneralUI generalUI;
/**
* ingame Video settings
*/
private VideoUI videoUI;
/** /**
* Gets the current open OptionUI * Gets the current open OptionUI
* @return current OptionUI * @return current OptionUI
...@@ -218,6 +224,7 @@ public class GamePlay implements Screen { ...@@ -218,6 +224,7 @@ public class GamePlay implements Screen {
if(shopUI != null) { shopUI.render(); } if(shopUI != null) { shopUI.render(); }
else if(eventGUI != null) { eventGUI.render(); } else if(eventGUI != null) { eventGUI.render(); }
else if(gameOverUI != null) { gameOverUI.render(); } else if(gameOverUI != null) { gameOverUI.render(); }
else if(videoUI != null) { videoUI.render(); }
else if(generalUI != null) { generalUI.render(); } else if(generalUI != null) { generalUI.render(); }
else if(optionUI != null) { optionUI.render(); } else if(optionUI != null) { optionUI.render(); }
else if(pauseMenuUI != null) { pauseMenuUI.render(); } else if(pauseMenuUI != null) { pauseMenuUI.render(); }
...@@ -232,6 +239,7 @@ public class GamePlay implements Screen { ...@@ -232,6 +239,7 @@ public class GamePlay implements Screen {
if(shopUI != null) { shopUI.disposeShopUI(); } if(shopUI != null) { shopUI.disposeShopUI(); }
if(eventGUI != null) { eventGUI.disposeEventGUI(); } if(eventGUI != null) { eventGUI.disposeEventGUI(); }
if(gameOverUI != null) { gameOverUI.disposeGameoverUI(); } if(gameOverUI != null) { gameOverUI.disposeGameoverUI(); }
if(videoUI != null) { videoUI.disposeVideoUI(); }
if(generalUI != null) { generalUI.disposeGeneralUI(); } if(generalUI != null) { generalUI.disposeGeneralUI(); }
if(optionUI != null) { optionUI.disposeOptionsUI(); } if(optionUI != null) { optionUI.disposeOptionsUI(); }
if(pauseMenuUI != null) { pauseMenuUI.disposePauseMenuUI(); } if(pauseMenuUI != null) { pauseMenuUI.disposePauseMenuUI(); }
...@@ -332,6 +340,22 @@ public class GamePlay implements Screen { ...@@ -332,6 +340,22 @@ public class GamePlay implements Screen {
generalUI = null; generalUI = null;
} }
/**
* opens in game video options
*/
public void createVideoUI() {
videoUI = new VideoUI(main, stage, this);
}
/**
* closes ingame video settings
*/
public void deleteVideoUI() {
videoUI = null;
}
public void createShip() { public void createShip() {
} }
......
...@@ -8,6 +8,7 @@ import com.galaxytrucker.galaxytruckerreloaded.Main; ...@@ -8,6 +8,7 @@ import com.galaxytrucker.galaxytruckerreloaded.Main;
import com.galaxytrucker.galaxytruckerreloaded.View.Buttons.InGameButtons.MainMenuButton; import com.galaxytrucker.galaxytruckerreloaded.View.Buttons.InGameButtons.MainMenuButton;
import com.galaxytrucker.galaxytruckerreloaded.View.Buttons.InGameButtons.OptionButtons.General.GeneralButton; import com.galaxytrucker.galaxytruckerreloaded.View.Buttons.InGameButtons.OptionButtons.General.GeneralButton;
import com.galaxytrucker.galaxytruckerreloaded.View.Buttons.InGameButtons.OptionButtons.OptionenBackButton; import com.galaxytrucker.galaxytruckerreloaded.View.Buttons.InGameButtons.OptionButtons.OptionenBackButton;
import com.galaxytrucker.galaxytruckerreloaded.View.Buttons.InGameButtons.OptionButtons.Video.VideoButton;
import com.galaxytrucker.galaxytruckerreloaded.View.Screen.GamePlay; import com.galaxytrucker.galaxytruckerreloaded.View.Screen.GamePlay;
/** /**
...@@ -20,10 +21,7 @@ public class OptionUI { ...@@ -20,10 +21,7 @@ public class OptionUI {
*/ */
private Texture optionsBackgroundTexture; private Texture optionsBackgroundTexture;
/** private VideoButton videoButton;
* main menu button
*/
private MainMenuButton mainMenuButton;
private OptionenBackButton optionenBackButton; private OptionenBackButton optionenBackButton;
...@@ -51,11 +49,13 @@ public class OptionUI { ...@@ -51,11 +49,13 @@ public class OptionUI {
x = main.WIDTH/2 - optionsBackgroundTexture.getWidth()/2; x = main.WIDTH/2 - optionsBackgroundTexture.getWidth()/2;
y = main.HEIGHT/2 - optionsBackgroundTexture.getHeight()/2; y = main.HEIGHT/2 - optionsBackgroundTexture.getHeight()/2;
videoButton = new VideoButton(x+220, y+270, 128, 24, this);
optionenBackButton = new OptionenBackButton(x+220, y+220, 128, 24, this, pauseMenuUI); optionenBackButton = new OptionenBackButton(x+220, y+220, 128, 24, this, pauseMenuUI);
generalButton = new GeneralButton(x+220, y+270, 128, 24, this); generalButton = new GeneralButton(x+220, y+320, 128, 24, this);
stage.addActor(optionenBackButton); stage.addActor(optionenBackButton);
stage.addActor(generalButton); stage.addActor(generalButton);
stage.addActor(videoButton);
} }
/** /**
...@@ -76,6 +76,7 @@ public class OptionUI { ...@@ -76,6 +76,7 @@ public class OptionUI {
optionsBackgroundTexture.dispose(); optionsBackgroundTexture.dispose();
optionenBackButton.remove(); optionenBackButton.remove();
generalButton.remove(); generalButton.remove();
videoButton.remove();
game.deleteOptions(); game.deleteOptions();
} }
...@@ -91,6 +92,7 @@ public class OptionUI { ...@@ -91,6 +92,7 @@ public class OptionUI {
public void showOptionsUI() { public void showOptionsUI() {
generalButton.setVisible(true); generalButton.setVisible(true);
optionenBackButton.setVisible(true); optionenBackButton.setVisible(true);
videoButton.setVisible(true);
} }
/** /**
...@@ -99,6 +101,7 @@ public class OptionUI { ...@@ -99,6 +101,7 @@ public class OptionUI {
public void hideOptionsUI() { public void hideOptionsUI() {
generalButton.setVisible(false); generalButton.setVisible(false);
optionenBackButton.setVisible(false); optionenBackButton.setVisible(false);
videoButton.setVisible(false);
} }
/** /**
...@@ -115,4 +118,9 @@ public class OptionUI { ...@@ -115,4 +118,9 @@ public class OptionUI {
this.hideOptionsUI(); this.hideOptionsUI();
game.createGeneralUI(); game.createGeneralUI();
} }
public void openVideo() {
this.hideOptionsUI();
game.createVideoUI();
}
} }
package com.galaxytrucker.galaxytruckerreloaded.View.UI.Options; package com.galaxytrucker.galaxytruckerreloaded.View.UI.Options;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Input;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.scenes.scene2d.Stage;
import com.galaxytrucker.galaxytruckerreloaded.Main;
import com.galaxytrucker.galaxytruckerreloaded.View.Buttons.InGameButtons.OptionButtons.Video.BackButton;
import com.galaxytrucker.galaxytruckerreloaded.View.Screen.GamePlay;
public class VideoUI { public class VideoUI {
/**
* background
*/
private Texture backgroundTexture;
/**
* Main instance of the running game.
*/
private Main main;
/**
* Gameplay instance of the running game;
*/
private GamePlay gamePlay;
/**
* OptionUI of the running Optionmenu.
*/
private OptionUI optionUI;
/**
* Position of the Window
*/
private float x, y;
/**
* Back Button
*/
private BackButton backButton;
/**
* Constructor
* @param main current Main instance
* @param stage current stage instance
* @param gamePlay current gameplay instance
*/
public VideoUI (Main main, Stage stage, GamePlay gamePlay) {
this.main = main;
this.gamePlay = gamePlay;
this.optionUI = gamePlay.getOptionUI();
backgroundTexture = new Texture("options/video.png");
x = main.WIDTH / 2 - backgroundTexture.getWidth() / 2;
y = main.HEIGHT / 2 - backgroundTexture.getHeight() / 2;
backButton = new BackButton(x + 220, y + 270, 128, 24, optionUI, this);
stage.addActor(backButton);
}
/**
* render
* no stage stuff
*/
public void render() {
updateInput();
main.batch.begin();
main.batch.draw(backgroundTexture, x, y, 601, 471);
main.batch.end();
}
/**
* Dispose of options ui
*/
public void disposeVideoUI() {
backgroundTexture.dispose();
backButton.remove();
gamePlay.deleteVideoUI();
}
/**
* Setup called after initialisation
*/
private void setup() {
}
/**
* Open the options menu
*/
public void showVideoUI() {
backButton.setVisible(true);
}
/**
* Close the options menu
*/
public void hideVideoUI() {
backButton.setVisible(false);
}
/**
* handles input to pause game, open options
*/
public void updateInput() {
if(Gdx.input.isKeyPressed(Input.Keys.ESCAPE)) {
disposeVideoUI();
optionUI.showOptionsUI();
}
}
} }
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