• R/O
  • SSH

Commit

Tags
Keine Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Commit MetaInfo

Revisiona9ba9e76724a2c0fe90c499e676ae3eb797dbc5e (tree)
Zeit2022-01-10 02:40:15
Autorsebastian_bugiu
Commitersebastian_bugiu

Log Message

Cosmetic changes. Readded difficulty selection menu.

Ändern Zusammenfassung

Diff

diff -r 953854125e19 -r a9ba9e76724a core/src/com/headwayent/spacerocket/CreditsActivity.java
--- a/core/src/com/headwayent/spacerocket/CreditsActivity.java Sun Jan 09 17:53:30 2022 +0200
+++ b/core/src/com/headwayent/spacerocket/CreditsActivity.java Sun Jan 09 19:40:15 2022 +0200
@@ -41,11 +41,12 @@
4141 String creditsString = "SPACEROCKET\n" +
4242 "Programmed by Sebastian Bugiu\n" +
4343 "Art by Alex Bratu\n" +
44+ "Powered by libGDX\n" +
4445 "Headway Tech Copyright 2009 - 2022";
4546 titleLabel.setText("Credits");
4647 creditsLabel.setText(creditsString);
4748
48- final TextButton backButton = new TextButton("Back", skin); // the extra argument here "small" is used to set the button to the smaller version instead of the big default version
49+ final TextButton backButton = Utility.createTextButton("Back", skin); // the extra argument here "small" is used to set the button to the smaller version instead of the big default version
4950 backButton.addListener(new ChangeListener() {
5051 @Override
5152 public void changed(ChangeEvent event, Actor actor) {
diff -r 953854125e19 -r a9ba9e76724a core/src/com/headwayent/spacerocket/HelpActivity.java
--- a/core/src/com/headwayent/spacerocket/HelpActivity.java Sun Jan 09 17:53:30 2022 +0200
+++ b/core/src/com/headwayent/spacerocket/HelpActivity.java Sun Jan 09 19:40:15 2022 +0200
@@ -99,7 +99,7 @@
9999 ScrollPane scrollPane = new ScrollPane(label, skin);
100100 scrollPane.setScrollingDisabled(true, false);
101101
102- final TextButton backButton = new TextButton("Back", skin); // the extra argument here "small" is used to set the button to the smaller version instead of the big default version
102+ final TextButton backButton = Utility.createTextButton("Back", skin); // the extra argument here "small" is used to set the button to the smaller version instead of the big default version
103103 backButton.addListener(new ChangeListener() {
104104 @Override
105105 public void changed(ChangeEvent event, Actor actor) {
diff -r 953854125e19 -r a9ba9e76724a core/src/com/headwayent/spacerocket/HighScoreActivity.java
--- a/core/src/com/headwayent/spacerocket/HighScoreActivity.java Sun Jan 09 17:53:30 2022 +0200
+++ b/core/src/com/headwayent/spacerocket/HighScoreActivity.java Sun Jan 09 19:40:15 2022 +0200
@@ -107,7 +107,7 @@
107107 table.row().pad(10, 10, 0, 10);
108108 }
109109
110- final TextButton backButton = new TextButton("Done", skin); // the extra argument here "small" is used to set the button to the smaller version instead of the big default version
110+ final TextButton backButton = Utility.createTextButton("Done", skin); // the extra argument here "small" is used to set the button to the smaller version instead of the big default version
111111 backButton.addListener(new ChangeListener() {
112112 @Override
113113 public void changed(ChangeEvent event, Actor actor) {
diff -r 953854125e19 -r a9ba9e76724a core/src/com/headwayent/spacerocket/MainMenuActivity.java
--- a/core/src/com/headwayent/spacerocket/MainMenuActivity.java Sun Jan 09 17:53:30 2022 +0200
+++ b/core/src/com/headwayent/spacerocket/MainMenuActivity.java Sun Jan 09 19:40:15 2022 +0200
@@ -6,10 +6,12 @@
66 import com.badlogic.gdx.graphics.OrthographicCamera;
77 import com.badlogic.gdx.scenes.scene2d.Actor;
88 import com.badlogic.gdx.scenes.scene2d.Stage;
9+import com.badlogic.gdx.scenes.scene2d.ui.Label;
910 import com.badlogic.gdx.scenes.scene2d.ui.Skin;
1011 import com.badlogic.gdx.scenes.scene2d.ui.Table;
1112 import com.badlogic.gdx.scenes.scene2d.ui.TextButton;
1213 import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener;
14+import com.badlogic.gdx.utils.Align;
1315 import com.badlogic.gdx.utils.ScreenUtils;
1416 import com.badlogic.gdx.utils.viewport.ScreenViewport;
1517
@@ -36,29 +38,34 @@
3638 Skin skin = new Skin(Gdx.files.internal("uiskin.json"));
3739
3840 //create buttons
39- TextButton resumeGame = new TextButton("Resume Game", skin);
40- TextButton newGame = new TextButton("New Game", skin);
41- TextButton preferences = new TextButton("Preferences", skin);
42- TextButton highScore = new TextButton("High Score", skin);
43- TextButton help = new TextButton("How to play", skin);
44- TextButton credits = new TextButton("Credits", skin);
45- TextButton exit = new TextButton("Exit", skin);
41+ Label title = new Label("HotShot", skin);
42+ title.setAlignment(Align.center);
43+ title.setFontScale(2.0f);
44+ TextButton resumeGame = Utility.createTextButton("Resume Game", skin);
45+ TextButton newGame = Utility.createTextButton("New Game", skin);
46+ TextButton preferences = Utility.createTextButton("Preferences", skin);
47+ TextButton highScore = Utility.createTextButton("High Score", skin);
48+ TextButton help = Utility.createTextButton("How to play", skin);
49+ TextButton credits = Utility.createTextButton("Credits", skin);
50+ TextButton exit = Utility.createTextButton("Exit", skin);
4651
52+ table.add(title).fillX().uniformX();
53+ table.row().pad(20, 20, 0, 20);
4754 //add buttons to table
4855 if (SpaceRocket.getGame().isSessionResumeAvailable()) {
4956 table.add(resumeGame).fillX().uniformX();
50- table.row().pad(10, 0, 0, 0);
57+ table.row().pad(10, 20, 0, 20);
5158 }
5259 table.add(newGame).fillX().uniformX();
53- table.row().pad(10, 0, 0, 0);
60+ table.row().pad(10, 20, 0, 20);
5461 table.add(preferences).fillX().uniformX();
55- table.row().pad(10, 0, 0, 0);
62+ table.row().pad(10, 20, 0, 20);
5663 table.add(highScore).fillX().uniformX();
57- table.row().pad(10, 0, 0, 0);
64+ table.row().pad(10, 20, 0, 20);
5865 table.add(help).fillX().uniformX();
59- table.row().pad(10, 0, 0, 0);
66+ table.row().pad(10, 20, 0, 20);
6067 table.add(credits).fillX().uniformX();
61- table.row().pad(10, 0, 0, 0);
68+ table.row().pad(10, 20, 0, 20);
6269 table.add(exit).fillX().uniformX();
6370
6471 // create button listeners
diff -r 953854125e19 -r a9ba9e76724a core/src/com/headwayent/spacerocket/OptionsMenuActivity.java
--- a/core/src/com/headwayent/spacerocket/OptionsMenuActivity.java Sun Jan 09 17:53:30 2022 +0200
+++ b/core/src/com/headwayent/spacerocket/OptionsMenuActivity.java Sun Jan 09 19:40:15 2022 +0200
@@ -88,7 +88,7 @@
8888 });
8989
9090
91- final TextButton backButton = new TextButton("Back", skin); // the extra argument here "small" is used to set the button to the smaller version instead of the big default version
91+ final TextButton backButton = Utility.createTextButton("Back", skin); // the extra argument here "small" is used to set the button to the smaller version instead of the big default version
9292 backButton.addListener(new ChangeListener() {
9393 @Override
9494 public void changed(ChangeEvent event, Actor actor) {
diff -r 953854125e19 -r a9ba9e76724a core/src/com/headwayent/spacerocket/Utility.java
--- a/core/src/com/headwayent/spacerocket/Utility.java Sun Jan 09 17:53:30 2022 +0200
+++ b/core/src/com/headwayent/spacerocket/Utility.java Sun Jan 09 19:40:15 2022 +0200
@@ -2,6 +2,8 @@
22
33 import com.badlogic.gdx.graphics.g2d.Sprite;
44 import com.badlogic.gdx.graphics.g2d.TextureRegion;
5+import com.badlogic.gdx.scenes.scene2d.ui.Skin;
6+import com.badlogic.gdx.scenes.scene2d.ui.TextButton;
57
68 public class Utility {
79
@@ -51,4 +53,10 @@
5153 public static float clamp(float val, float min, float max) {
5254 return Math.max(min, Math.min(max, val));
5355 }
56+
57+ public static TextButton createTextButton(String text, Skin skin) {
58+ TextButton textButton = new TextButton(text, skin);
59+ textButton.pad(10.0f);
60+ return textButton;
61+ }
5462 }
diff -r 953854125e19 -r a9ba9e76724a core/src/com/headwayent/spacerocket/old/DifficultySelection.java
--- a/core/src/com/headwayent/spacerocket/old/DifficultySelection.java Sun Jan 09 17:53:30 2022 +0200
+++ b/core/src/com/headwayent/spacerocket/old/DifficultySelection.java Sun Jan 09 19:40:15 2022 +0200
@@ -4,13 +4,16 @@
44 import com.badlogic.gdx.ScreenAdapter;
55 import com.badlogic.gdx.scenes.scene2d.Actor;
66 import com.badlogic.gdx.scenes.scene2d.Stage;
7+import com.badlogic.gdx.scenes.scene2d.ui.Label;
78 import com.badlogic.gdx.scenes.scene2d.ui.Skin;
89 import com.badlogic.gdx.scenes.scene2d.ui.Table;
910 import com.badlogic.gdx.scenes.scene2d.ui.TextButton;
1011 import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener;
12+import com.badlogic.gdx.utils.Align;
1113 import com.badlogic.gdx.utils.ScreenUtils;
1214 import com.badlogic.gdx.utils.viewport.ScreenViewport;
1315 import com.headwayent.spacerocket.SpaceRocket;
16+import com.headwayent.spacerocket.Utility;
1417
1518 /**
1619 *
@@ -49,7 +52,6 @@
4952
5053 public DifficultySelection() {
5154 stage = new Stage(new ScreenViewport());
52- Gdx.input.setInputProcessor(stage);
5355 }
5456
5557 public void show() {
@@ -59,20 +61,37 @@
5961 //table.setDebug(true);
6062 stage.addActor(table);
6163
64+ Gdx.input.setInputProcessor(stage);
65+
6266 // temporary until we have asset manager in
6367 Skin skin = new Skin(Gdx.files.internal("uiskin.json"));
6468
69+ Label title = new Label("Select difficulty", skin);
70+ title.setAlignment(Align.center);
71+ title.setFontScale(2.0f);
6572 //create buttons
66- TextButton easy = new TextButton("Easy", skin);
67- TextButton medium = new TextButton("Medium", skin);
68- TextButton hard = new TextButton("Hard", skin);
73+ TextButton easy = Utility.createTextButton("Easy", skin);
74+ TextButton medium = Utility.createTextButton("Medium", skin);
75+ TextButton hard = Utility.createTextButton("Hard", skin);
76+
77+ final TextButton backButton = Utility.createTextButton("Back", skin); // the extra argument here "small" is used to set the button to the smaller version instead of the big default version
78+ backButton.addListener(new ChangeListener() {
79+ @Override
80+ public void changed(ChangeEvent event, Actor actor) {
81+ SpaceRocket.getGame().changeScreen(SpaceRocket.Screen.MAIN_MENU);
82+ }
83+ });
6984
7085 //add buttons to table
86+ table.add(title).fillX().uniformX();
87+ table.row().pad(20, 20, 0, 20);
7188 table.add(easy).fillX().uniformX();
72- table.row().pad(10, 0, 10, 0);
89+ table.row().pad(10, 20, 0, 20);
7390 table.add(medium).fillX().uniformX();
74- table.row();
91+ table.row().pad(10, 20, 0, 20);
7592 table.add(hard).fillX().uniformX();
93+ table.row().pad(10, 20, 0, 20);
94+ table.add(backButton).fillX().uniformX();
7695
7796 final SpaceRocket game = SpaceRocket.getGame();
7897 easy.addListener(new ChangeListener() {
@@ -102,9 +121,9 @@
102121 }
103122 });
104123
105- difficulty = Difficulty.HARD;
106- game.changeScreen(SpaceRocket.Screen.IN_GAME);
107- startGame();
124+// difficulty = Difficulty.HARD;
125+// game.changeScreen(SpaceRocket.Screen.IN_GAME);
126+// startGame();
108127 }
109128
110129 @Override