-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmenu.py
31 lines (25 loc) · 837 Bytes
/
menu.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import pygame
from loguru import logger
from game import Bomberdude
class MainView:
def __init__(self, screen, name, title, args):
self.screen = screen
self.name = name
self.title = title
self.args = args
self.game = Bomberdude(args)
def update(self):
self.game.update()
def draw(self):
self.game.on_draw()
def on_key_press(self, key):
# key = pygame.key.get_pressed()
logger.info(f'key={key}')
self.game.on_key_press(key)
def on_key_release(self, key):
logger.debug(f'key={key}')
self.game.on_key_release(key)
def on_mouse_motion(self, x: int, y: int, dx: int, dy: int):
self.game.on_mouse_motion(x, y, dx, dy)
def on_mouse_press(self, x, y, button):
self.game.on_mouse_press(x, y, button)