screen.py 567 B

123456789101112131415161718192021
  1. # -*- coding: utf-8 -*-
  2. import pygame
  3. from .container import Container
  4. class Screen(Container):
  5. def __init__(self, width=320, height=240, bg_color=(0, 0, 0), fps=30):
  6. # Create the actual screen first
  7. self._Screen = pygame.display.set_mode((width, height), 0, 32)
  8. self._Fps = fps
  9. super().__init__(x=0, y=0, width=width, height=height, bg_color=bg_color)
  10. def Draw(self):
  11. super().Draw()
  12. self._Screen.blit(self._Canvas, self._Rect)
  13. pygame.display.update()
  14. pygame.time.Clock().tick(self._Fps)