Merge branch 'feat/game-ui-profile-picture' into 'main'

Add: Profile Pictures

See merge request cs108-fs26/Gruppe-13!170
This commit was merged in pull request #326.
This commit is contained in:
Julian Kropff
2026-05-13 19:18:22 +00:00
4 changed files with 58 additions and 7 deletions
@@ -20,15 +20,19 @@ public class PlayerStatusController {
private static final Logger LOGGER = Logger.getLogger(PlayerStatusController.class.getName());
@FXML private Label playerName;
@FXML private Label playerMoney;
@FXML private ImageView dealerIcon;
@FXML private Pane parent;
@FXML private VBox playerStatusBox;
@FXML private HBox statusInnerBoxTop;
@FXML private HBox statusInnerBoxBottom;
@FXML Label playerName;
@FXML Label playerMoney;
@FXML ImageView dealerIcon;
@FXML ImageView playerProfileImage;
@FXML Pane parent;
@FXML VBox playerStatusBox;
@FXML HBox statusInnerBoxTop;
@FXML HBox statusInnerBoxBottom;
private Image dealerImage;
// Profile images (loaded from resources/images/profile-picture)
private Image profileUserImage;
private Image profileDealerImage;
private Player player;
private boolean turnHighlighted;
private static final String DEALER_IMAGE_PATH = "/images/chip-dealer-blue-5.png";
@@ -53,6 +57,26 @@ public class PlayerStatusController {
LOGGER.log(Level.SEVERE, "Error loading dealer image", e);
}
try {
var base = "/images/profile-picture/";
var uUser = getClass().getResource(base + "poker_user_491.png");
var uDealer = getClass().getResource(base + "poker_dealer_471.png");
if (uUser != null) {
profileUserImage = new Image(uUser.toExternalForm(), true);
}
if (uDealer != null) {
profileDealerImage = new Image(uDealer.toExternalForm(), true);
}
if (playerProfileImage != null && profileUserImage != null) {
playerProfileImage.setImage(profileUserImage);
}
} catch (Exception e) {
LOGGER.log(Level.FINE, "Could not load profile images", e);
}
dealerIcon.layoutXProperty().bind(parent.widthProperty().multiply(DEALER_ICON_X_FACTOR));
dealerIcon.setVisible(false);
}
@@ -160,6 +184,14 @@ public class PlayerStatusController {
if (isDealer && dealerImage != null) {
dealerIcon.setImage(dealerImage);
}
if (playerProfileImage != null) {
if (isDealer && profileDealerImage != null) {
playerProfileImage.setImage(profileDealerImage);
} else if (profileUserImage != null) {
playerProfileImage.setImage(profileUserImage);
}
}
}
/**
Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

@@ -4,6 +4,7 @@
<?import javafx.scene.layout.*?>
<?import javafx.scene.image.ImageView?>
<?import javafx.geometry.Insets?>
<?import javafx.scene.shape.Circle?>
<!--
This layout currently serves as a visual structure. As soon as the game engine and
@@ -33,6 +34,7 @@ and status displays will be dynamically populated with real-time data from the s
<Label styleClass="status-label-small"/>
<Label fx:id="playerName" text="-" styleClass="status-value-text"/>
</HBox>
<!-- spacer -->
@@ -50,6 +52,7 @@ and status displays will be dynamically populated with real-time data from the s
<Label styleClass="status-label-small"/>
<Label fx:id="playerMoney" text="0 $" styleClass="status-value-money"/>
</HBox>
<!-- ICON AREA -->
@@ -61,12 +64,28 @@ and status displays will be dynamically populated with real-time data from the s
prefWidth="40"
prefHeight="40"/>
<ImageView fx:id="playerProfileImage"
fitWidth="40"
fitHeight="40"
preserveRatio="true"
smooth="true"
layoutX="-25"
layoutY="-125"
styleClass="status-profile-image">
<clip>
<Circle centerX="20" centerY="20" radius="20" />
</clip>
</ImageView>
<ImageView fx:id="dealerIcon"
fitWidth="43"
fitHeight="43"
layoutY="-120"
visible="false"
styleClass="dealer-icon"/>
</Pane>
</children>