diff --git a/src/main/java/latice/application/LaticeApplicationConsole.java b/src/main/java/latice/application/LaticeApplicationConsole.java index 6836f32..0c981c6 100644 --- a/src/main/java/latice/application/LaticeApplicationConsole.java +++ b/src/main/java/latice/application/LaticeApplicationConsole.java @@ -22,6 +22,7 @@ public class LaticeApplicationConsole { for (Color color : Color.values()) { for (Shape shape : Shape.values()) { Tile tile = new Tile(color, shape); + System.out.println(color.getStringColor() + shape.getStringShape()+ ".png"); listOfTile.add(tile); diff --git a/src/main/java/latice/application/LaticeApplicationWindow.java b/src/main/java/latice/application/LaticeApplicationWindow.java index 478480c..c0b2b12 100644 --- a/src/main/java/latice/application/LaticeApplicationWindow.java +++ b/src/main/java/latice/application/LaticeApplicationWindow.java @@ -35,15 +35,11 @@ import latice.model.Tile; public class LaticeApplicationWindow extends Application{ - javafx.scene.paint.Color realColor = new javafx.scene.paint.Color(0, 0, 0, 0); - - Image image = new Image("C:/Users/cemal/saebut1/latice/src/main/resources/laticePlateau.png"); + Image image = new Image("laticePlateau.png"); ImageView imageView = new ImageView(image); - - - Tile blueBird = new Tile(Color.BLUE, Shape.BIRD); - Tile greenLeaf = new Tile(Color.GREEN, Shape.LEAF); + Tile blueBird = new Tile(Color.NAVYBLUE, Shape.BIRD); + Tile greenLeaf = new Tile(Color.GREEN, Shape.FEATHER); Tile redFlower = new Tile(Color.RED, Shape.FLOWER); public static void main(String[] args) { @@ -85,6 +81,24 @@ public class LaticeApplicationWindow extends Application{ root.setCenter(pane); + //-------------------------------------------------------------------------------------- + //Deck + ArrayList listOfTile = new ArrayList(); + + for (Color color : Color.values()) { + for (Shape shape : Shape.values()) { + Tile tile = new Tile(color, shape); + System.out.println(color.getStringColor() + shape.getStringShape()+ ".png"); + + listOfTile.add(tile); + + } + } + + Deck deck = new Deck(listOfTile); + + + //-------------------------------------------------------------------------------------- //Rack HBox rackBox = new HBox(); @@ -190,6 +204,14 @@ public class LaticeApplicationWindow extends Application{ + //With Image + Rack rack2 = new Rack(deck); + HBox rackImage = rack2.createImageTileOfRack(); // TODO Create the deck + + + root.setBottom(rackImage); + + //-------------------------------------------------------------------------------------- Scene scene = new Scene(root, 1280, 720); diff --git a/src/main/java/latice/model/Color.java b/src/main/java/latice/model/Color.java index 27b16fa..7c3fe17 100644 --- a/src/main/java/latice/model/Color.java +++ b/src/main/java/latice/model/Color.java @@ -1,5 +1,20 @@ package latice.model; public enum Color { - YELLOW, BLUE, RED, PURPLE, GREEN, TURCHESE; + YELLOW("y"), + NAVYBLUE("n"), + RED("r"), + MAGENTA("m"), + GREEN("g"), + TURQUOISE("t"); //TODO find what is the color turchese, and write it's color code + + private String stringColor; + + Color(String stringColor) { + this.stringColor = stringColor; + } + + public String getStringColor() { + return this.stringColor; + } } diff --git a/src/main/java/latice/model/Rack.java b/src/main/java/latice/model/Rack.java index 77da402..39925a1 100644 --- a/src/main/java/latice/model/Rack.java +++ b/src/main/java/latice/model/Rack.java @@ -2,18 +2,33 @@ package latice.model; import java.util.ArrayList; +import javafx.geometry.Insets; +import javafx.geometry.Pos; +import javafx.scene.image.Image; +import javafx.scene.image.ImageView; +import javafx.scene.layout.HBox; +import javafx.scene.text.Text; + public class Rack { private static ArrayList listRackTile = new ArrayList(); public Rack(Deck deck) { + + Image image = new Image("laticePlateau.png"); + ImageView imageView = new ImageView(image); + Tile tile; + System.out.println("Il y a dans le rack : " + listRackTile.size() + " valeurs"); for (int i = 0; i < 5; i++) { int index = (int)(Math.random()*((deck.getListTile()).size()-0+1)+0); //(int)(Math.random()*(max-min+1)+min); - listRackTile.add((deck.getListTile()).get(index)); - System.out.println("l'indice de la tuile ajouté au rack est : " + index + - " qui est la tuile : couleur = " + (deck.getListTile()).get(index).getColor() + - " forme = " + (deck.getListTile()).get(index).getShape()); + + tile = (deck.getListTile()).get(index); + + listRackTile.add(tile); + + // root.setCenter(imageView); + deck.getListTile().remove(index); } @@ -31,6 +46,46 @@ public class Rack { + + public ArrayList getListRackTile() { + return listRackTile; + } + + + + public HBox createImageTileOfRack() { + Image image; + ImageView imageView; + Tile tile; + int index; + + HBox rack = new HBox(); + + for (int i = 0; i < 5; i++) { + index = i; + + tile = (this.getListRackTile()).get(index); + + image = new Image(tile.getShape().getStringShape() + " " + tile.getColor().getStringColor()+ ".png"); + imageView = new ImageView(image); + + rack.getChildren().add(imageView); + } + + rack.setSpacing(10); + rack.setPadding(new Insets(15,20, 10,10)); + + rack.setAlignment(Pos.CENTER); + + return rack; + + } + + + + + + // TODO add method(s) javafx } diff --git a/src/main/java/latice/model/Shape.java b/src/main/java/latice/model/Shape.java index 1647219..e6d7da5 100644 --- a/src/main/java/latice/model/Shape.java +++ b/src/main/java/latice/model/Shape.java @@ -1,5 +1,20 @@ package latice.model; public enum Shape { - BIRD, DOLPHIN, FLOWER, LEAF, LIZARD, TORTOISE; + BIRD("bird"), + DOLPHIN("dolphin"), + FLOWER("flower"), + FEATHER("feather"), + GECKO("gecko"), + TURTLE("turtle"); + + private String stringShape; + + Shape(String stringShape) { + this.stringShape = stringShape; + } + + public String getStringShape() { + return this.stringShape; + } } diff --git a/src/main/resources/bg_moon.png b/src/main/resources/bg_moon.png new file mode 100644 index 0000000..481b62f Binary files /dev/null and b/src/main/resources/bg_moon.png differ diff --git a/src/main/resources/bg_sea.png b/src/main/resources/bg_sea.png new file mode 100644 index 0000000..fd00e3c Binary files /dev/null and b/src/main/resources/bg_sea.png differ diff --git a/src/main/resources/bg_sun.png b/src/main/resources/bg_sun.png new file mode 100644 index 0000000..2ad1805 Binary files /dev/null and b/src/main/resources/bg_sun.png differ diff --git a/src/main/resources/bird_g.png b/src/main/resources/bird_g.png new file mode 100644 index 0000000..862b2c1 Binary files /dev/null and b/src/main/resources/bird_g.png differ diff --git a/src/main/resources/bird_m.png b/src/main/resources/bird_m.png new file mode 100644 index 0000000..e6e8c5b Binary files /dev/null and b/src/main/resources/bird_m.png differ diff --git a/src/main/resources/bird_n.png b/src/main/resources/bird_n.png new file mode 100644 index 0000000..00c9ca9 Binary files /dev/null and b/src/main/resources/bird_n.png differ diff --git a/src/main/resources/bird_r.png b/src/main/resources/bird_r.png new file mode 100644 index 0000000..47b7ddd Binary files /dev/null and b/src/main/resources/bird_r.png differ diff --git a/src/main/resources/bird_t.png b/src/main/resources/bird_t.png new file mode 100644 index 0000000..f0a8281 Binary files /dev/null and b/src/main/resources/bird_t.png differ diff --git a/src/main/resources/bird_y.png b/src/main/resources/bird_y.png new file mode 100644 index 0000000..11bf641 Binary files /dev/null and b/src/main/resources/bird_y.png differ diff --git a/src/main/resources/dolphin_g.png b/src/main/resources/dolphin_g.png new file mode 100644 index 0000000..5014db6 Binary files /dev/null and b/src/main/resources/dolphin_g.png differ diff --git a/src/main/resources/dolphin_m.png b/src/main/resources/dolphin_m.png new file mode 100644 index 0000000..1349e90 Binary files /dev/null and b/src/main/resources/dolphin_m.png differ diff --git a/src/main/resources/dolphin_n.png b/src/main/resources/dolphin_n.png new file mode 100644 index 0000000..004c9c6 Binary files /dev/null and b/src/main/resources/dolphin_n.png differ diff --git a/src/main/resources/dolphin_r.png b/src/main/resources/dolphin_r.png new file mode 100644 index 0000000..9b0932b Binary files /dev/null and b/src/main/resources/dolphin_r.png differ diff --git a/src/main/resources/dolphin_t.png b/src/main/resources/dolphin_t.png new file mode 100644 index 0000000..3afd4b4 Binary files /dev/null and b/src/main/resources/dolphin_t.png differ diff --git a/src/main/resources/dolphin_y.png b/src/main/resources/dolphin_y.png new file mode 100644 index 0000000..80642ac Binary files /dev/null and b/src/main/resources/dolphin_y.png differ diff --git a/src/main/resources/feather_g.png b/src/main/resources/feather_g.png new file mode 100644 index 0000000..d9bf11d Binary files /dev/null and b/src/main/resources/feather_g.png differ diff --git a/src/main/resources/feather_m.png b/src/main/resources/feather_m.png new file mode 100644 index 0000000..5d71c0e Binary files /dev/null and b/src/main/resources/feather_m.png differ diff --git a/src/main/resources/feather_n.png b/src/main/resources/feather_n.png new file mode 100644 index 0000000..d8dff12 Binary files /dev/null and b/src/main/resources/feather_n.png differ diff --git a/src/main/resources/feather_r.png b/src/main/resources/feather_r.png new file mode 100644 index 0000000..c9806d9 Binary files /dev/null and b/src/main/resources/feather_r.png differ diff --git a/src/main/resources/feather_t.png b/src/main/resources/feather_t.png new file mode 100644 index 0000000..454bc99 Binary files /dev/null and b/src/main/resources/feather_t.png differ diff --git a/src/main/resources/feather_y.png b/src/main/resources/feather_y.png new file mode 100644 index 0000000..11b2209 Binary files /dev/null and b/src/main/resources/feather_y.png differ diff --git a/src/main/resources/flower_g.png b/src/main/resources/flower_g.png new file mode 100644 index 0000000..2bea5d1 Binary files /dev/null and b/src/main/resources/flower_g.png differ diff --git a/src/main/resources/flower_m.png b/src/main/resources/flower_m.png new file mode 100644 index 0000000..f2d528d Binary files /dev/null and b/src/main/resources/flower_m.png differ diff --git a/src/main/resources/flower_n.png b/src/main/resources/flower_n.png new file mode 100644 index 0000000..aac8541 Binary files /dev/null and b/src/main/resources/flower_n.png differ diff --git a/src/main/resources/flower_r.png b/src/main/resources/flower_r.png new file mode 100644 index 0000000..94d28b8 Binary files /dev/null and b/src/main/resources/flower_r.png differ diff --git a/src/main/resources/flower_t.png b/src/main/resources/flower_t.png new file mode 100644 index 0000000..fa65f91 Binary files /dev/null and b/src/main/resources/flower_t.png differ diff --git a/src/main/resources/flower_y.png b/src/main/resources/flower_y.png new file mode 100644 index 0000000..95d70ef Binary files /dev/null and b/src/main/resources/flower_y.png differ diff --git a/src/main/resources/gecko_g.png b/src/main/resources/gecko_g.png new file mode 100644 index 0000000..8c806fe Binary files /dev/null and b/src/main/resources/gecko_g.png differ diff --git a/src/main/resources/gecko_m.png b/src/main/resources/gecko_m.png new file mode 100644 index 0000000..63f1a6d Binary files /dev/null and b/src/main/resources/gecko_m.png differ diff --git a/src/main/resources/gecko_n.png b/src/main/resources/gecko_n.png new file mode 100644 index 0000000..a24725e Binary files /dev/null and b/src/main/resources/gecko_n.png differ diff --git a/src/main/resources/gecko_r.png b/src/main/resources/gecko_r.png new file mode 100644 index 0000000..b27da4b Binary files /dev/null and b/src/main/resources/gecko_r.png differ diff --git a/src/main/resources/gecko_t.png b/src/main/resources/gecko_t.png new file mode 100644 index 0000000..dd8ddd6 Binary files /dev/null and b/src/main/resources/gecko_t.png differ diff --git a/src/main/resources/gecko_y.png b/src/main/resources/gecko_y.png new file mode 100644 index 0000000..6e9ad02 Binary files /dev/null and b/src/main/resources/gecko_y.png differ diff --git a/src/main/resources/turtle_g.png b/src/main/resources/turtle_g.png new file mode 100644 index 0000000..808c09a Binary files /dev/null and b/src/main/resources/turtle_g.png differ diff --git a/src/main/resources/turtle_m.png b/src/main/resources/turtle_m.png new file mode 100644 index 0000000..166e4b7 Binary files /dev/null and b/src/main/resources/turtle_m.png differ diff --git a/src/main/resources/turtle_n.png b/src/main/resources/turtle_n.png new file mode 100644 index 0000000..d987d1b Binary files /dev/null and b/src/main/resources/turtle_n.png differ diff --git a/src/main/resources/turtle_r.png b/src/main/resources/turtle_r.png new file mode 100644 index 0000000..46d0086 Binary files /dev/null and b/src/main/resources/turtle_r.png differ diff --git a/src/main/resources/turtle_t.png b/src/main/resources/turtle_t.png new file mode 100644 index 0000000..9acdab8 Binary files /dev/null and b/src/main/resources/turtle_t.png differ diff --git a/src/main/resources/turtle_y.png b/src/main/resources/turtle_y.png new file mode 100644 index 0000000..bb817d6 Binary files /dev/null and b/src/main/resources/turtle_y.png differ