伊地知ニジカ放送局だぬ゛ん゛. https://www.youtube.com/@deerjika
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

69 lines
1.2 KiB

  1. from __future__ import annotations
  2. from abc import ABCMeta, abstractmethod
  3. import pygame
  4. def main (
  5. ) -> None:
  6. pygame.init ()
  7. game = Game ()
  8. while True:
  9. deerjika = Deerjika (game)
  10. class Game:
  11. def __init__ (
  12. self,
  13. ):
  14. self.screen = pygame.display.set_mode ((CWindow.WIDTH, CWindow.HEIGHT))
  15. self.clock = pygame.time.Clock ()
  16. class GameObject (metaclass = ABCMeta):
  17. def __init__ (
  18. self,
  19. game: Game,
  20. ):
  21. self.game = game
  22. self.redrawer.append (self.redraw)
  23. @abstractmethod
  24. def redraw (
  25. self,
  26. ) -> None:
  27. raise NotImplementedError ()
  28. class Deerjika (GameObject):
  29. def __init__ (
  30. self,
  31. game: Game,
  32. pattern: DeerjikaPattern = DeerjikaPattern.NORMAL,
  33. direction: Direction = Direction.LEFT,
  34. ):
  35. super ().__init__ (self)
  36. self.game = game
  37. self.pattern = pattern
  38. self.direction = direction
  39. class DeerjikaPattern (Enum):
  40. NORMAL = auto ()
  41. RELAXED = auto ()
  42. class Direction (Enum):
  43. LEFT = auto ()
  44. RIGHT = auto ()
  45. class CWindow:
  46. WIDTH = 1024
  47. HEIGHT = 768
  48. if __name__ == '__main__':
  49. main ()