Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
TA2_SWT
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
Nick-Luis Achtmann
TA2_SWT
Commits
c35f7a91
Commit
c35f7a91
authored
2 months ago
by
Jan
Committed by
Nick
1 month ago
Browse files
Options
Downloads
Patches
Plain Diff
updated game logic to gui connection
parent
1a6da645
No related branches found
Branches containing commit
No related tags found
1 merge request
!2
Fehler fix
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/SceneController.java
+14
-1
14 additions, 1 deletion
src/SceneController.java
src/TicTacToe.java
+7
-5
7 additions, 5 deletions
src/TicTacToe.java
with
21 additions
and
6 deletions
src/SceneController.java
+
14
−
1
View file @
c35f7a91
import
javafx.fxml.FXML
;
import
javafx.scene.control.Button
;
import
logic.*
;
public
class
SceneController
{
private
Board
board
;
private
Actor
player
;
private
Actor
enemy
;
public
void
initData
(
Board
board
,
Actor
player
,
Actor
enemy
)
{
this
.
board
=
board
;
this
.
player
=
player
;
this
.
enemy
=
enemy
;
}
@FXML
private
Button
myButton
;
...
...
@@ -9,7 +19,10 @@ public class SceneController {
// Diese Funktion wird beim Button-Click aufgerufen
@FXML
private
void
handleButtonClick
()
{
//
// TODO
player
.
makeMove
(
board
,
0
,
0
);
System
.
out
.
println
(
"Button wurde geklickt!"
);
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/TicTacToe.java
+
7
−
5
View file @
c35f7a91
...
...
@@ -19,13 +19,15 @@ public class TicTacToe extends Application {
@Override
public
void
start
(
Stage
primaryStage
)
throws
Exception
{
// Laden der FXML-Datei
FXMLLoader
loader
=
new
FXMLLoader
(
getClass
().
getResource
(
"scene.fxml"
));
loader
.
setController
(
new
SceneController
());
// Legen Sie den Controller fest
FXMLLoader
loader
=
new
FXMLLoader
(
getClass
().
getResource
(
"Scene.fxml"
));
Parent
root
=
loader
.
load
();
Scene
scene
=
new
Scene
(
root
,
800
,
600
);
// Sie können die Größe der Szene anpassen
primaryStage
.
setTitle
(
"FXML Scene Viewer"
);
// Controller-Instanz holen und initialisieren
SceneController
controller
=
loader
.
getController
();
controller
.
initData
(
board
,
player
,
enemy
);
// Übergabe der Logik-Klassen
Scene
scene
=
new
Scene
(
root
,
800
,
600
);
primaryStage
.
setTitle
(
"Tic Tac Toe"
);
primaryStage
.
setScene
(
scene
);
primaryStage
.
show
();
}
...
...
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