Use a cards image for redeal button

This commit is contained in:
ItsDrike 2024-12-10 00:05:06 +01:00
parent 098b45a3ff
commit 55f2d520b7
Signed by: ItsDrike
GPG key ID: FA2745890B7048C0
4 changed files with 30 additions and 10 deletions

View file

@ -2,5 +2,5 @@ The set of playing card SVG images located in the /img/playing_cards/ directory
<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>. The /img/flip_icon.svg & /img/cards.svg icons were 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). This icon is licensed under CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/deed.en).

1
img/cards.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="M6.546.857a.475.475 0 0 1 .581-.335l6.02 1.612a.475.475 0 0 1 .337.581l-2.31 8.618a.475.475 0 0 1-.582.335l-6.02-1.612a.475.475 0 0 1-.336-.581z"/><path d="M6.108 2.535L.852 3.944a.475.475 0 0 0-.336.581l2.308 8.618a.475.475 0 0 0 .582.335l3.01-.806"/></g></svg>

After

Width:  |  Height:  |  Size: 452 B

View file

@ -12,6 +12,33 @@ Rectangle {
color: "lightgray" 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 { Item {
id: firstRow id: firstRow
@ -23,15 +50,6 @@ Rectangle {
anchors.rightMargin: parent.width * 0.02 anchors.rightMargin: parent.width * 0.02
height: parent.height * 0.5 height: parent.height * 0.5
Button {
text: "Redeal"
onClicked: GameState.dealCards()
anchors.left: parent.left
anchors.verticalCenter: parent.verticalCenter
height: parent.height
}
Row { Row {
anchors.top: parent.top anchors.top: parent.top
height: parent.height height: parent.height

View file

@ -1,6 +1,7 @@
<!DOCTYPE RCC> <!DOCTYPE RCC>
<RCC version="1.0"> <RCC version="1.0">
<qresource> <qresource>
<file>../img/cards.svg</file>
<file>../img/flip_icon.svg</file> <file>../img/flip_icon.svg</file>
<file>../img/playing_cards/backs/abstract.svg</file> <file>../img/playing_cards/backs/abstract.svg</file>
<file>../img/playing_cards/backs/abstract_clouds.svg</file> <file>../img/playing_cards/backs/abstract_clouds.svg</file>