Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
pingouins
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor 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
Felton Samuel
pingouins
Commits
2b47d764
Commit
2b47d764
authored
8 years ago
by
Bariatti Francesco
Browse files
Options
Downloads
Patches
Plain Diff
Added choice for the color with which we want to play
parent
80462fe8
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
gui/src/controller/Controller.java
+20
-2
20 additions, 2 deletions
gui/src/controller/Controller.java
with
20 additions
and
2 deletions
gui/src/controller/Controller.java
+
20
−
2
View file @
2b47d764
...
...
@@ -5,11 +5,13 @@ import javafx.fxml.FXML;
import
javafx.fxml.Initializable
;
import
javafx.scene.control.Alert
;
import
javafx.scene.control.ButtonType
;
import
javafx.scene.control.ChoiceDialog
;
import
javafx.scene.input.MouseEvent
;
import
javafx.scene.layout.BorderPane
;
import
javafx.scene.paint.Color
;
import
javafx.scene.shape.Polygon
;
import
model.GameState
;
import
model.Player
;
import
model.Tile
;
import
view.TileView
;
...
...
@@ -27,6 +29,7 @@ public class Controller implements Initializable
private
PrintWriter
gameInput
;
private
Tile
[]
board
;
private
TileView
[]
boardView
;
private
Player
humanPlayer
;
@FXML
private
Polygon
tile0
,
tile1
,
tile2
,
tile3
,
tile4
,
tile5
,
tile6
,
tile7
,
tile8
,
tile9
,
tile10
,
tile11
,
tile12
,
tile13
,
tile14
,
tile15
,
tile16
,
tile17
,
tile18
,
tile19
,
tile20
,
tile21
,
tile22
,
tile23
,
tile24
,
tile25
,
tile26
,
tile27
,
tile28
,
tile29
,
tile30
,
tile31
,
tile32
,
tile33
,
tile34
,
tile35
,
tile36
,
tile37
,
tile38
,
tile39
,
tile40
,
tile41
,
tile42
,
tile43
,
tile44
,
tile45
,
tile46
,
tile47
,
tile48
,
tile49
,
tile50
,
tile51
,
tile52
,
tile53
,
tile54
,
tile55
,
tile56
,
tile57
,
tile58
,
tile59
;
...
...
@@ -69,8 +72,23 @@ public class Controller implements Initializable
upT
.
setDaemon
(
true
);
upT
.
start
();
//We tell the game that we will start
gameInput
.
println
(
"h"
);
//Choice: who will start?
ChoiceDialog
<
Player
>
playerChoice
=
new
ChoiceDialog
<>(
Player
.
Red
,
Player
.
Red
,
Player
.
Blue
);
playerChoice
.
setTitle
(
"Penguin game!"
);
playerChoice
.
setHeaderText
(
"Choose your color (red starts)"
);
playerChoice
.
showAndWait
();
humanPlayer
=
playerChoice
.
getResult
();
if
(
humanPlayer
==
null
)
{
System
.
exit
(
0
);
}
else
{
if
(
humanPlayer
.
equals
(
Player
.
Red
))
gameInput
.
println
(
"h"
);
else
gameInput
.
println
(
"c"
);
}
}
...
...
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