This commit is contained in:
Mykola Fesenko
2025-09-30 14:53:58 +02:00
parent 5de88e7fae
commit 0d892f03bb
6 changed files with 368 additions and 65 deletions

View File

@@ -12,6 +12,7 @@ import javafx.scene.shape.Line;
import javafx.event.Event;
import javafx.event.EventHandler;
import javafx.scene.input.MouseEvent;
import javafx.scene.shape.Circle;
/**
*
* Beschreibung
@@ -38,7 +39,9 @@ public class Muehle extends Application {
Scene scene = new Scene(root, 1080, 820);
game.start(game_board);
game.start(game_board,lTop);
drawPlayerChips();
//lTop.setAlignment();
setTopLabel("Test Label");
@@ -131,49 +134,77 @@ public class Muehle extends Application {
Color button_color = Color.BLUE;
for (int i = 0; i < 3; i++) {
MuehleButton button = new MuehleButton(0,i,topLeftX,topLeftY+ i*325,button_color,game);
shapes.add(button.getShape());
MuehleButton button = new MuehleButton(0,i,topLeftX,topLeftY+ i*325,button_color,game);
shapes.add(button.getShape());
}
for (int i = 0; i < 3; i++) {
MuehleButton button = new MuehleButton(1,i,topRightX -230,topLeftY+ i*100,button_color,game);
shapes.add(button.getShape());
}
for (int i = 0; i < 3; i++) {
MuehleButton button = new MuehleButton(2,i,topRightX + 140,topLeftY+ i*325,button_color,game);
shapes.add(button.getShape());
}
for (int i = 0; i < 3; i++) {
MuehleButton button = new MuehleButton(0,i,topLeftX + 100,topLeftY+ i*220 +100,button_color,game);
shapes.add(button.getShape());
MuehleButton button = new MuehleButton(1,i,topRightX -230,topLeftY+ i*100,button_color,game);
shapes.add(button.getShape());
}
for (int i = 0; i < 3; i++) {
MuehleButton button = new MuehleButton(2,i,topRightX +40,topLeftY+ i*220 +100,button_color,game);
shapes.add(button.getShape());
MuehleButton button = new MuehleButton(2,i,topRightX + 140,topLeftY+ i*325,button_color,game);
shapes.add(button.getShape());
}
for (int i = 0; i < 3; i++) {
MuehleButton button = new MuehleButton(1,i,topRightX -230,topLeftY+ i*100 +460,button_color,game);
shapes.add(button.getShape());
MuehleButton button = new MuehleButton(0,i,topLeftX + 100,topLeftY+ i*220 +100,button_color,game);
shapes.add(button.getShape());
}
for (int i = 0; i < 3; i++) {
MuehleButton button = new MuehleButton(0,i,topLeftX +200,topLeftY+ i*130 +200,button_color,game);
shapes.add(button.getShape());
MuehleButton button = new MuehleButton(2,i,topRightX +40,topLeftY+ i*220 +100,button_color,game);
shapes.add(button.getShape());
}
for (int i = 0; i < 3; i++) {
MuehleButton button = new MuehleButton(2,i,topLeftX +540,topLeftY+ i*130 +200,button_color,game);
shapes.add(button.getShape());
MuehleButton button = new MuehleButton(1,i,topRightX -230,topLeftY+ i*100 +460,button_color,game);
shapes.add(button.getShape());
}
for (int i = 0; i < 3; i++) {
MuehleButton button = new MuehleButton(0,i,topLeftX +200,topLeftY+ i*130 +200,button_color,game);
shapes.add(button.getShape());
}
for (int i = 0; i < 3; i++) {
MuehleButton button = new MuehleButton(2,i,topLeftX +540,topLeftY+ i*130 +200,button_color,game);
shapes.add(button.getShape());
}
game.buttons.addAll(shapes);
for (int i = 0; i < shapes.size() ;i++ ) {
board.getChildren().add(shapes.get(i));
}
}
public void drawPlayerChips() {
Circle[] white_player_chips = new Circle[9];
Circle[] black_player_chips = new Circle[9];
Color stroke_color = Color.BLACK;
double stroke_width = 2;
double radius = 20;
for (int i = 0; i < 9; i++) {
white_player_chips[i] = new Circle(radius*2 +20,50*i+ 200,radius);
white_player_chips[i].setStroke(stroke_color);
white_player_chips[i].setStrokeWidth(stroke_width);
white_player_chips[i].setFill(Color.WHITE);
addShape(white_player_chips[i]);
}
for (int i = 0; i < 9; i++) {
black_player_chips[i] = new Circle((1080-20) - radius*2,50*i+ 200,radius);
black_player_chips[i].setStroke(stroke_color);
black_player_chips[i].setStrokeWidth(stroke_width);
black_player_chips[i].setFill(Color.BLACK);
addShape(black_player_chips[i]);
}
}
public void addShape(Shape newShape) {
game_board.getChildren().add(newShape);