Skip to content
Snippets Groups Projects
Commit fcfa7afb authored by Sixten Müller's avatar Sixten Müller
Browse files

feat: Working first round for both player and host

parent dac94b2c
Branches
No related tags found
2 merge requests!22Resolve "Create game model",!18Draft: Resolve "Create game model"
...@@ -8,7 +8,7 @@ buildscript { ...@@ -8,7 +8,7 @@ buildscript {
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:8.2.1' classpath 'com.android.tools.build:gradle:8.2.2'
classpath 'com.google.gms:google-services:4.4.1' classpath 'com.google.gms:google-services:4.4.1'
......
...@@ -58,9 +58,14 @@ public class WaitForHostController { ...@@ -58,9 +58,14 @@ public class WaitForHostController {
} }
private void listenForStart() { private void listenForStart() {
// Inside your listener method
_FBIC.listenForGameStart(pin, () -> { _FBIC.listenForGameStart(pin, () -> {
Gdx.app.postRunnable(() -> {
System.out.println("Gameflag start triggered");
state.getStateManager().setState(new GamePlayState(state.getStateManager(), _FBIC, pin, nickname)); state.getStateManager().setState(new GamePlayState(state.getStateManager(), _FBIC, pin, nickname));
}); });
});
} }
private void handleInput(){ private void handleInput(){
......
...@@ -3,6 +3,8 @@ package com.wordbattle.game.view; ...@@ -3,6 +3,8 @@ package com.wordbattle.game.view;
import com.badlogic.gdx.Gdx; import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Screen; import com.badlogic.gdx.Screen;
import com.badlogic.gdx.graphics.Color; import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.GL30;
import com.badlogic.gdx.graphics.OrthographicCamera; import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.BitmapFont; import com.badlogic.gdx.graphics.g2d.BitmapFont;
...@@ -56,6 +58,8 @@ public class GamePlayView { ...@@ -56,6 +58,8 @@ public class GamePlayView {
Gdx.input.setInputProcessor(stage); Gdx.input.setInputProcessor(stage);
// Load BG // Load BG
backgroundTexture = new Texture("bg2.png"); backgroundTexture = new Texture("bg2.png");
...@@ -71,7 +75,6 @@ public class GamePlayView { ...@@ -71,7 +75,6 @@ public class GamePlayView {
TextField.TextFieldStyle textFieldStyle = new TextField.TextFieldStyle(); TextField.TextFieldStyle textFieldStyle = new TextField.TextFieldStyle();
textFieldStyle.font = font; textFieldStyle.font = font;
textFieldStyle.fontColor = Color.WHITE; textFieldStyle.fontColor = Color.WHITE;
shapeRenderer = new ShapeRenderer();
// Set timer // Set timer
maxTime = 30.0f; maxTime = 30.0f;
...@@ -79,10 +82,6 @@ public class GamePlayView { ...@@ -79,10 +82,6 @@ public class GamePlayView {
isTimerRunning = true; // Start with the timer running isTimerRunning = true; // Start with the timer running
} }
// Update timer // Update timer
...@@ -105,9 +104,14 @@ public class GamePlayView { ...@@ -105,9 +104,14 @@ public class GamePlayView {
} }
public void render(SpriteBatch sb) { public void render(SpriteBatch sb) {
if (shapeRenderer == null) {
shapeRenderer = new ShapeRenderer();
}
if (letterPool != null) { if (letterPool != null) {
letters = letterPool.getLetters(); letters = letterPool.getLetters();
letterBounds = new Rectangle[letters.size()]; letterBounds = new Rectangle[letters.size()];
...@@ -192,6 +196,7 @@ public class GamePlayView { ...@@ -192,6 +196,7 @@ public class GamePlayView {
} }
} }
public Stack<Character> getSelectedLetters() { public Stack<Character> getSelectedLetters() {
return selectedLetters; return selectedLetters;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment