-
Notifications
You must be signed in to change notification settings - Fork 0
/
SquareDanceSList.py
60 lines (42 loc) · 1.64 KB
/
SquareDanceSList.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 os, sys
import pygame
#this is a class that contains Styles and allows for transitions of
#styles throughout the game.
class SquareDanceSList:
def __init__(self):
self.styleList = []
self.tillNextStyle = 10000
self.fadeStyle = ''
self.stylePlace = 0
def add_style(self, style):
self.styleList.append(style)
return True
def get_current_style(self):
return self.styleList[self.stylePlace]
def get_next_style(self):
self.stylePlace += 1
self.stylePlace = self.stylePlace%len(self.styleList)
return self.styleList[self.stylePlace]
def is_transition(self, msDelta):
self.tillNextStyle -= msDelta
if self.tillNextStyle < 0:
self.tillNextStyle = 10000
self.fadeStyle = self.styleList[self.stylePlace]
return True
else:
return False
def get_fade_surface(self, model):
width = model.get_width()
height = model.get_height()
fadeSurface = pygame.Surface((width, height))
self.fadeStyle.set_surface(fadeSurface)
highlights = model.get_highlights()
sequential = model.get_sequential()
pMap = model.get_position_map()
self.fadeStyle.render_background()
self.fadeStyle.render_map(model)
self.fadeStyle.render_highlights(highlights)
self.fadeStyle.render_sequential_highlights(sequential, pMap)
fadeSurface = pygame.transform.smoothscale(fadeSurface, (int(width*0.5),int(height*0.5)))
fadeSurface = pygame.transform.smoothscale(fadeSurface, (width, height))
return fadeSurface