blob: 976661a2b1b2715615a89d31ab38f007e4c52323 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
|
import Qt 4.6
import Scxml 1.0
Rectangle {
color: "white"
width: 400
height: 300
Scxml {
id: controller
source: "blackjack.scxml"
}
Text {
id: welcomeText
text: "Blackjack"
font.pixelSize: 24
states: [
State {
name: "placeBets"
when: controller.current.waitForBet
PropertyChanges {
target: welcomeText
text: "Please place your bet"
}
},
State {
name: "game"
when: controller.current.game
PropertyChanges {
target: welcomeText
text: "Welcome"
}
}
]
}
Rectangle {
color: "white"
x: 100
y: 100
Text {
color: "blue"
text: "You have " + controller.data.points + " points"
}
}
Rectangle {
color: "white"
id: betEditBg
x: 80
y: 400
width: 100
height: 20
TextInput {
id: betEdit
color: "black"
anchors.fill: parent
text: controller.data.pointsToBet
}
states: [
State {
name: "placeBets"
when: controller.current.waitForBet
PropertyChanges {
target: betEditBg
color: "#ffcc33"
opacity: 1
}
},
State {
name: "default"
when: !controller.current.waitForBet
PropertyChanges {
target: betEditBg
opacity: 0
}
}
]
}
Rectangle {
anchors.left: betEditBg.right
anchors.top: betEditBg.top
anchors.bottom: betEditBg.bottom
width: 100
color: "blue"
MouseRegion {
anchors.fill: parent
onClicked: { controller.events.bet.raise(); }
}
Text {
color: "yellow"
text: "Bet"
}
}
}
|