Add flip icon for empty draw pile

This commit is contained in:
ItsDrike 2024-12-07 22:16:37 +01:00
parent 88cdf28cfc
commit 190795fdf7
Signed by: ItsDrike
GPG key ID: FA2745890B7048C0
4 changed files with 54 additions and 11 deletions

View file

@ -1,3 +1,6 @@
The set of playing card SVG images located in the /img/playing_cards/ directory was sourced from the following website:
<https://www.tekeye.uk/playing_cards/svg-playing-cards>
These images are licensed under the public domain, and the resources were created by <dan@tekeye.uk>.
The /img/flip_icon.svg icon was sourced from <https://freesvgicons.com>, specifically, it belongs to the Streamline pack <https://freesvgicons.com/packs/streamline>.
This icon is licensed under CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/deed.en).

1
img/flip_icon.svg Normal file
View file

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="undefined" height="undefined" viewBox="0 0 14 14"><g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"><path d="M.5 5L3 2.5L5.5 5"/><path d="M6 13.5H4a1 1 0 0 1-1-1v-10M13.5 9L11 11.5L8.5 9"/><path d="M8 .5h2a1 1 0 0 1 1 1v10"/></g></svg>

After

Width:  |  Height:  |  Size: 316 B

View file

@ -1,9 +1,15 @@
import QtQuick
import Solitare
// Shows the top card facing down
// (or a blank card if the pile is empty)
CardModel {
Item {
id: drawPile
width: drawPileCard.width
height: drawPileCard.height
CardModel {
id: drawPileCard
anchors.fill: parent
card: GameState.drawPile.length > 0 ? GameState.drawPile[GameState.drawPile.length - 1] : null
isFaceDown: GameState.drawPile.length > 0 ? true : false
onClicked: {
@ -15,4 +21,36 @@ CardModel {
}
}
}
z: 0
}
Rectangle {
id: cardCountBackground
color: "black"
opacity: 0.7
visible: cardCount.visible
width: cardCount.width + 8 // 8px padding
height: cardCount.height + 8 // ^^
anchors.bottom: parent.bottom
anchors.left: parent.left
anchors.margins: 4
radius: 4 // rounded borders
z: 1 // Behind the text, but above the card
}
Text {
id: cardCount
text: GameState.drawPile.length
visible: GameState.drawPile.length > 0
color: "white"
font.pixelSize: 16
font.bold: true
anchors.centerIn: cardCountBackground
z: 2
}
}

View file

@ -67,6 +67,7 @@
<file>../img/playing_cards/fronts/spades_jack.svg</file>
<file>../img/playing_cards/fronts/spades_king.svg</file>
<file>../img/playing_cards/fronts/spades_queen.svg</file>
<file>../img/flip_icon.svg</file>
</qresource>
</RCC>
<!-- vi: ft=xml