solitare/qml/DrawPile.qml
2024-12-06 05:08:58 +01:00

19 lines
523 B
QML

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")
}
}
}
}