-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathadjustments.py
130 lines (103 loc) · 4.97 KB
/
adjustments.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
print('loading Adjustments')
import sprites as sp
import defaults as df
import pygame
import re
import time
import generic as gen
import var
import device
import buttons as btns
class AddScreen(gen.Xscreen):
def __init__(self):
gen.Xscreen.__init__(self)
self.background_file = var.assetsDir + 'backgrounds/maps_table.jpg'
self.enable_file = var.assetsDir + 'enabled.png'
self.disable_file = var.assetsDir + 'disabled.png'
self.buy_file = var.assetsDir + 'buy_yes.png'
self.back_txt = "Return/ Zuruck/ Atras"
self.music_enable_txt = "Enabled/ Aktiviert/ Activado"
self.music_disable_txt = "Disabled/ Deaktiviert/ Desactivado"
self.sound_disable_txt = "Disabled/ Deactiviert/ Desactivado"
self.sound_enable_txt = "Enabled/ Deactiviert/ Desactivado"
self.opt_txt = "Settings/ Auswahlen/ Configuracion"
self.music_txt = "Music/ Musik/ Musica"
self.sound_txt = "Sounds/ Klänge/ Sonidos"
self.text_info_y = df.display_height*0.8
self.header_position = (df.display_width * 0.1, 0)
self.font1.path = "assets/fonts/horrendo.ttf"
self.font1.font_size = 40
self.font1.set_font()
self.button_size = 50
self.music_text_x = df.display_width * 0.1
self.music_text_y = df.display_height * 0.2
self.sound_text_x = df.display_width * 0.1
self.sound_text_y = df.display_height * 0.3
self.music_button_x = df.display_width * 0.7
self.music_button_y = self.music_text_y
self.music_button2_x = df.display_width * 0.8
self.music_button2_y = self.music_text_y
self.sound_button_x = df.display_width * 0.7
self.sound_button_y = self.sound_text_y
self.sound_button2_x = df.display_width * 0.8
self.sound_button2_y = self.sound_text_y
self.exit_button_x = df.display_width * 0.5 - 100 * 0.5
self.exit_button_y = df.display_height * 0.8
def run(self):
mapsback = sp.Sprite2()
mapsback.file = self.background_file
mapsback.w = df.display_width
mapsback.h = df.display_height
mapsback.set_image()
mapsback.rect.x = 0
mapsback.rect.y = 0
btnEnableMusic = btns.Button(self.enable_file, self.music_button_x, self.music_button_y, self.button_size, self.button_size)
btnDisableMusic = btns.Button(self.disable_file, self.music_button2_x, self.music_button2_y, self.button_size,self.button_size)
btnEnableSound = btns.Button(self.enable_file, self.sound_button_x, self.sound_button_y, self.button_size,self.button_size)
btnDisableSound = btns.Button(self.disable_file, self.sound_button2_x, self.sound_button2_y, self.button_size,self.button_size)
exitBtn = btns.Button(self.buy_file, self.exit_button_x, self.exit_button_y, 100, 100)
btnEnableMusic.shadow_h = 50
btnDisableMusic.shadow_h = 50
btnEnableSound.shadow_h = 50
btnEnableSound.shadow_h = 50
exitBtn.shadow_h = 50
btnDisableMusic.hover_text = self.music_disable_txt
btnEnableMusic.hover_text = self.music_enable_txt
btnDisableSound.hover_text = self.sound_disable_txt
btnEnableSound.hover_text = self.sound_enable_txt
exitBtn.hover_text = self.back_txt
while not self.stopEngine:
for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.quit()
quit()
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_ESCAPE:
self.stopEngine = True
var.gameDisplay.fill(df.white)
self.draw_sprite2(mapsback)
if exitBtn.onClick(pygame.mouse):
self.stopEngine = True
time.sleep(0.1)
if btnDisableMusic.onClick(pygame.mouse):
device.audio.music_enabled = False
# device.audio.play_music()
self.playBackMusic()
time.sleep(0.1)
if btnEnableMusic.onClick(pygame.mouse):
device.audio.music_enabled = True
self.playBackMusic()
time.sleep(0.1)
if btnDisableSound.onClick(pygame.mouse):
device.audio.sound_enabled = False
# device.audio.play_music()
time.sleep(0.1)
if btnEnableSound.onClick(pygame.mouse):
device.audio.sound_enabled = True
# device.audio.play_music()
time.sleep(0.1)
self.message_display(self.opt_txt,self.header_position )
self.message_display(self.music_txt, (self.music_text_x, self.music_text_y))
self.message_display(self.sound_txt, (self.sound_text_x, self.sound_text_y))
pygame.display.update()
var.clock.tick(20)