Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
ProgArkProject
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Sixten Müller
ProgArkProject
Commits
825f415f
Commit
825f415f
authored
1 year ago
by
Rebekka Aashaug Stangvik
Browse files
Options
Downloads
Patches
Plain Diff
added setting button to join game view
parent
db2c9818
Branches
Branches containing commit
No related tags found
1 merge request
!19
Resolve "Add settings button"
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
core/src/com/wordbattle/game/controller/JoinGameController.java
+8
-6
8 additions, 6 deletions
...rc/com/wordbattle/game/controller/JoinGameController.java
core/src/com/wordbattle/game/view/JoinGameView.java
+10
-1
10 additions, 1 deletion
core/src/com/wordbattle/game/view/JoinGameView.java
with
18 additions
and
7 deletions
core/src/com/wordbattle/game/controller/JoinGameController.java
+
8
−
6
View file @
825f415f
...
@@ -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
));
}
}
}
};
};
...
...
This diff is collapsed.
Click to expand it.
core/src/com/wordbattle/game/view/JoinGameView.java
+
10
−
1
View file @
825f415f
...
@@ -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
(
"bg
2
.png"
);
backgroundTexture
=
new
Texture
(
"bg
WithSettings
.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
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment