Skip to content
Snippets Groups Projects
Commit d5a72c0f authored by Callum Gran's avatar Callum Gran
Browse files

updated features to client

parent 1998fee1
No related branches found
No related tags found
No related merge requests found
......@@ -4,14 +4,16 @@ import edu.ntnu.idatt1002.callumg.cards.DeckOfCards;
import edu.ntnu.idatt1002.callumg.cards.HandOfCards;
import edu.ntnu.idatt1002.callumg.cards.PlayingCard;
import javafx.fxml.FXML;
import javafx.scene.control.Button;
import javafx.fxml.Initializable;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.text.Text;
import java.net.URL;
import java.util.ArrayList;
import java.util.ResourceBundle;
public class CardGameController {
public class CardGameController implements Initializable {
private DeckOfCards deckOfCards = new DeckOfCards();
private ArrayList<PlayingCard> currentDeck = deckOfCards.dealHand(5);
......@@ -30,12 +32,6 @@ public class CardGameController {
@FXML
private ImageView card5 = new ImageView();
@FXML
private Button checkhand;
@FXML
private Button dealhand;
@FXML
private Text flush;
......@@ -89,4 +85,9 @@ public class CardGameController {
card4.setImage(new Image(currentDeck.get(3).getAsPng()));
card5.setImage(new Image(currentDeck.get(4).getAsPng()));
}
@Override
public void initialize(URL url, ResourceBundle resourceBundle) {
showCards();
}
}
\ No newline at end of file
......@@ -4,5 +4,5 @@ module edu.ntnu.idatt1002.callumg {
requires javafx.controls;
exports edu.ntnu.idatt1002.callumg.client;
opens edu.ntnu.idatt2001.callumg.client to javafx.fxml;
opens edu.ntnu.idatt1002.callumg.client to javafx.fxml;
}
......@@ -10,7 +10,6 @@
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.text.Text?>
<BorderPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/17" xmlns:fx="http://javafx.com/fxml/1" fx:controller="edu.ntnu.idatt1002.callumg.client.CardGameController">
<center>
<GridPane alignment="TOP_CENTER" prefHeight="303.0" prefWidth="500.0" BorderPane.alignment="CENTER">
......@@ -33,7 +32,7 @@
<children>
<VBox prefHeight="200.0" prefWidth="100.0" GridPane.columnIndex="5">
<children>
<Button alignment="CENTER" mnemonicParsing="false" onAction="#dealHand" prefHeight="86.0" prefWidth="86.0" text="Deal Hand"></Button>
<Button alignment="CENTER" mnemonicParsing="false" onAction="#dealHand" prefHeight="86.0" prefWidth="86.0" text="Deal Hand" />
<Button alignment="CENTER" mnemonicParsing="false" onAction="#checkHand" prefHeight="26.0" prefWidth="97.0" text="Check Hand">
<VBox.margin>
<Insets top="100.0" />
......@@ -46,10 +45,10 @@
<ImageView fx:id="card3" fitHeight="150.0" fitWidth="84.0" pickOnBounds="true" preserveRatio="true" GridPane.columnIndex="2" />
<ImageView fx:id="card4" fitHeight="150.0" fitWidth="84.0" pickOnBounds="true" preserveRatio="true" GridPane.columnIndex="3" />
<ImageView fx:id="card5" fitHeight="150.0" fitWidth="84.0" pickOnBounds="true" preserveRatio="true" GridPane.columnIndex="4" />
<Text fx:id="sumofcards" strokeType="OUTSIDE" strokeWidth="0.0" wrappingWidth="82.13671684265137" GridPane.rowIndex="1" />
<Text fx:id="heartcards" strokeType="OUTSIDE" strokeWidth="0.0" wrappingWidth="82.13671684265137" GridPane.rowIndex="2" />
<Text fx:id="queenofspades" strokeType="OUTSIDE" strokeWidth="0.0" wrappingWidth="84.5367546081543" GridPane.columnIndex="1" GridPane.rowIndex="1" />
<Text fx:id="flush" strokeType="OUTSIDE" strokeWidth="0.0" wrappingWidth="82.1367301940918" GridPane.columnIndex="1" GridPane.rowIndex="2" />
<Text fx:id="sumofcards" strokeType="OUTSIDE" strokeWidth="0.0" wrappingWidth="165.33673667907715" GridPane.rowIndex="1" />
<Text fx:id="heartcards" strokeType="OUTSIDE" strokeWidth="0.0" wrappingWidth="167.7367000579834" GridPane.rowIndex="2" />
<Text fx:id="queenofspades" strokeType="OUTSIDE" strokeWidth="0.0" wrappingWidth="180.93672561645508" GridPane.columnIndex="3" GridPane.rowIndex="1" />
<Text fx:id="flush" strokeType="OUTSIDE" strokeWidth="0.0" wrappingWidth="166.93672561645508" GridPane.columnIndex="3" GridPane.rowIndex="2" />
</children>
</GridPane>
</center>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment