From 55f2d520b7732a0d3bf94aa2f443038a58e923ba Mon Sep 17 00:00:00 2001 From: ItsDrike Date: Tue, 10 Dec 2024 00:05:06 +0100 Subject: [PATCH] Use a cards image for redeal button --- LICENSE-THIRD-PARTY.txt | 2 +- img/cards.svg | 1 + qml/ScoreBar.qml | 36 +++++++++++++++++++++++++++--------- qml/images.qrc | 1 + 4 files changed, 30 insertions(+), 10 deletions(-) create mode 100644 img/cards.svg diff --git a/LICENSE-THIRD-PARTY.txt b/LICENSE-THIRD-PARTY.txt index 02ad182..b4c1e3f 100644 --- a/LICENSE-THIRD-PARTY.txt +++ b/LICENSE-THIRD-PARTY.txt @@ -2,5 +2,5 @@ The set of playing card SVG images located in the /img/playing_cards/ directory 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 . +The /img/flip_icon.svg & /img/cards.svg icons were 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/cards.svg b/img/cards.svg new file mode 100644 index 0000000..308b396 --- /dev/null +++ b/img/cards.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/qml/ScoreBar.qml b/qml/ScoreBar.qml index 597bf2d..74fc7c2 100644 --- a/qml/ScoreBar.qml +++ b/qml/ScoreBar.qml @@ -12,6 +12,33 @@ Rectangle { color: "lightgray" + RoundButton { + onClicked: GameState.dealCards() + + anchors.left: parent.left + anchors.leftMargin: parent.width * 0.02 + anchors.verticalCenter: parent.verticalCenter + height: parent.height * 0.5 + width: parent.width * 0.05 + + radius: Math.min(width, height) * 0.2 + + Image { + source: "qrc:/img/cards.svg" + + width: parent.width * 0.7 + height: parent.height * 0.7 + anchors.centerIn: parent + anchors.margins: Math.min(width, height) * 0.06 + + // This makes sure the SVG scales properly, otherwise it would + // attempt to scale the image from the original source size, which + // can end up being blurry. + sourceSize: Qt.size(width, height) + fillMode: Image.PreserveAspectFit + } + } + Item { id: firstRow @@ -23,15 +50,6 @@ Rectangle { anchors.rightMargin: parent.width * 0.02 height: parent.height * 0.5 - Button { - text: "Redeal" - onClicked: GameState.dealCards() - - anchors.left: parent.left - anchors.verticalCenter: parent.verticalCenter - height: parent.height - } - Row { anchors.top: parent.top height: parent.height diff --git a/qml/images.qrc b/qml/images.qrc index 782196f..300c05d 100644 --- a/qml/images.qrc +++ b/qml/images.qrc @@ -1,6 +1,7 @@ + ../img/cards.svg ../img/flip_icon.svg ../img/playing_cards/backs/abstract.svg ../img/playing_cards/backs/abstract_clouds.svg