本文整理汇总了Python中pygame.constants方法的典型用法代码示例。如果您正苦于以下问题:Python pygame.constants方法的具体用法?Python pygame.constants怎么用?Python pygame.constants使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pygame
的用法示例。
在下文中一共展示了pygame.constants方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: getActions
# 需要导入模块: import pygame [as 别名]
# 或者: from pygame import constants [as 别名]
def getActions(self):
"""
Gets the actions used within the game.
Returns
-------
list of `pygame.constants`
"""
return self.actions.values()
示例2: getActionSet
# 需要导入模块: import pygame [as 别名]
# 或者: from pygame import constants [as 别名]
def getActionSet(self):
"""
Gets the actions the game supports. Optionally inserts the NOOP
action if PLE has add_noop_action set to True.
Returns
--------
list of pygame.constants
The agent can simply select the index of the action
to perform.
"""
actions = self.game.actions
if (sys.version_info > (3, 0)): #python ver. 3
if isinstance(actions, dict) or isinstance(actions, dict_values):
actions = actions.values()
else:
if isinstance(actions, dict):
actions = actions.values()
actions = list(actions) #.values()
#print (actions)
#assert isinstance(actions, list), "actions is not a list"
if self.add_noop_action:
actions.append(self.NOOP)
return actions
示例3: get_keys_pressed
# 需要导入模块: import pygame [as 别名]
# 或者: from pygame import constants [as 别名]
def get_keys_pressed(self, screen_array, feedback, terminal):
"""
Called whenever the screen buffer is refreshed. returns the keys we want pressed in the next until the next
screen refresh
:param screen_array: 3d numpy.array of float. screen_width * screen_height * rgb
:param feedback: result of call to get_feedback
:param terminal: boolean, True if we have reached a terminal state, meaning the next frame will be a restart
:return: a list of the integer values of the keys we want pressed. See pygame.constants for values
"""
raise NotImplementedError("Please override this method")
示例4: __init__
# 需要导入模块: import pygame [as 别名]
# 或者: from pygame import constants [as 别名]
def __init__(self,_parent):
self.key_id_map = {}
self.key_name_map = {}
for name, value in vars(pygame.constants).items():
if name.startswith("K_"):
self.key_id_map[value] = name
self.key_name_map[name] = value
SubMenu.__init__(self,_parent)
self.menu_text = [spriteManager.TextSprite('','full Pack 2025',25,[255,255,255]),
spriteManager.TextSprite('Hold keys to bind multiple','full Pack 2025',15,[255,255,255]),
spriteManager.TextSprite('Press ','full Pack 2025',15,[255,255,255])]
self.menu_text[0].rect.center = (self._parent.settings['windowSize'][0] / 2,self._parent.settings['windowSize'][1] / 2)
self.menu_text[1].rect.center = (self._parent.settings['windowSize'][0] / 2,self._parent.settings['windowSize'][1] / 6)
self.menu_text[2].rect.center = (self._parent.settings['windowSize'][0] / 2,self._parent.settings['windowSize'][1] * 5 / 6)
self.status = 0