Move DrawPile to it's own file
This commit is contained in:
parent
981d724ee4
commit
44318ac5ac
|
@ -24,6 +24,7 @@ qt_add_qml_module(appSolitare
|
||||||
QML_FILES CardModel.qml
|
QML_FILES CardModel.qml
|
||||||
QML_FILES Tableau.qml
|
QML_FILES Tableau.qml
|
||||||
QML_FILES ThrowawayPile.qml
|
QML_FILES ThrowawayPile.qml
|
||||||
|
QML_FILES DrawPile.qml
|
||||||
SOURCES playingcard.h playingcard.cpp
|
SOURCES playingcard.h playingcard.cpp
|
||||||
SOURCES gamestate.h gamestate.cpp
|
SOURCES gamestate.h gamestate.cpp
|
||||||
SOURCES columnslot.h columnslot.cpp
|
SOURCES columnslot.h columnslot.cpp
|
||||||
|
|
12
DrawPile.qml
Normal file
12
DrawPile.qml
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
import QtQuick
|
||||||
|
|
||||||
|
// 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: {
|
||||||
|
GameState.drawNextCard()
|
||||||
|
}
|
||||||
|
}
|
10
Main.qml
10
Main.qml
|
@ -55,15 +55,7 @@ ApplicationWindow {
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
|
|
||||||
ThrowawayPile {}
|
ThrowawayPile {}
|
||||||
|
DrawPile {}
|
||||||
// Draw pile (only the top card is shown)
|
|
||||||
CardModel {
|
|
||||||
card: GameState.drawPile.length > 0 ? GameState.drawPile[GameState.drawPile.length - 1] : null
|
|
||||||
isFaceDown: GameState.drawPile.length > 0 ? true : false
|
|
||||||
onClicked: {
|
|
||||||
GameState.drawNextCard()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue