-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.py
141 lines (113 loc) · 4.45 KB
/
test.py
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
from kivy.app import App
from kivy.lang import Builder
from kivy.config import Config
Config.set('graphics', 'width', '800')
Config.set('graphics', 'height', '480')
root = Builder.load_string('''
#:import NoTransition kivy.uix.screenmanager.NoTransition
#:set spac 20
#:set pad_side 10
#:set pad_bot 30
#:set x_screen 480
#:set y_screen 800
#:set sp_act 100
#:set sp_nor 128
BoxLayout:
orientation: 'vertical'
canvas.before:
Color:
rgba: (1,1,1,1)
Rectangle:
pos: self.pos
size: self.size
source: './imagenes/background.jpg'
Color:
rgba: (0.25,0.25,0.25,0.65)
Rectangle:
pos: (0, x_screen - 30)
size: self.size
BoxLayout:
orientation: 'vertical'
ScreenManager:
transition: NoTransition()
id: sm
Screen:
name: 'game'
Label:
text: 'Game'
Screen:
name: 'settings'
Label:
text: 'Settings'
BoxLayout:
size_hint: (1, 0.35)
spacing: spac
padding: [pad_side, 0, pad_side, pad_bot]
CheckBox:
group: 'buttons'
text: ""
on_state: sm.current = 'game'
state: 'down'
allow_no_selection: False
canvas:
Color:
rgba: self.color
Rectangle:
source: './imagenes/B_1_inicio_normal.png'
size: (sp(sp_act), sp(sp_act)) if self.active else (sp(sp_nor), sp(sp_nor))
pos: (int(self.center_x - sp(sp_act // 2)), int(self.center_y - sp(sp_act // 2))) if self.active else (int(self.center_x - sp(sp_nor / 2)), int(self.center_y - sp(sp_nor / 2)))
CheckBox:
group: 'buttons'
text: ""
on_state: sm.current = 'settings'
allow_no_selection: False
canvas:
Color:
rgba: self.color
Rectangle:
source: './imagenes/B_2_control_normal.png'
size: (sp(sp_act), sp(sp_act)) if self.active else (sp(sp_nor), sp(sp_nor))
pos: (int(self.center_x - sp(sp_act // 2)), int(self.center_y - sp(sp_act // 2))) if self.active else (int(self.center_x - sp(sp_nor / 2)), int(self.center_y - sp(sp_nor / 2)))
CheckBox:
group: 'buttons'
text: ""
on_state: sm.current = 'settings'
allow_no_selection: False
canvas:
Color:
rgba: self.color
Rectangle:
source: './imagenes/B_3_herramientas.png'
size: (sp(sp_act), sp(sp_act)) if self.active else (sp(sp_nor), sp(sp_nor))
pos: (int(self.center_x - sp(sp_act // 2)), int(self.center_y - sp(sp_act // 2))) if self.active else (int(self.center_x - sp(sp_nor / 2)), int(self.center_y - sp(sp_nor / 2)))
CheckBox:
group: 'buttons'
text: ""
on_state: sm.current = 'settings'
allow_no_selection: False
canvas:
Color:
rgba: self.color
Rectangle:
source: './imagenes/B_4_archivos.png'
size: (sp(sp_act), sp(sp_act)) if self.active else (sp(sp_nor), sp(sp_nor))
pos: (int(self.center_x - sp(sp_act // 2)), int(self.center_y - sp(sp_act // 2))) if self.active else (int(self.center_x - sp(sp_nor / 2)), int(self.center_y - sp(sp_nor / 2)))
CheckBox:
group: 'buttons'
text: ""
on_state: sm.current = 'settings'
allow_no_selection: False
canvas:
Color:
rgba: self.color
Rectangle:
source: './imagenes/B_5_modo.png'
size: (sp(sp_act), sp(sp_act)) if self.active else (sp(sp_nor), sp(sp_nor))
pos: (int(self.center_x - sp(sp_act // 2)), int(self.center_y - sp(sp_act // 2))) if self.active else (int(self.center_x - sp(sp_nor / 2)), int(self.center_y - sp(sp_nor / 2)))
''')
class MyApp(App):
def build(self):
return root
def init_on_state(self):
self.sm.current = 'game'
MyApp().run()