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

added setting button to join game view

parent db2c9818
Branches
No related tags found
1 merge request!19Resolve "Add settings button"
...@@ -8,6 +8,7 @@ import com.wordbattle.game.network.FirebaseInterface; ...@@ -8,6 +8,7 @@ import com.wordbattle.game.network.FirebaseInterface;
import com.wordbattle.game.states.CreateGameState; import com.wordbattle.game.states.CreateGameState;
import com.wordbattle.game.states.JoinGameState; import com.wordbattle.game.states.JoinGameState;
import com.wordbattle.game.states.MainMenuState; import com.wordbattle.game.states.MainMenuState;
import com.wordbattle.game.states.SettingsState;
import com.wordbattle.game.states.StartingGameState; import com.wordbattle.game.states.StartingGameState;
import com.wordbattle.game.states.WaitForHostState; import com.wordbattle.game.states.WaitForHostState;
import com.wordbattle.game.states.WaitingLobbyState; import com.wordbattle.game.states.WaitingLobbyState;
...@@ -36,6 +37,7 @@ public class JoinGameController { ...@@ -36,6 +37,7 @@ public class JoinGameController {
Vector3 touchPos = new Vector3(Gdx.input.getX(), Gdx.input.getY(), 0); Vector3 touchPos = new Vector3(Gdx.input.getX(), Gdx.input.getY(), 0);
state.getCam().unproject(touchPos); state.getCam().unproject(touchPos);
Rectangle joinGameButtonBounds = joinGameView.getJoinGameButtonBounds(); Rectangle joinGameButtonBounds = joinGameView.getJoinGameButtonBounds();
Rectangle settingsBounds = joinGameView.getSettingsBounds();
if (joinGameButtonBounds.contains(touchPos.x, touchPos.y)) { if (joinGameButtonBounds.contains(touchPos.x, touchPos.y)) {
System.out.println("Join Game Button Pressed in joinGameController"); System.out.println("Join Game Button Pressed in joinGameController");
String nickname = joinGameView.getNickname(); String nickname = joinGameView.getNickname();
...@@ -58,11 +60,11 @@ public class JoinGameController { ...@@ -58,11 +60,11 @@ public class JoinGameController {
joinGameView.setErrorMessage("DB error"); joinGameView.setErrorMessage("DB error");
} }
} }
if (settingsBounds.contains(touchPos.x, touchPos.y)) {
System.out.println("Settings Pressed");
state.getStateManager().setState(new SettingsState(state.getStateManager(), _FBIC));
}
} }
}; };
......
...@@ -42,6 +42,7 @@ public class JoinGameView { ...@@ -42,6 +42,7 @@ public class JoinGameView {
private String errorMsg; private String errorMsg;
private String errorMessage = ""; private String errorMessage = "";
private Rectangle settingsBounds;
public JoinGameView(OrthographicCamera cam){ public JoinGameView(OrthographicCamera cam){
this.cam = cam; this.cam = cam;
...@@ -50,7 +51,7 @@ public class JoinGameView { ...@@ -50,7 +51,7 @@ public class JoinGameView {
backgroundTexture = new Texture("bg2.png"); backgroundTexture = new Texture("bgWithSettings.png");
nicknameTexture = new Texture("pink_long-01.png"); nicknameTexture = new Texture("pink_long-01.png");
pinTexture = new Texture("pink_long-01.png"); pinTexture = new Texture("pink_long-01.png");
joinGameButton = new Texture("join_game.png"); joinGameButton = new Texture("join_game.png");
...@@ -78,6 +79,13 @@ public class JoinGameView { ...@@ -78,6 +79,13 @@ public class JoinGameView {
nicknameTexture.getHeight()-40 nicknameTexture.getHeight()-40
); );
settingsBounds = new Rectangle(
WordBattle.WIDTH - 100,
WordBattle.HEIGHT - 100,
100,
100
);
// Load and set up font // Load and set up font
...@@ -119,6 +127,7 @@ public class JoinGameView { ...@@ -119,6 +127,7 @@ public class JoinGameView {
} }
public Rectangle getSettingsBounds() { return settingsBounds; }
public void render(SpriteBatch spriteBatch){ public void render(SpriteBatch spriteBatch){
Gdx.gl.glClearColor(0, 0, 0, 1); Gdx.gl.glClearColor(0, 0, 0, 1);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment