diff options
Diffstat (limited to 'src/sliceitoff/status/status.py')
-rw-r--r-- | src/sliceitoff/status/status.py | 33 |
1 files changed, 8 insertions, 25 deletions
diff --git a/src/sliceitoff/status/status.py b/src/sliceitoff/status/status.py index 9b40955..a337a5b 100644 --- a/src/sliceitoff/status/status.py +++ b/src/sliceitoff/status/status.py @@ -4,24 +4,7 @@ import pygame from display import Scaling from images import Images, Fonts from stats import Stats - -class LetterSprite(pygame.sprite.Sprite): - def __init__(self, image, pos): - super().__init__() - self.image = image - self.rect = self.image.get_rect().move(pos) - -class TextGroup(pygame.sprite.Group): - def __init__(self, text, pos, size = 8_000, spacing = None, font = 'lcd'): - super().__init__() - if spacing == None: - spacing = size - for i in range(len(text)): - image = pygame.transform.scale_by( - Fonts.fonts[font].get(text[i]), - size/8 * Scaling.factor) - image_pos = Scaling.scale_to_display( (pos[0]+i*spacing, pos[1]) ) - self.add(LetterSprite(image, image_pos)) +from text import TextPage class Status(): def __init__(self): @@ -31,15 +14,15 @@ class Status(): """ Update sprites basis of dt. dt = milliseconds from last update """ score_str = ( - "{:02d}\x12 {:02d}\xfe {:02d}\x03 " - "{:02d}\x0e {:08d}\x0f").format( + "\x12{:1d} \x03{:1d} \x0e{:02d} \xfe{:02d} " + "\x0f{:08d}").format( Stats.level, - 99 if Stats.percent == 100 else int(Stats.percent), Stats.lives, Stats.bonus // 1000, + 99 if Stats.percent == 100 else int(Stats.percent), Stats.score) - self.sprites = TextGroup( + self.sprites = TextPage( score_str, - (0, 282_000), - size = 16_000, - font = '8x8') + pos = (0, 220_000), + size = (12_000, 0), + font = 'lcd') |