當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。