-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgameoflife-nontuio.kv
113 lines (95 loc) · 2.65 KB
/
gameoflife-nontuio.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
#:kivy 1.8.1
#:import evolve kivy_p2life.bindings.evolve
#:import Patterns kivy_p2life.constants.Patterns
#:import CellShape kivy_p2life.widgets
#:import PatternVisualisation kivy_p2life.widgets
#:include gameoflife-common.kv
<CellShape>:
size_hint: 0, 0
size: 75, 75
canvas:
Color:
rgba: [1, 1, 1, 1]
Rectangle:
pos: self.pos
size: self.size
# Taken from http://stackoverflow.com/questions/17674736/
<RotatedImage>:
canvas.before:
PushMatrix
Rotate:
angle: self.angle
axis: 0, 0, 1
origin: self.center
canvas.after:
PopMatrix
<PatternVisualisation>:
drag_distance: 10
<ButtonLayout@BoxLayout>:
size_hint: 0, 0
canvas:
Color:
rgba: [0.5, 0.5, 0.5, 1]
Rectangle:
pos: self.x - 5, self.y - 5
size: (self.width + 10), (self.height + 10)
CustomBoxLayout:
grid: grid
shapes: shapes
end_turn_button: end_turn_button
orientation: "vertical"
AnchorLayout:
size_hint: 1, 1
anchor_x: "left"
anchor_y: "top"
BoxLayout:
size_hint: 0, 0
size: self.parent.width, 50
PlayerUI:
id: white_ui
app: root.app
number: 1
PlayerUI:
id: black_ui
app: root.app
number: 2
AnchorLayout:
size_hint: 1, 1
anchor_x: "left"
anchor_y: "bottom"
GOLGrid:
id: grid
size_hint: 0, 0
player_uis: [white_ui, black_ui]
BoxLayout:
size_hint: 1, .2
AnchorLayout:
anchor_x: "left"
anchor_y: "bottom"
ButtonLayout:
id: shapes
size: 300, 75
CellShape:
pattern: Patterns.SQUARE
CellShape:
pattern: Patterns.DIAMOND
CellShape:
pattern: Patterns.OSCILLATOR
CellShape:
pattern: Patterns.GLIDER
AnchorLayout:
anchor_x: "right"
anchor_y: "bottom"
ButtonLayout:
orientation: "vertical"
size: 100, 100
Button:
id: end_turn_button
text: "End turn"
background_normal: ""
background_down: ""
# FIXME this button is for debugging only
Button:
id: next_button
text: "Next"
on_press: evolve(grid)