Revision | fcb7b2f8c29e0485417ba82fd65ff55d74562658 (tree) |
---|---|
Zeit | 2022-01-07 03:21:53 |
Autor | sebastian_bugiu |
Commiter | sebastian_bugiu |
Added How to play menu. Updated icons based on 512x512 android icons.
@@ -2,9 +2,17 @@ | ||
2 | 2 | |
3 | 3 | import com.badlogic.gdx.Gdx; |
4 | 4 | import com.badlogic.gdx.ScreenAdapter; |
5 | +import com.badlogic.gdx.scenes.scene2d.Actor; | |
5 | 6 | import com.badlogic.gdx.scenes.scene2d.Stage; |
7 | +import com.badlogic.gdx.scenes.scene2d.ui.Label; | |
8 | +import com.badlogic.gdx.scenes.scene2d.ui.ScrollPane; | |
9 | +import com.badlogic.gdx.scenes.scene2d.ui.Skin; | |
10 | +import com.badlogic.gdx.scenes.scene2d.ui.Table; | |
11 | +import com.badlogic.gdx.scenes.scene2d.ui.TextButton; | |
12 | +import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener; | |
6 | 13 | import com.badlogic.gdx.utils.ScreenUtils; |
7 | 14 | import com.badlogic.gdx.utils.viewport.ScreenViewport; |
15 | +import com.headwayent.spacerocket.old.ExtendedCanvas; | |
8 | 16 | |
9 | 17 | public class HelpActivity extends ScreenAdapter { |
10 | 18 |
@@ -18,8 +26,19 @@ | ||
18 | 26 | public void show() { |
19 | 27 | super.show(); |
20 | 28 | stage.clear(); |
29 | + Table table = new Table(); | |
30 | +// table.setFillParent(true); | |
31 | + table.setWidth(ExtendedCanvas.getScreenWidth()); | |
32 | + table.setY(40.0f); | |
33 | + table.setHeight(ExtendedCanvas.getScreenHeight() - 80.0f); | |
34 | + //table.setDebug(true); | |
35 | + stage.addActor(table); | |
36 | + | |
21 | 37 | Gdx.input.setInputProcessor(stage); |
22 | 38 | |
39 | + // temporary until we have asset manager in | |
40 | + Skin skin = new Skin(Gdx.files.internal("uiskin.json")); | |
41 | + | |
23 | 42 | String helpString = "CONTROLS \n\n For movement use direction keys or the\n" + |
24 | 43 | "arrows on the screen or the accelerometer.\n" + |
25 | 44 | "Use the center button or the fire button on the screen to fire rockets.\n\n" + |
@@ -72,6 +91,28 @@ | ||
72 | 91 | "it will keep firing rockets until you get back to the game screen.\n" + |
73 | 92 | "3. You can check the message you have received using the Check Receive Message(Received) " + |
74 | 93 | "button. Again, while reading the message your ship will be in auto-firing mode."; |
94 | + | |
95 | + Label title = new Label("How to play", skin); | |
96 | + Label label = new Label(helpString, skin); | |
97 | + label.setWrap(true); | |
98 | + | |
99 | + ScrollPane scrollPane = new ScrollPane(label, skin); | |
100 | + scrollPane.setScrollingDisabled(true, false); | |
101 | + | |
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 | |
103 | + backButton.addListener(new ChangeListener() { | |
104 | + @Override | |
105 | + public void changed(ChangeEvent event, Actor actor) { | |
106 | + SpaceRocket.getGame().changeScreen(SpaceRocket.Screen.MAIN_MENU); | |
107 | + } | |
108 | + }); | |
109 | + | |
110 | + table.add(title).fillX(); | |
111 | + table.row().pad(10, 0, 0, 0); | |
112 | + table.add(scrollPane).expandX().fillX(); | |
113 | + table.row().pad(10, 0, 0, 0); | |
114 | + table.add(backButton).expandX().fillX(); | |
115 | + table.row().pad(20, 0, 0, 0); | |
75 | 116 | } |
76 | 117 | |
77 | 118 | @Override |
@@ -39,6 +39,7 @@ | ||
39 | 39 | TextButton newGame = new TextButton("New Game", skin); |
40 | 40 | TextButton preferences = new TextButton("Preferences", skin); |
41 | 41 | TextButton highScore = new TextButton("High Score", skin); |
42 | + TextButton help = new TextButton("How to play", skin); | |
42 | 43 | TextButton credits = new TextButton("Credits", skin); |
43 | 44 | TextButton exit = new TextButton("Exit", skin); |
44 | 45 |
@@ -49,6 +50,8 @@ | ||
49 | 50 | table.row().pad(10, 0, 0, 0); |
50 | 51 | table.add(highScore).fillX().uniformX(); |
51 | 52 | table.row().pad(10, 0, 0, 0); |
53 | + table.add(help).fillX().uniformX(); | |
54 | + table.row().pad(10, 0, 0, 0); | |
52 | 55 | table.add(credits).fillX().uniformX(); |
53 | 56 | table.row().pad(10, 0, 0, 0); |
54 | 57 | table.add(exit).fillX().uniformX(); |
@@ -82,6 +85,13 @@ | ||
82 | 85 | } |
83 | 86 | }); |
84 | 87 | |
88 | + help.addListener(new ChangeListener() { | |
89 | + @Override | |
90 | + public void changed(ChangeEvent event, Actor actor) { | |
91 | + SpaceRocket.getGame().changeScreen(SpaceRocket.Screen.HELP); | |
92 | + } | |
93 | + }); | |
94 | + | |
85 | 95 | credits.addListener(new ChangeListener() { |
86 | 96 | @Override |
87 | 97 | public void changed(ChangeEvent event, Actor actor) { |