Add flip icon for empty draw pile
This commit is contained in:
parent
88cdf28cfc
commit
190795fdf7
|
@ -1,3 +1,6 @@
|
||||||
The set of playing card SVG images located in the /img/playing_cards/ directory was sourced from the following website:
|
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>
|
<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>.
|
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
1
img/flip_icon.svg
Normal 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 |
|
@ -1,18 +1,56 @@
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import Solitare
|
import Solitare
|
||||||
|
|
||||||
// Shows the top card facing down
|
Item {
|
||||||
// (or a blank card if the pile is empty)
|
id: drawPile
|
||||||
CardModel {
|
width: drawPileCard.width
|
||||||
card: GameState.drawPile.length > 0 ? GameState.drawPile[GameState.drawPile.length - 1] : null
|
height: drawPileCard.height
|
||||||
isFaceDown: GameState.drawPile.length > 0 ? true : false
|
|
||||||
onClicked: {
|
CardModel {
|
||||||
if (GameState.drawNextCard()) {
|
id: drawPileCard
|
||||||
if (GameState.isWinnable()) {
|
anchors.fill: parent
|
||||||
console.log("Still winnable")
|
|
||||||
} else {
|
card: GameState.drawPile.length > 0 ? GameState.drawPile[GameState.drawPile.length - 1] : null
|
||||||
console.warn("Game is lost")
|
isFaceDown: GameState.drawPile.length > 0 ? true : false
|
||||||
|
onClicked: {
|
||||||
|
if (GameState.drawNextCard()) {
|
||||||
|
if (GameState.isWinnable()) {
|
||||||
|
console.log("Still winnable")
|
||||||
|
} else {
|
||||||
|
console.warn("Game is lost")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,6 +67,7 @@
|
||||||
<file>../img/playing_cards/fronts/spades_jack.svg</file>
|
<file>../img/playing_cards/fronts/spades_jack.svg</file>
|
||||||
<file>../img/playing_cards/fronts/spades_king.svg</file>
|
<file>../img/playing_cards/fronts/spades_king.svg</file>
|
||||||
<file>../img/playing_cards/fronts/spades_queen.svg</file>
|
<file>../img/playing_cards/fronts/spades_queen.svg</file>
|
||||||
|
<file>../img/flip_icon.svg</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
<!-- vi: ft=xml
|
<!-- vi: ft=xml
|
||||||
|
|
Loading…
Reference in a new issue