-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgeneric.py
60 lines (44 loc) · 1.64 KB
/
generic.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
import pygame
import var
import text as txg
import defaults as df
import device
print('Loading Xscreen')
class Xscreen():
def __init__(self):
self.stopEngine = False
self.musicBack = []
self.font1 = txg.TextGame()
self.font1.font_size = 20
self.font1.path = "assets/fonts/OpenSans-Light.ttf"
self.font1.set_font()
self.backMusicFile = var.assetsDir + 'sounds/439380__nightwolfcfm__cyclope-chase-action-drums.ogg'
def loadMusic(self):
self.backMusic = pygame.mixer.music.load(self.backMusicFile)
pygame.mixer.music.set_volume(0.5)
def playBackMusic(self):
if device.audio.music_enabled:
# print('device:music enabled')
if pygame.mixer.music.get_busy():
pygame.mixer.stop()
pygame.mixer.music.play(-1)
else:
print('device:music disabled')
pygame.mixer.music.pause()
pygame.mixer.music.stop()
def draw_sprite2(self, sprite):
var.gameDisplay.blit(sprite.image, (sprite.rect.x, sprite.rect.y))
def message_display(self, text, center):
self.font1.center = center
self.font1.display_text(text)
# label = self.font.render(text, 1, color)
# var.gameDisplay.blit(label, center)
def draw_selected(self, pos, dim, alpha, color):
s = pygame.Surface(dim)
s.set_alpha(alpha)
s.fill(color)
var.gameDisplay.blit(s, pos)
def run(self):
while not self.stopEngine:
print('running empty engine')
self.stopEngine = True