Вы находитесь на странице: 1из 2

package application;

import javafx.application.Application;

import javafx.stage.Stage;
import javafx.scene.Group;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.layout.Pane;

public class Main extends Application {


public static int size=50;
public static int longeur=10;
public static int largeur=10;
public static Test test=new Test();

Group BoardGroupe=new Group();


Group PieceGroupe=new Group();

@Override
public void start(Stage stage) throws Exception {
Scene s=new Scene(createContent());
stage.setTitle("dameapp");
stage.setScene(s);
stage.show();

}
public Piece FabriquerPiece(String s,boolean l,int x,int y)
{
Piece p=new Piece(s,l,x,y);
return p;
}

public Parent createContent() {


// TODO Auto-generated method stub

Pane root=new Pane();


root.setPrefSize(longeur*size, largeur*size);
root.getChildren().addAll(BoardGroupe,PieceGroupe);
for(int y=0;y<10;y++)
{
for(int x=0;x<10;x++)
{

if((x+y)%2==0)
{
Board b=new Board(true,x,y);
BoardGroupe.getChildren().add(b);
b.setPiece(null);
if(y>=6)
{
Piece p=new Piece("Blanc",false,x,y);
if( p!=null)
{

PieceGroupe.getChildren().add(p);
b.setPiece(p);

}
if (y<=3)
{
Piece p=new Piece("Noire",true,x,y);
if( p!=null)
{
b.setPiece(p);
PieceGroupe.getChildren().add(p);

}
}

}
else
{
Board b=new Board(false,x,y);
BoardGroupe.getChildren().add(b);

}
}

return root;
}

Вам также может понравиться