30.09 ptp
This commit is contained in:
202
Muehle.~ava
202
Muehle.~ava
@@ -29,18 +29,20 @@ public class Muehle extends Application {
|
||||
|
||||
public void start(Stage primaryStage) {
|
||||
|
||||
game = new Game();
|
||||
game.start();
|
||||
|
||||
Pane root = new Pane();
|
||||
game = new Game();
|
||||
|
||||
game_board = draw_game_board();
|
||||
root.getChildren().addAll(lTop,game_board);
|
||||
Scene scene = new Scene(root, 1080, 820);
|
||||
|
||||
|
||||
game.start(game_board);
|
||||
|
||||
//lTop.setAlignment();
|
||||
setTopLabel("Test Label");
|
||||
|
||||
|
||||
|
||||
primaryStage.setOnCloseRequest(e -> System.exit(0));
|
||||
primaryStage.setTitle("Muehle");
|
||||
@@ -48,87 +50,135 @@ public class Muehle extends Application {
|
||||
primaryStage.show();
|
||||
} // end of public Muehle
|
||||
public void setTopLabel(String value) {
|
||||
lTop.setText(value);
|
||||
lTop.setText(value);
|
||||
}
|
||||
// start methods
|
||||
public Pane draw_game_board() {
|
||||
|
||||
Color bg_color = Color.rgb(255,255,0);
|
||||
Color stroke_color = Color.RED;
|
||||
Double circle_offset = 100.0;
|
||||
|
||||
ArrayList<Shape> shapes = new ArrayList<Shape>();
|
||||
|
||||
|
||||
|
||||
|
||||
Pane board = new Pane();
|
||||
double topLeftX = (1080/2)-400;
|
||||
double topLeftY = 720-(720/2)-300;
|
||||
double topRightX =(1080/2)+200;
|
||||
double topRightY = (720/2)+300;
|
||||
|
||||
Rectangle bg = new Rectangle(topLeftX,topLeftY,topRightX,topRightY);
|
||||
bg.setFill(bg_color);
|
||||
shapes.add(bg);
|
||||
|
||||
|
||||
Rectangle circle1 = new Rectangle(topLeftX,topLeftY,topRightX,topRightY);
|
||||
circle1.setStroke(stroke_color);
|
||||
circle1.setStrokeWidth(10);
|
||||
circle1.setFill(new Color(0.0,0.0,0.0,0.0));
|
||||
shapes.add(circle1);
|
||||
|
||||
Rectangle circle2 = new Rectangle(topLeftX + 100,topLeftY + 100,topRightX - 200,topRightY - 200);
|
||||
circle2.setStroke(stroke_color);
|
||||
circle2.setStrokeWidth(10);
|
||||
circle2.setFill(new Color(0.0,0.0,0.0,0.0));
|
||||
shapes.add(circle2);
|
||||
|
||||
Rectangle circle3 = new Rectangle(topLeftX + 200,topLeftY + 200,topRightX - 400,topRightY - 400);
|
||||
circle3.setStroke(stroke_color);
|
||||
circle3.setStrokeWidth(10);
|
||||
circle3.setFill(new Color(0.0,0.0,0.0,0.0));
|
||||
shapes.add(circle3);
|
||||
|
||||
Line line1 = new Line((topLeftX+topRightX) /2 + topLeftX/2,topLeftY,(topLeftX+topRightX) /2 + topLeftX/2,250);
|
||||
line1.setStroke(stroke_color);
|
||||
line1.setStrokeWidth(10);
|
||||
shapes.add(line1);
|
||||
|
||||
Line line2 = new Line((topLeftX+topRightX) /2 + topLeftX/2,topRightY+50,(topLeftX+topRightX) /2 + topLeftX/2,520);
|
||||
line2.setStroke(stroke_color);
|
||||
line2.setStrokeWidth(10);
|
||||
shapes.add(line2);
|
||||
|
||||
Line line3 = new Line(topLeftX,topRightY/2+50,topLeftX+200,topRightY/2+50);
|
||||
line3.setStroke(stroke_color);
|
||||
line3.setStrokeWidth(10);
|
||||
shapes.add(line3);
|
||||
|
||||
Line line4 = new Line(topLeftX+550,topRightY/2+50,topLeftX+200+540,topRightY/2+50);
|
||||
line4.setStroke(stroke_color);
|
||||
line4.setStrokeWidth(10);
|
||||
shapes.add(line4);
|
||||
|
||||
|
||||
MuehleButton button1 = new MuehleButton(0,0,100,100,Color.BLUE,game);
|
||||
shapes.add(button1.getShape());
|
||||
|
||||
for (int i = 0; i < shapes.size() ;i++ ) {
|
||||
board.getChildren().add(shapes.get(i));
|
||||
} // end of for
|
||||
|
||||
|
||||
return board;
|
||||
|
||||
Color bg_color = Color.rgb(255,255,0);
|
||||
Color stroke_color = Color.RED;
|
||||
Double circle_offset = 100.0;
|
||||
|
||||
ArrayList<Shape> shapes = new ArrayList<Shape>();
|
||||
|
||||
|
||||
|
||||
|
||||
Pane board = new Pane();
|
||||
double topLeftX = (1080/2)-400;
|
||||
double topLeftY = 720-(720/2)-300;
|
||||
double topRightX =(1080/2)+200;
|
||||
double topRightY = (720/2)+300;
|
||||
|
||||
Rectangle bg = new Rectangle(topLeftX,topLeftY,topRightX,topRightY);
|
||||
bg.setFill(bg_color);
|
||||
shapes.add(bg);
|
||||
|
||||
|
||||
Rectangle circle1 = new Rectangle(topLeftX,topLeftY,topRightX,topRightY);
|
||||
circle1.setStroke(stroke_color);
|
||||
circle1.setStrokeWidth(10);
|
||||
circle1.setFill(new Color(0.0,0.0,0.0,0.0));
|
||||
shapes.add(circle1);
|
||||
|
||||
Rectangle circle2 = new Rectangle(topLeftX + 100,topLeftY + 100,topRightX - 200,topRightY - 200);
|
||||
circle2.setStroke(stroke_color);
|
||||
circle2.setStrokeWidth(10);
|
||||
circle2.setFill(new Color(0.0,0.0,0.0,0.0));
|
||||
shapes.add(circle2);
|
||||
|
||||
Rectangle circle3 = new Rectangle(topLeftX + 200,topLeftY + 200,topRightX - 400,topRightY - 400);
|
||||
circle3.setStroke(stroke_color);
|
||||
circle3.setStrokeWidth(10);
|
||||
circle3.setFill(new Color(0.0,0.0,0.0,0.0));
|
||||
shapes.add(circle3);
|
||||
|
||||
Line line1 = new Line((topLeftX+topRightX) /2 + topLeftX/2,topLeftY,(topLeftX+topRightX) /2 + topLeftX/2,250);
|
||||
line1.setStroke(stroke_color);
|
||||
line1.setStrokeWidth(10);
|
||||
shapes.add(line1);
|
||||
|
||||
Line line2 = new Line((topLeftX+topRightX) /2 + topLeftX/2,topRightY+50,(topLeftX+topRightX) /2 + topLeftX/2,520);
|
||||
line2.setStroke(stroke_color);
|
||||
line2.setStrokeWidth(10);
|
||||
shapes.add(line2);
|
||||
|
||||
Line line3 = new Line(topLeftX,topRightY/2+50,topLeftX+200,topRightY/2+50);
|
||||
line3.setStroke(stroke_color);
|
||||
line3.setStrokeWidth(10);
|
||||
shapes.add(line3);
|
||||
|
||||
Line line4 = new Line(topLeftX+550,topRightY/2+50,topLeftX+200+540,topRightY/2+50);
|
||||
line4.setStroke(stroke_color);
|
||||
line4.setStrokeWidth(10);
|
||||
shapes.add(line4);
|
||||
|
||||
|
||||
|
||||
|
||||
for (int i = 0; i < shapes.size() ;i++ ) {
|
||||
board.getChildren().add(shapes.get(i));
|
||||
|
||||
} // end of for
|
||||
|
||||
drawMuehleButtons(board,topLeftX,topLeftY,topRightX,topRightY);
|
||||
return board;
|
||||
|
||||
}
|
||||
|
||||
public void drawMuehleButtons(Pane board, double topLeftX,double topLeftY,double topRightX,double topRightY) {
|
||||
ArrayList<Shape> shapes = new ArrayList<Shape>();
|
||||
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());
|
||||
}
|
||||
|
||||
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());
|
||||
}
|
||||
|
||||
public void addShape(Shape newShape) {
|
||||
game_board.getChildren().add(newShape);
|
||||
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());
|
||||
}
|
||||
|
||||
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());
|
||||
}
|
||||
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());
|
||||
}
|
||||
|
||||
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());
|
||||
}
|
||||
|
||||
for (int i = 0; i < shapes.size() ;i++ ) {
|
||||
board.getChildren().add(shapes.get(i));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
public void addShape(Shape newShape) {
|
||||
game_board.getChildren().add(newShape);
|
||||
|
||||
}
|
||||
|
||||
|
||||
// end methods
|
||||
|
||||
Reference in New Issue
Block a user