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 (Shape shape : Shape.values()) {
|
||||
Tile tile = new Tile(color, shape);
|
||||
System.out.println(color.getStringColor() + shape.getStringShape()+ ".png");
|
||||
|
||||
listOfTile.add(tile);
|
||||
|
||||
|
|
|
@ -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<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
|
||||
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);
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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<Tile> listRackTile = new ArrayList<Tile>();
|
||||
|
||||
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<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
|
||||
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
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 |