Skip to content
Snippets Groups Projects
Commit a2a32f22 authored by Rebekka Aashaug Stangvik's avatar Rebekka Aashaug Stangvik
Browse files

added go back button to create game view

parent 7365837b
No related branches found
No related tags found
1 merge request!19Resolve "Add settings button"
...@@ -7,6 +7,7 @@ import com.badlogic.gdx.math.Vector3; ...@@ -7,6 +7,7 @@ import com.badlogic.gdx.math.Vector3;
import com.wordbattle.game.network.FirebaseInterface; import com.wordbattle.game.network.FirebaseInterface;
import com.wordbattle.game.states.LobbyState; import com.wordbattle.game.states.LobbyState;
import com.wordbattle.game.states.CreateGameState; import com.wordbattle.game.states.CreateGameState;
import com.wordbattle.game.states.MainMenuState;
import com.wordbattle.game.states.SettingsState; import com.wordbattle.game.states.SettingsState;
import com.wordbattle.game.view.CreateGameView; import com.wordbattle.game.view.CreateGameView;
...@@ -49,6 +50,10 @@ public class CreateGameController { ...@@ -49,6 +50,10 @@ public class CreateGameController {
System.out.println("Settings Pressed"); System.out.println("Settings Pressed");
state.getStateManager().setState(new SettingsState(state.getStateManager(), _FBIC)); state.getStateManager().setState(new SettingsState(state.getStateManager(), _FBIC));
} }
if (createGameView.getGoBackButtonBounds().contains(touchPos.x, touchPos.y)) {
state.getStateManager().setState(new MainMenuState(state.getStateManager(), _FBIC ));
}
} }
} }
......
...@@ -44,6 +44,7 @@ public class CreateGameView { ...@@ -44,6 +44,7 @@ public class CreateGameView {
private String selectedLevel = "easy"; // default to easy private String selectedLevel = "easy"; // default to easy
private Rectangle settingsBounds; private Rectangle settingsBounds;
private Rectangle goBackButtonBounds;
public CreateGameView(OrthographicCamera cam) { public CreateGameView(OrthographicCamera cam) {
...@@ -78,12 +79,18 @@ public class CreateGameView { ...@@ -78,12 +79,18 @@ public class CreateGameView {
100 100
); );
goBackButtonBounds = new Rectangle(
0,
WordBattle.HEIGHT - 100,
100,
100
);
// Generate a random PIN // Generate a random PIN
pin = generateRandomPin(); pin = generateRandomPin();
// Load textures // Load textures
backgroundTexture = new Texture("bgWithSettings.png"); backgroundTexture = new Texture("bg_btn_settings.png");
nicknameTexture = new Texture("pink_long-01.png"); nicknameTexture = new Texture("pink_long-01.png");
createGameTexture = new Texture("Golden_long-01.png"); createGameTexture = new Texture("Golden_long-01.png");
// Levels, non-selected // Levels, non-selected
...@@ -121,6 +128,10 @@ public class CreateGameView { ...@@ -121,6 +128,10 @@ public class CreateGameView {
return String.format("%04d", new Random().nextInt(10000)); return String.format("%04d", new Random().nextInt(10000));
} }
public Rectangle getGoBackButtonBounds() {
return goBackButtonBounds;
}
public void render(SpriteBatch spriteBatch) { public void render(SpriteBatch spriteBatch) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment