当前位置: 首页>>代码示例>>Python>>正文


Python pygame.constants方法代码示例

本文整理汇总了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() 
开发者ID:ntasfi,项目名称:PyGame-Learning-Environment,代码行数:12,代码来源:pygamewrapper.py

示例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 
开发者ID:ntasfi,项目名称:PyGame-Learning-Environment,代码行数:32,代码来源:ple.py

示例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") 
开发者ID:DanielSlater,项目名称:PyGamePlayer,代码行数:13,代码来源:pygame_player.py

示例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 
开发者ID:digiholic,项目名称:universalSmashSystem,代码行数:17,代码来源:mainMenu.py


注:本文中的pygame.constants方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。