Merge branch 'Image_in_Rack' into 'master'
NAME CORRECTION "feather" -> "FEATHER" and UPDATE See merge request odabasioglu1/latice!3master
|
@ -22,6 +22,7 @@ public class LaticeApplicationConsole {
|
||||||
for (Color color : Color.values()) {
|
for (Color color : Color.values()) {
|
||||||
for (Shape shape : Shape.values()) {
|
for (Shape shape : Shape.values()) {
|
||||||
Tile tile = new Tile(color, shape);
|
Tile tile = new Tile(color, shape);
|
||||||
|
System.out.println(color.getStringColor() + shape.getStringShape()+ ".png");
|
||||||
|
|
||||||
listOfTile.add(tile);
|
listOfTile.add(tile);
|
||||||
|
|
||||||
|
|
|
@ -35,15 +35,11 @@ import latice.model.Tile;
|
||||||
|
|
||||||
public class LaticeApplicationWindow extends Application{
|
public class LaticeApplicationWindow extends Application{
|
||||||
|
|
||||||
javafx.scene.paint.Color realColor = new javafx.scene.paint.Color(0, 0, 0, 0);
|
Image image = new Image("laticePlateau.png");
|
||||||
|
|
||||||
Image image = new Image("C:/Users/cemal/saebut1/latice/src/main/resources/laticePlateau.png");
|
|
||||||
ImageView imageView = new ImageView(image);
|
ImageView imageView = new ImageView(image);
|
||||||
|
|
||||||
|
Tile blueBird = new Tile(Color.NAVYBLUE, Shape.BIRD);
|
||||||
|
Tile greenLeaf = new Tile(Color.GREEN, Shape.FEATHER);
|
||||||
Tile blueBird = new Tile(Color.BLUE, Shape.BIRD);
|
|
||||||
Tile greenLeaf = new Tile(Color.GREEN, Shape.LEAF);
|
|
||||||
Tile redFlower = new Tile(Color.RED, Shape.FLOWER);
|
Tile redFlower = new Tile(Color.RED, Shape.FLOWER);
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
@ -85,6 +81,24 @@ public class LaticeApplicationWindow extends Application{
|
||||||
|
|
||||||
root.setCenter(pane);
|
root.setCenter(pane);
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
//Deck
|
||||||
|
ArrayList<Tile> listOfTile = new ArrayList<Tile>();
|
||||||
|
|
||||||
|
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
|
//Rack
|
||||||
HBox rackBox = new HBox();
|
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);
|
Scene scene = new Scene(root, 1280, 720);
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,20 @@
|
||||||
package latice.model;
|
package latice.model;
|
||||||
|
|
||||||
public enum Color {
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,18 +2,33 @@ package latice.model;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
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 {
|
public class Rack {
|
||||||
private static ArrayList<Tile> listRackTile = new ArrayList<Tile>();
|
private static ArrayList<Tile> listRackTile = new ArrayList<Tile>();
|
||||||
|
|
||||||
public Rack(Deck deck) {
|
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");
|
System.out.println("Il y a dans le rack : " + listRackTile.size() + " valeurs");
|
||||||
|
|
||||||
for (int i = 0; i < 5; i++) {
|
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);
|
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 +
|
tile = (deck.getListTile()).get(index);
|
||||||
" qui est la tuile : couleur = " + (deck.getListTile()).get(index).getColor() +
|
|
||||||
" forme = " + (deck.getListTile()).get(index).getShape());
|
listRackTile.add(tile);
|
||||||
|
|
||||||
|
// root.setCenter(imageView);
|
||||||
|
|
||||||
deck.getListTile().remove(index);
|
deck.getListTile().remove(index);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -31,6 +46,46 @@ public class Rack {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public ArrayList<Tile> 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
|
// TODO add method(s) javafx
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,20 @@
|
||||||
package latice.model;
|
package latice.model;
|
||||||
|
|
||||||
public enum Shape {
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
After Width: | Height: | Size: 9.8 KiB |
After Width: | Height: | Size: 15 KiB |
After Width: | Height: | Size: 25 KiB |
After Width: | Height: | Size: 13 KiB |
After Width: | Height: | Size: 18 KiB |
After Width: | Height: | Size: 16 KiB |
After Width: | Height: | Size: 15 KiB |
After Width: | Height: | Size: 17 KiB |
After Width: | Height: | Size: 18 KiB |
After Width: | Height: | Size: 16 KiB |
After Width: | Height: | Size: 20 KiB |
After Width: | Height: | Size: 16 KiB |
After Width: | Height: | Size: 17 KiB |
After Width: | Height: | Size: 16 KiB |
After Width: | Height: | Size: 18 KiB |
After Width: | Height: | Size: 18 KiB |
After Width: | Height: | Size: 18 KiB |
After Width: | Height: | Size: 16 KiB |
After Width: | Height: | Size: 17 KiB |
After Width: | Height: | Size: 16 KiB |
After Width: | Height: | Size: 19 KiB |
After Width: | Height: | Size: 19 KiB |
After Width: | Height: | Size: 21 KiB |
After Width: | Height: | Size: 12 KiB |
After Width: | Height: | Size: 19 KiB |
After Width: | Height: | Size: 12 KiB |
After Width: | Height: | Size: 20 KiB |
After Width: | Height: | Size: 21 KiB |
After Width: | Height: | Size: 21 KiB |
After Width: | Height: | Size: 20 KiB |
After Width: | Height: | Size: 20 KiB |
After Width: | Height: | Size: 18 KiB |
After Width: | Height: | Size: 21 KiB |
After Width: | Height: | Size: 21 KiB |
After Width: | Height: | Size: 22 KiB |
After Width: | Height: | Size: 21 KiB |
After Width: | Height: | Size: 21 KiB |
After Width: | Height: | Size: 21 KiB |
After Width: | Height: | Size: 22 KiB |