-
Notifications
You must be signed in to change notification settings - Fork 6
/
main.kv
323 lines (311 loc) · 9.5 KB
/
main.kv
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
#:import Window kivy.core.window.Window
#:import FadeTransition kivy.uix.screenmanager.FadeTransition
<BG>:
orientation: "vertical"
Image:
id: bg
source: 'assets/images/bg.png'
<Main_Card>:
canvas:
Color:
rgba: (0.576, 0.721, 0.411, 0.25)
RoundedRectangle:
pos: Window.size[0]*0.0694, Window.size[1]*0.2578
size: Window.size[0]*0.861, Window.size[1]*0.4843
radius: [22]
<Button_Card>:
button_text: ""
canvas:
Color:
rgba: (0.5764, 0.7215, 0.4117, 0.5)
RoundedRectangle:
pos: 0, 0
size: Window.size[0], Window.size[1]*0.1171
radius: [22,22,0,0]
Label:
text: root.button_text
markup: True
pos_hint: {'center_x': 0.5, 'center_y':0.0585}
size_hint_x: None
font_name: "Marvel-Bold"
color: (0.337, 0.564, 0.58, 0.5)
font_size: Window.size[0]*0.133
<Lose_Screen>:
BG:
FloatLayout:
orientation: "vertical"
Main_Card:
Button_Card:
button_text: "BACK"
Label:
text: "Tic - Tac - Toe"
markup: True
pos_hint: {'center_x': 0.5, 'center_y':0.882}
size_hint_x: None
font_name: "Marvel-Bold"
color: (0.917, 0.929, 0.901, 0.75)
font_size: Window.size[0]*0.133
Label:
text: "YOU LOST!"
markup: True
pos_hint: {'center_x': 0.5, 'center_y':0.5}
size_hint_x: None
font_name: "Marvel-Bold"
color: (0.337, 0.564, 0.58, 1)
font_size: Window.size[0]*0.2
<Win_Screen>:
BG:
FloatLayout:
orientation: "vertical"
Main_Card:
Button_Card:
button_text: "BACK"
Label:
text: "Tic - Tac - Toe"
markup: True
pos_hint: {'center_x': 0.5, 'center_y':0.882}
size_hint_x: None
font_name: "Marvel-Bold"
color: (0.917, 0.929, 0.901, 0.75)
font_size: Window.size[0]*0.133
Label:
text: "YOU WON!"
markup: True
pos_hint: {'center_x': 0.5, 'center_y':0.5}
size_hint_x: None
font_name: "Marvel-Bold"
color: (0.337, 0.564, 0.58, 1)
font_size: Window.size[0]*0.2
<Tie_Screen>:
BG:
FloatLayout:
orientation: "vertical"
Main_Card:
Button_Card:
button_text: "BACK"
Label:
text: "Tic - Tac - Toe"
markup: True
pos_hint: {'center_x': 0.5, 'center_y':0.882}
size_hint_x: None
font_name: "Marvel-Bold"
color: (0.917, 0.929, 0.901, 0.75)
font_size: Window.size[0]*0.133
Label:
text: "GAME TIED!"
markup: True
pos_hint: {'center_x': 0.5, 'center_y':0.5}
size_hint_x: None
font_name: "Marvel-Bold"
color: (0.337, 0.564, 0.58, 1)
font_size: Window.size[0]*0.2
<Main_Screen>:
float_layout: float_layout
x_1: x_1
x_2: x_2
x_3: x_3
x_4: x_4
x_5: x_5
x_6: x_6
x_7: x_7
x_8: x_8
x_9: x_9
o_1: o_1
o_2: o_2
o_3: o_3
o_4: o_4
o_5: o_5
o_6: o_6
o_7: o_7
o_8: o_8
o_9: o_9
BG:
FloatLayout:
id: float_layout
orientation: "vertical"
Main_Card:
Button_Card:
button_text: "RESET"
Label:
text: "Tic - Tac - Toe"
markup: True
pos_hint: {'center_x': 0.5, 'center_y':0.882}
size_hint_x: None
font_name: "Marvel-Bold"
color: (0.917, 0.929, 0.901, 0.75)
font_size: Window.size[0]*0.133
Image:
id: grid
source: 'assets/images/grid.png'
allow_stretch: True
keep_ratio: True
size_hint_y: None
size_hint_x: None
width: Window.size[0]*0.8
height: Window.size[1]*0.8
pos: Window.size[0]*0.1, Window.size[1]*0.1
Image:
id: x_1
source: 'assets/images/x.png'
size_hint_x: None
width: Window.size[0]*0.2
pos_hint: {'center_x':0.25, 'center_y': 0.64}
opacity: 1 if app.board[1]== "X" else 0
Image:
id: x_2
source: 'assets/images/x.png'
size_hint_x: None
width: Window.size[0]*0.2
pos_hint: {'center_x':0.5, 'center_y': 0.64}
opacity: 1 if app.board[2]== "X" else 0
Image:
id: x_3
source: 'assets/images/x.png'
size_hint_x: None
width: Window.size[0]*0.2
pos_hint: {'center_x':0.75, 'center_y': 0.64}
opacity: 1 if app.board[3]== "X" else 0
Image:
id: x_4
source: 'assets/images/x.png'
size_hint_x: None
width: Window.size[0]*0.2
pos_hint: {'center_x':0.25, 'center_y': 0.5}
opacity: 1 if app.board[4]== "X" else 0
Image:
id: x_5
source: 'assets/images/x.png'
size_hint_x: None
width: Window.size[0]*0.2
pos_hint: {'center_x':0.5, 'center_y': 0.5}
opacity: 1 if app.board[5]== "X" else 0
Image:
id: x_6
source: 'assets/images/x.png'
size_hint_x: None
width: Window.size[0]*0.2
pos_hint: {'center_x':0.75, 'center_y': 0.5}
opacity: 1 if app.board[6]== "X" else 0
Image:
id: x_7
source: 'assets/images/x.png'
size_hint_x: None
width: Window.size[0]*0.2
pos_hint: {'center_x':0.25, 'center_y': 0.36}
opacity: 1 if app.board[7]== "X" else 0
Image:
id: x_8
source: 'assets/images/x.png'
size_hint_x: None
width: Window.size[0]*0.2
pos_hint: {'center_x':0.5, 'center_y': 0.36}
opacity: 1 if app.board[8]== "X" else 0
Image:
id: x_9
source: 'assets/images/x.png'
size_hint_x: None
width: Window.size[0]*0.2
pos_hint: {'center_x':0.75, 'center_y': 0.36}
opacity: 1 if app.board[9]== "X" else 0
Image:
id: o_1
source: 'assets/images/o.png'
size_hint_x: None
width: Window.size[0]*0.2
pos_hint: {'center_x':0.25, 'center_y': 0.64}
opacity: 1 if app.board[1]== "O" else 0
Image:
id: o_2
source: 'assets/images/o.png'
size_hint_x: None
width: Window.size[0]*0.2
pos_hint: {'center_x':0.5, 'center_y': 0.64}
opacity: 1 if app.board[2]== "O" else 0
Image:
id: o_3
source: 'assets/images/o.png'
size_hint_x: None
width: Window.size[0]*0.2
pos_hint: {'center_x':0.75, 'center_y': 0.64}
opacity: 1 if app.board[3]== "O" else 0
Image:
id: o_4
source: 'assets/images/o.png'
size_hint_x: None
width: Window.size[0]*0.2
pos_hint: {'center_x':0.25, 'center_y': 0.5}
opacity: 1 if app.board[4]== "O" else 0
Image:
id: o_5
source: 'assets/images/o.png'
size_hint_x: None
width: Window.size[0]*0.2
pos_hint: {'center_x':0.5, 'center_y': 0.5}
opacity: 1 if app.board[5]== "O" else 0
Image:
id: o_6
source: 'assets/images/o.png'
size_hint_x: None
width: Window.size[0]*0.2
pos_hint: {'center_x':0.75, 'center_y': 0.5}
opacity: 1 if app.board[6]== "O" else 0
Image:
id: o_7
source: 'assets/images/o.png'
size_hint_x: None
width: Window.size[0]*0.2
pos_hint: {'center_x':0.25, 'center_y': 0.36}
opacity: 1 if app.board[7]== "O" else 0
Image:
id: o_8
source: 'assets/images/o.png'
size_hint_x: None
width: Window.size[0]*0.2
pos_hint: {'center_x':0.5, 'center_y': 0.36}
opacity: 1 if app.board[8]== "O" else 0
Image:
id: o_9
source: 'assets/images/o.png'
size_hint_x: None
width: Window.size[0]*0.2
pos_hint: {'center_x':0.75, 'center_y': 0.36}
opacity: 1 if app.board[9]== "O" else 0
<Intro_Screen>:
BG:
FloatLayout:
orientation: "vertical"
Main_Card:
Button_Card:
button_text: "START!"
Label:
text: "Tic-Tac-Toe"
markup: True
pos_hint: {'center_x': 0.5, 'center_y':0.5}
size_hint_x: None
font_name: "Marvel-Bold"
color: (0.337, 0.564, 0.58, 1)
font_size: Window.size[0]*0.2
<Main_Manager>:
id: screen_manager
transition: FadeTransition(duration=.1)
Intro_Screen:
id: lose_screen
manager: screen_manager
name: "intro"
Main_Screen:
id: main_screen
manager: screen_manager
name: "main"
Win_Screen:
id: win_screen
manager: screen_manager
name: "win"
Lose_Screen:
id: lose_screen
manager: screen_manager
name: "lose"
Tie_Screen:
id: lose_screen
manager: screen_manager
name: "tie"
Main_Manager: