summaryrefslogtreecommitdiff
path: root/src/sliceitoff/status/status.py
diff options
context:
space:
mode:
authorViljami Ilola <+@hix.fi>2024-03-23 22:19:00 +0200
committerViljami Ilola <+@hix.fi>2024-03-23 22:19:00 +0200
commit98d91824cacec97c581ae0a4f1efd9fa3faa18ab (patch)
tree88396d13a6d8449968e305bae443d8f2c5b61cfb /src/sliceitoff/status/status.py
parent947df85053af2704ce1a17daf1fab13e273f0cc5 (diff)
player through SingleGroup
Diffstat (limited to 'src/sliceitoff/status/status.py')
-rw-r--r--src/sliceitoff/status/status.py26
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') )