pass blend mode flags to sprite update method
This commit is contained in:
parent
1910fa567a
commit
ebe0bad311
|
@ -228,7 +228,7 @@ class Sprite(Animation):
|
|||
def is_stepping(self):
|
||||
return bool(self._step)
|
||||
|
||||
def update(self, areas=None, substitute=None):
|
||||
def update(self, areas=None, substitute=None, flags=0):
|
||||
Animation.update(self)
|
||||
if self.is_stepping():
|
||||
self.move(self._step.dx, self._step.dy)
|
||||
|
@ -236,13 +236,13 @@ class Sprite(Animation):
|
|||
self.move(*get_step(self.location.center, neighbor.location.center,
|
||||
neighbor.mass))
|
||||
if self.get_current_frameset().length():
|
||||
self.draw(areas, substitute)
|
||||
self.draw(areas, substitute, flags)
|
||||
# for location in self.locations:
|
||||
# location.update()
|
||||
|
||||
def draw(self, areas=None, substitute=None):
|
||||
def draw(self, areas=None, substitute=None, flags=0):
|
||||
for location in self.locations:
|
||||
location.fader.draw(areas, substitute)
|
||||
location.fader.draw(areas, substitute, flags)
|
||||
|
||||
|
||||
class Location(Rect):
|
||||
|
@ -345,7 +345,7 @@ class Fader(Surface):
|
|||
self.start_time = self.time_filter.get_ticks()
|
||||
self.fading_out = out
|
||||
|
||||
def draw(self, areas=None, substitute=None):
|
||||
def draw(self, areas=None, substitute=None, flags=0):
|
||||
sprite = self.location.sprite
|
||||
if substitute is None:
|
||||
frame = sprite.get_current_frame()
|
||||
|
@ -368,17 +368,17 @@ class Fader(Surface):
|
|||
if a:
|
||||
color.hsla = h, s, l, int(a * ratio)
|
||||
pixels[x][y] = color
|
||||
self.blit_to_display(pixels.make_surface(), areas)
|
||||
self.blit_to_display(pixels.make_surface(), areas, flags)
|
||||
del pixels
|
||||
else:
|
||||
self.blit_to_display(self, areas)
|
||||
self.blit_to_display(self, areas, flags)
|
||||
elif self.fade_remaining is None or self.get_alpha() >= sprite.alpha:
|
||||
if self.fade_remaining is not None and self.fade_remaining >= 0:
|
||||
self.update_alpha()
|
||||
if not self.location.is_hidden():
|
||||
self.blit_to_display(frame, areas)
|
||||
self.blit_to_display(frame, areas, flags)
|
||||
|
||||
def blit_to_display(self, frame, areas=None):
|
||||
def blit_to_display(self, frame, areas=None, flags=0):
|
||||
if not isinstance(areas, list):
|
||||
areas = [areas]
|
||||
for area in areas:
|
||||
|
@ -387,7 +387,7 @@ class Fader(Surface):
|
|||
area.top + self.location.top
|
||||
else:
|
||||
dest = self.location
|
||||
self.location.sprite.display_surface.blit(frame, dest, area)
|
||||
self.location.sprite.display_surface.blit(frame, dest, area, flags)
|
||||
|
||||
def update_alpha(self):
|
||||
remaining = self.fade_remaining = self.fade_length - \
|
||||
|
|
Loading…
Reference in New Issue