def __init__(self, key_list=None):
"""
:param Union[list,None] key_list: the list of keys to be added right away to our keyboard_registry dict
"""
super().__init__()
# stores the keys that we would like to be registered as important
# - key: pygame keyboard code (e.g. pygame.K_ESCAPE, pygame.K_UP, etc..)
# - value: True if currently pressed, False otherwise
# - needs to be ticked in order to yield up-to-date information (this will be done by a GameLoop playing a Screen)
self.keyboard_registry = {}
self.descriptions = {}
if key_list is None:
key_list = ["up", "down", "left", "right"]
self.update_keys(key_list)
评论列表
文章目录