Add support for face down cards

This commit is contained in:
ItsDrike 2024-12-01 01:10:27 +01:00
parent 3a8b22e07a
commit 9762d7d566
Signed by: ItsDrike
GPG key ID: FA2745890B7048C0
2 changed files with 6 additions and 1 deletions

View file

@ -20,5 +20,6 @@ ApplicationWindow {
PlayingCard {
color: "clubs"
value: "ace"
isFaceDown: true
}
}

View file

@ -10,11 +10,15 @@ Item {
// anyways, typing these as simple strings is the easiest way to do this.
required property string color
required property string value
property string backStyle: "red"
property bool isFaceDown: false
Image {
id: cardImage
anchors.fill: parent
source: "qrc:/img/playing_cards/fronts/" + playingCard.color + "_" + playingCard.value + ".svg"
source: playingCard.isFaceDown
? "qrc:/img/playing_cards/backs/" + playingCard.backStyle + ".svg"
: "qrc:/img/playing_cards/fronts/" + playingCard.color + "_" + playingCard.value + ".svg"
fillMode: Image.PreserveAspectFit
}
}