Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
Tick-Tack-Trauma
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
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
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
Josua Oppermann
Tick-Tack-Trauma
Commits
288d68cf
Commit
288d68cf
authored
2 months ago
by
David Reiser
Browse files
Options
Downloads
Patches
Plain Diff
images as symbols
parent
df0569f9
No related branches found
Branches containing commit
No related tags found
Loading
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
GameUI.java
+13
-7
13 additions, 7 deletions
GameUI.java
with
13 additions
and
7 deletions
GameUI.java
+
13
−
7
View file @
288d68cf
...
...
@@ -71,12 +71,22 @@ public class GameUI extends Application{
return
;
}
board
.
tiles
[
index
].
set_owner
(
board
.
currentPlayer
);
buttons
[
index
].
setText
(
board
.
currentPlayer
==
0
?
"X"
:
"O"
);
String
imageSymbols
=
board
.
currentPlayer
==
0
?
getClass
().
getResource
(
"/textures/1_0.png"
).
toExternalForm
()
:
getClass
().
getResource
(
"/textures/0_0.png"
).
toExternalForm
();
Image
image
=
new
Image
(
""
+
imageSymbols
);
ImageView
imageView
=
new
ImageView
(
image
);
imageView
.
setFitWidth
(
135
);
imageView
.
setFitHeight
(
135
);
imageView
.
setPreserveRatio
(
true
);
buttons
[
index
].
setGraphic
(
imageView
);
board
.
turnEnd
();
updatePlayerTurn
(
board
.
currentPlayer
);
if
(
board
.
victoryCheck
())
{
//status
Label.setText("Player " + (board.currentPlayer == 0 ? "X" : "O") + " wins!");
player
Label
.
setText
(
"Player "
+
(
board
.
currentPlayer
==
0
?
"X"
:
"O"
)
+
" wins!"
);
updatePlayerScore
();
return
;
}
...
...
@@ -85,10 +95,6 @@ public class GameUI extends Application{
playerLabel
.
setText
(
"It's a draw!"
);
return
;
}
//ImageView imageView = new ImageView(new Image(tile.getImagePath()));
//button.setGraphic(imageView);
}
private
void
updatePlayerTurn
(
int
currentPlayer
)
{
...
...
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