Update applications/cards/cards.ring - use the main() function
load "guilib.ring"
+oGame = NULL
+
+func main
+
oApp = new qApp
oPic = new QPixmap(AppFile("cards.jpg"))
@@ -25,8 +29,13 @@ next
nPlayer1Score = 0 nPlayer2Score=0
do
- oGame = new Game
- oGame.Start()
+ oGame = new Game {
+ loadGame(oApp,oPic,oPic2,Player1EatPic,Player2EatPic,
+ aGameCards,aGameValues,nPlayer1Score,nPlayer2Score)
+ Start()
+ }
+ nPlayer1Score = oGame.nPlayer1Score
+ nPlayer2Score = oGame.nPlayer2Score
again oGame.lnewgame
oPic.delete()
@@ -48,6 +57,9 @@ class Game
nScale = 1
ok
+ oApp oPic oPic2 Player1EatPic Player2EatPic aGameCards aGameValues
+ nPlayer1Score nPlayer2Score
+
win1 layout1 label1 label2 layout2 layout3 aBtns aBtns2
aCards nRole=1 aStatus = list(nCardsCount) aStatus2 = aStatus
aValues aStatusValues = aStatus aStatusValues2 = aStatus
@@ -55,6 +67,12 @@ class Game
nDelayEat = 0.5
nDelayNewGame = 1
+ func loadgame p1,p2,p3,p4,p5,p6,p7,p8,p9
+ oApp=p1 oPic=p2 oPic2=p3
+ Player1EatPic=p4 Player2EatPic=p5
+ aGameCards=p6 aGameValues=p7
+ nPlayer1Score=p8 nPlayer2Score=p9
+
func start
win1 = new qWidget() {
@@ -66,7 +84,7 @@ class Game
layout1 = new qvboxlayout()
label1 = new qlabel(win1) {
- settext("Player (1) - Score : " + nPlayer1Score)
+ settext("Player (1) - Score : " + this.nPlayer1Score)
setalignment(Qt_AlignHCenter | Qt_AlignVCenter)
setstylesheet("color: White; background-color: Purple;
font-size:20pt")
@@ -110,7 +128,7 @@ class Game
layout1.addlayout(layout2)
label2 = new qlabel(win1) {
- settext("Player (2) - Score : " + nPlayer2Score)
+ settext("Player (2) - Score : " + this.nPlayer2Score)
setalignment(Qt_AlignHCenter | Qt_AlignVCenter)
setstylesheet("color: white; background-color: red;
font-size:20pt")
