Skip to content

Commit

Permalink
added rectangles for cards
Browse files Browse the repository at this point in the history
  • Loading branch information
baz committed Sep 2, 2014
1 parent f6028f5 commit 0d0a0fc
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 11 deletions.
Expand Up @@ -23,10 +23,14 @@
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.Group;
import javafx.scene.control.Label;
import javafx.scene.layout.Pane;
import javafx.scene.paint.Color;

import javafx.scene.text.Text;
import javafx.scene.shape.QuadCurve;
import javafx.scene.shape.Rectangle;

import org.luaj.vm2.lib.jse.CoerceLuaToJava;

Expand Down Expand Up @@ -71,16 +75,30 @@ private void handleTurnButtonAction(ActionEvent event) {
}
}

@FXML
private Label card01;

@FXML
private QuadCurve handGuide;

@FXML
private Pane player01Pane;
private void createHand() {
List<Card> cardsInHand = this.getCurrentPlayerHand();
int cardIndex = 0;
for (Card card : cardsInHand) {
System.out.println("found a card");

Group cardGroup = new Group();
cardGroup.setTranslateX(cardIndex * 150);
player01Pane.getChildren().add(cardGroup);

Rectangle cardBack = new Rectangle(25,25,100,250);
cardBack.setFill(Color.FIREBRICK);
cardGroup.getChildren().add(cardBack);

Label cardIdLabel = new Label();
cardIdLabel.setText(String.format("%d", card.getId()));
cardGroup.getChildren().add(cardIdLabel);

cardIndex++;
}
}
private List<Card> getCurrentPlayerHand() {
Expand Down
Expand Up @@ -14,19 +14,12 @@
<Label fx:id="label" layoutX="1098.0" layoutY="564.0" minHeight="16" minWidth="69" />
<Button layoutX="1093.0" layoutY="367.0" mnemonicParsing="false" onAction="#handleTurnButtonAction" text="Next Turn" />
<Label fx:id="turnLabel" layoutX="1091.0" layoutY="412.0" text="Turn Number" />
<Pane layoutX="120.0" layoutY="393.0" prefHeight="200.0" prefWidth="960.0">
<cursor>
<Cursor fx:constant="HAND" />
</cursor>
<Pane fx:id="player01Pane" layoutX="120.0" layoutY="393.0" prefHeight="200.0" prefWidth="960.0">
<children>
<QuadCurve fx:id="handGuide" controlY="-100.0" endX="100.0" fill="DODGERBLUE" layoutX="480.0" layoutY="200.0" startX="-100.0" stroke="BLACK" strokeType="INSIDE" />
</children>
</Pane>
<Pane layoutX="120.0" layoutY="14.0" prefHeight="200.0" prefWidth="960.0">
<cursor>
<Cursor fx:constant="HAND" />
</cursor>
</Pane>
<Label layoutX="14.0" layoutY="245.0" text="Card 01" />
</children>
</AnchorPane>

0 comments on commit 0d0a0fc

Please sign in to comment.