diff options
Diffstat (limited to 'src/sliceitoff/status/status.py')
-rw-r--r-- | src/sliceitoff/status/status.py | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/src/sliceitoff/status/status.py b/src/sliceitoff/status/status.py index a337a5b..cacc84a 100644 --- a/src/sliceitoff/status/status.py +++ b/src/sliceitoff/status/status.py @@ -1,18 +1,16 @@ -import os import pygame -from display import Scaling -from images import Images, Fonts from stats import Stats from text import TextPage -class Status(): +class Status(pygame.sprite.Group): def __init__(self): - self.sprites = pygame.sprite.Group() + super().__init__() + self.old_srt = None - def update(self, dt): - """ Update sprites basis of dt. dt = milliseconds from last update """ - + def update(self, **kwargs): + """ Rebuilds statusline if needed """ + super().update(**kwargs) score_str = ( "\x12{:1d} \x03{:1d} \x0e{:02d} \xfe{:02d} " "\x0f{:08d}").format( @@ -21,8 +19,10 @@ class Status(): Stats.bonus // 1000, 99 if Stats.percent == 100 else int(Stats.percent), Stats.score) - self.sprites = TextPage( - score_str, - pos = (0, 220_000), - size = (12_000, 0), - font = 'lcd') + if self.old_srt != score_str: + self.empty() + self.add( TextPage( + score_str, + pos = (0, 220_000), + size = (12_000, 0), + font = 'lcd') ) |