import os import pygame from stats import Stats from .scaling import Scaling DEBUG = os.getenv("DEBUG") class Display(): def __init__(self): pygame.display.init() mode_info = pygame.display.Info() self.screen = pygame.display.set_mode( (mode_info.current_w, mode_info.current_h), pygame.FULLSCREEN | pygame.SCALED, vsync = 1 ) Scaling.update_scaling(self.screen.get_size()) self.screen.fill(Stats.bordercolor) if DEBUG: print( "DISPLAY: \n" f" {Scaling.active = }\n" f" {Scaling.borders = }\n" f" {Scaling.factor = }\n") def update(self, groups = None): """ Updates the screen: clear, blit gropus and flip """ self.screen.fill(Stats.bgcolor, rect=Scaling.active) #(g.draw(self.screen) for g in groups if g) for group in groups: group.draw(self.screen) self.screen.fill(Stats.bordercolor, rect=Scaling.borders[0]) self.screen.fill(Stats.bordercolor, rect=Scaling.borders[1]) pygame.display.flip() def __del__(self): pygame.display.quit()