Skip to content
Snippets Groups Projects
Commit 424d9a39 authored by Administrator's avatar Administrator
Browse files

added card images

parent f0ae19d2
Branches
Tags
No related merge requests found
Showing
with 18 additions and 56 deletions
class/images/SKIP-GREEN.png

7.91 KiB

class/images/SKIP-RED.png

7.27 KiB

class/images/SKIP-YELLOW.png

7.64 KiB

class/images/THREE-BLUE.png

6.24 KiB

class/images/THREE-GREEN.png

6.98 KiB

class/images/THREE-RED.png

6.3 KiB

class/images/THREE-YELLOW.png

6.54 KiB

class/images/TWO-BLUE.png

6.16 KiB

class/images/TWO-GREEN.png

6.85 KiB

class/images/TWO-RED.png

6.26 KiB

class/images/TWO-YELLOW.png

6.43 KiB

class/images/WILD-BLACK.png

9.04 KiB

class/images/ZERO-BLUE.png

6.1 KiB

class/images/ZERO-GREEN.png

6.71 KiB

class/images/ZERO-RED.png

6.13 KiB

class/images/ZERO-YELLOW.png

6.3 KiB

No preview for this file type
...@@ -8,23 +8,20 @@ import javafx.fxml.FXML; ...@@ -8,23 +8,20 @@ import javafx.fxml.FXML;
import javafx.geometry.Insets; import javafx.geometry.Insets;
import javafx.scene.control.Alert; import javafx.scene.control.Alert;
import javafx.scene.control.Alert.AlertType; import javafx.scene.control.Alert.AlertType;
import javafx.scene.control.Label;
import javafx.scene.image.Image; import javafx.scene.image.Image;
import javafx.scene.image.ImageView; import javafx.scene.image.ImageView;
import javafx.scene.layout.HBox; import javafx.scene.layout.HBox;
import javafx.scene.layout.StackPane;
import javafx.scene.paint.Color;
import javafx.scene.shape.Rectangle;
import javafx.stage.Stage; import javafx.stage.Stage;
import logic.Card; import logic.Card;
import logic.CardType;
import logic.Color;
import logic.Game; import logic.Game;
public class Controller public class Controller
{ {
@FXML private Label labelLastCard; @FXML private ImageView iconLastCard;
@FXML private Rectangle iconLastCard; @FXML private ImageView iconDeck;
@FXML private HBox hboxPlayerDeck; @FXML private HBox hboxPlayerDeck;
@FXML private StackPane iconDeck;
public Game game; public Game game;
...@@ -34,10 +31,7 @@ public class Controller ...@@ -34,10 +31,7 @@ public class Controller
public void init() public void init()
{ {
iconLastCard.setArcWidth(20); iconDeck.setImage(createBackCard());
iconLastCard.setArcHeight(20);
iconDeck = createBackCard();
game = new Game(this, 3); game = new Game(this, 3);
game.newGame(5); game.newGame(5);
...@@ -48,48 +42,23 @@ public class Controller ...@@ -48,48 +42,23 @@ public class Controller
this.stage = stage; this.stage = stage;
} }
public void setLastCard(String color, String text) public void setLastCard(Card card)
{ {
iconLastCard.setFill(Color.web(color)); iconLastCard.setImage(createCard(card, true).getImage());
labelLastCard.setText(text);
} }
private StackPane createBackCard() private Image createBackCard()
{ {
Rectangle newCard = new Rectangle(57.0, 90.0); return new Image("images/card-back.png");
newCard.setStroke(Color.BLACK);
newCard.setStrokeWidth(2.0);
newCard.setArcWidth(20);
newCard.setArcHeight(20);
ImageView imageView = new ImageView(new Image("images/card-back.png"));
imageView.setFitHeight(90.0);
imageView.setFitWidth(57.0);
StackPane pane = new StackPane();
pane.getChildren().add(newCard);
pane.getChildren().add(imageView);
return pane;
} }
private StackPane createCard(Card card, boolean valid) private ImageView createCard(Card card, boolean valid)
{ {
Rectangle newCard = new Rectangle(57.0, 90.0);
newCard.setStroke(Color.BLACK);
newCard.setStrokeWidth(2.0);
newCard.setArcWidth(20);
newCard.setArcHeight(20);
ImageView imageView = new ImageView(new Image("images/" + card.getType() + "-" + card.getColor() + ".png")); ImageView imageView = new ImageView(new Image("images/" + card.getType() + "-" + card.getColor() + ".png"));
imageView.setFitHeight(90.0); imageView.setFitHeight(90.0);
imageView.setFitWidth(57.0); imageView.setFitWidth(57.0);
StackPane pane = new StackPane(); return imageView;
pane.getChildren().add(newCard);
pane.getChildren().add(imageView);
return pane;
} }
public void setPlayerDeck(ArrayList<Card> deck) public void setPlayerDeck(ArrayList<Card> deck)
......
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.control.Label?> <?import javafx.scene.image.ImageView?>
<?import javafx.scene.layout.AnchorPane?> <?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.HBox?> <?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.StackPane?>
<?import javafx.scene.shape.Rectangle?>
<?import javafx.scene.text.Font?>
<AnchorPane prefHeight="600.0" prefWidth="800.0" xmlns="http://javafx.com/javafx/8.0.65" xmlns:fx="http://javafx.com/fxml/1" fx:controller="application.Controller"> <AnchorPane prefHeight="600.0" prefWidth="800.0" xmlns="http://javafx.com/javafx/8.0.65" xmlns:fx="http://javafx.com/fxml/1" fx:controller="application.Controller">
<children> <children>
<Rectangle fx:id="iconLastCard" arcHeight="5.0" arcWidth="5.0" fill="DODGERBLUE" height="90.0" layoutX="326.0" layoutY="230.0" stroke="BLACK" strokeType="INSIDE" strokeWidth="2.0" width="57.0" />
<Label fx:id="labelLastCard" alignment="CENTER" contentDisplay="CENTER" layoutX="326.0" layoutY="256.0" prefHeight="38.0" prefWidth="57.0" text="+4" textAlignment="CENTER" textFill="WHITE">
<font>
<Font name="System Bold" size="26.0" />
</font></Label>
<HBox fx:id="hboxPlayerDeck" layoutX="83.0" layoutY="450.0" prefHeight="107.0" prefWidth="634.0" /> <HBox fx:id="hboxPlayerDeck" layoutX="83.0" layoutY="450.0" prefHeight="107.0" prefWidth="634.0" />
<StackPane fx:id="iconDeck" layoutX="458.0" layoutY="230.0" prefHeight="90.0" prefWidth="57.0" /> <ImageView fx:id="iconDeck" fitHeight="90.0" fitWidth="57.0" layoutX="447.0" layoutY="230.0" pickOnBounds="true" preserveRatio="true" />
<ImageView fx:id="iconLastCard" fitHeight="90.0" fitWidth="57.0" layoutX="277.0" layoutY="230.0" pickOnBounds="true" preserveRatio="true" />
</children> </children>
</AnchorPane> </AnchorPane>
src/images/DRAW_TWO-BLUE.png

7.26 KiB

0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment