2025-04-02 21:27:14 +02:00
|
|
|
from .fonts import *
|
|
|
|
|
from .colors import *
|
2025-04-02 22:59:01 +02:00
|
|
|
import pygame
|
|
|
|
|
import math
|
|
|
|
|
|
|
|
|
|
MAX_COUNT = 9
|
2025-04-02 21:27:14 +02:00
|
|
|
|
|
|
|
|
class Athmos:
|
|
|
|
|
|
|
|
|
|
def __init__(self, screen):
|
2025-04-02 22:59:01 +02:00
|
|
|
self.index = 0
|
|
|
|
|
self.filenames = []
|
2025-04-02 21:27:14 +02:00
|
|
|
self.screen = screen
|
2025-04-02 22:59:01 +02:00
|
|
|
self.show_list = True
|
|
|
|
|
self.surface = pygame.Surface((self.screen.get_width()/3, self.get_display_count()*40), pygame.SRCALPHA)
|
|
|
|
|
|
|
|
|
|
def get_display_count(self):
|
|
|
|
|
return min(MAX_COUNT, len(self.filenames))
|
2025-04-02 21:27:14 +02:00
|
|
|
|
|
|
|
|
def update(self):
|
2025-04-02 22:59:01 +02:00
|
|
|
if self.show_list:
|
|
|
|
|
for i in range(self.get_display_count()):
|
|
|
|
|
text = self.filenames[(i-self.index-math.floor(self.get_display_count()/2))%len(self.filenames)]
|
|
|
|
|
# opacity = math.floor(i * 2 * 255 / MAX_COUNT if i < MAX_COUNT/2 else 255 - i * 2 * 255 / MAX_COUNT)
|
|
|
|
|
if i == math.floor(self.get_display_count()/2):
|
|
|
|
|
text_surface = font_helvetica16.render(text, False, "black", color_primary_light)
|
|
|
|
|
else:
|
|
|
|
|
text_surface = font_helvetica16.render(text, False, color_primary_light)
|
|
|
|
|
# name.set_alpha(opacity)
|
|
|
|
|
self.surface.blit(text_surface, ((0, self.surface.get_height()/self.get_display_count()*i)))
|
|
|
|
|
|
|
|
|
|
self.screen.blit(self.surface, ((self.screen.get_width() - self.surface.get_width())/2,
|
|
|
|
|
(self.screen.get_height() - self.surface.get_height())/2))
|