diff --git a/LICENSE-THIRD-PARTY.txt b/LICENSE-THIRD-PARTY.txt index 2aa1418..02ad182 100644 --- a/LICENSE-THIRD-PARTY.txt +++ b/LICENSE-THIRD-PARTY.txt @@ -1,3 +1,6 @@ The set of playing card SVG images located in the /img/playing_cards/ directory was sourced from the following website: These images are licensed under the public domain, and the resources were created by . + +The /img/flip_icon.svg icon was sourced from , specifically, it belongs to the Streamline pack . +This icon is licensed under CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/deed.en). diff --git a/img/flip_icon.svg b/img/flip_icon.svg new file mode 100644 index 0000000..20dd973 --- /dev/null +++ b/img/flip_icon.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/qml/DrawPile.qml b/qml/DrawPile.qml index a806428..d1cfec9 100644 --- a/qml/DrawPile.qml +++ b/qml/DrawPile.qml @@ -1,18 +1,56 @@ import QtQuick import Solitare -// Shows the top card facing down -// (or a blank card if the pile is empty) -CardModel { - card: GameState.drawPile.length > 0 ? GameState.drawPile[GameState.drawPile.length - 1] : null - isFaceDown: GameState.drawPile.length > 0 ? true : false - onClicked: { - if (GameState.drawNextCard()) { - if (GameState.isWinnable()) { - console.log("Still winnable") - } else { - console.warn("Game is lost") +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: { + 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 } } diff --git a/qml/images.qrc b/qml/images.qrc index 60bba4d..9c838e5 100644 --- a/qml/images.qrc +++ b/qml/images.qrc @@ -67,6 +67,7 @@ ../img/playing_cards/fronts/spades_jack.svg ../img/playing_cards/fronts/spades_king.svg ../img/playing_cards/fronts/spades_queen.svg + ../img/flip_icon.svg