Python pygame 模块,K_HOME 实例源码

我们从Python开源项目中,提取了以下7个代码示例,用于说明如何使用pygame.K_HOME

项目:third_person_im    作者:bstadie    | 项目源码 | 文件源码
def CheckKeys(self):
        """
        Check the keys that are evaluated on every main loop iteration.
        I.e., they aren't just evaluated when first pressed down
        """

        pygame.event.pump()
        self.keys = keys = pygame.key.get_pressed()
        if keys[pygame.K_LEFT]:
            self.viewCenter -= (0.5, 0)
        elif keys[pygame.K_RIGHT]:
            self.viewCenter += (0.5, 0)

        if keys[pygame.K_UP]:
            self.viewCenter += (0, 0.5)
        elif keys[pygame.K_DOWN]:
            self.viewCenter -= (0, 0.5)

        if keys[pygame.K_HOME]:
            self.viewZoom = 1.0
            self.viewCenter = (0.0, 20.0)
项目:rllabplusplus    作者:shaneshixiang    | 项目源码 | 文件源码
def CheckKeys(self):
        """
        Check the keys that are evaluated on every main loop iteration.
        I.e., they aren't just evaluated when first pressed down
        """

        pygame.event.pump()
        self.keys = keys = pygame.key.get_pressed()
        if keys[pygame.K_LEFT]:
            self.viewCenter -= (0.5, 0)
        elif keys[pygame.K_RIGHT]:
            self.viewCenter += (0.5, 0)

        if keys[pygame.K_UP]:
            self.viewCenter += (0, 0.5)
        elif keys[pygame.K_DOWN]:
            self.viewCenter -= (0, 0.5)

        if keys[pygame.K_HOME]:
            self.viewZoom = 1.0
            self.viewCenter = (0.0, 20.0)
项目:gail-driver    作者:sisl    | 项目源码 | 文件源码
def CheckKeys(self):
        """
        Check the keys that are evaluated on every main loop iteration.
        I.e., they aren't just evaluated when first pressed down
        """

        pygame.event.pump()
        self.keys = keys = pygame.key.get_pressed()
        if keys[pygame.K_LEFT]:
            self.viewCenter -= (0.5, 0)
        elif keys[pygame.K_RIGHT]:
            self.viewCenter += (0.5, 0)

        if keys[pygame.K_UP]:
            self.viewCenter += (0, 0.5)
        elif keys[pygame.K_DOWN]:
            self.viewCenter -= (0, 0.5)

        if keys[pygame.K_HOME]:
            self.viewZoom = 1.0
            self.viewCenter = (0.0, 20.0)
项目:pyimgui    作者:swistakm    | 项目源码 | 文件源码
def _map_keys(self):
        key_map = self.io.key_map

        key_map[imgui.KEY_TAB] = pygame.K_TAB
        key_map[imgui.KEY_LEFT_ARROW] = pygame.K_LEFT
        key_map[imgui.KEY_RIGHT_ARROW] = pygame.K_RIGHT
        key_map[imgui.KEY_UP_ARROW] = pygame.K_UP
        key_map[imgui.KEY_DOWN_ARROW] = pygame.K_DOWN
        key_map[imgui.KEY_PAGE_UP] = pygame.K_PAGEUP
        key_map[imgui.KEY_PAGE_DOWN] = pygame.K_PAGEDOWN
        key_map[imgui.KEY_HOME] = pygame.K_HOME
        key_map[imgui.KEY_END] = pygame.K_END
        key_map[imgui.KEY_DELETE] = pygame.K_DELETE
        key_map[imgui.KEY_BACKSPACE] = pygame.K_BACKSPACE
        key_map[imgui.KEY_ENTER] = pygame.K_RETURN
        key_map[imgui.KEY_ESCAPE] = pygame.K_ESCAPE
        key_map[imgui.KEY_A] = pygame.K_a
        key_map[imgui.KEY_C] = pygame.K_c
        key_map[imgui.KEY_V] = pygame.K_v
        key_map[imgui.KEY_X] = pygame.K_x
        key_map[imgui.KEY_Y] = pygame.K_y
        key_map[imgui.KEY_Z] = pygame.K_z
项目:rllab    作者:rll    | 项目源码 | 文件源码
def CheckKeys(self):
        """
        Check the keys that are evaluated on every main loop iteration.
        I.e., they aren't just evaluated when first pressed down
        """

        pygame.event.pump()
        self.keys = keys = pygame.key.get_pressed()
        if keys[pygame.K_LEFT]:
            self.viewCenter -= (0.5, 0)
        elif keys[pygame.K_RIGHT]:
            self.viewCenter += (0.5, 0)

        if keys[pygame.K_UP]:
            self.viewCenter += (0, 0.5)
        elif keys[pygame.K_DOWN]:
            self.viewCenter -= (0, 0.5)

        if keys[pygame.K_HOME]:
            self.viewZoom = 1.0
            self.viewCenter = (0.0, 20.0)
项目:maml_rl    作者:cbfinn    | 项目源码 | 文件源码
def CheckKeys(self):
        """
        Check the keys that are evaluated on every main loop iteration.
        I.e., they aren't just evaluated when first pressed down
        """

        pygame.event.pump()
        self.keys = keys = pygame.key.get_pressed()
        if keys[pygame.K_LEFT]:
            self.viewCenter -= (0.5, 0)
        elif keys[pygame.K_RIGHT]:
            self.viewCenter += (0.5, 0)

        if keys[pygame.K_UP]:
            self.viewCenter += (0, 0.5)
        elif keys[pygame.K_DOWN]:
            self.viewCenter -= (0, 0.5)

        if keys[pygame.K_HOME]:
            self.viewZoom = 1.0
            self.viewCenter = (0.0, 20.0)
项目:sftext    作者:LukeMS    | 项目源码 | 文件源码
def on_key_press(self, event):
        if event.type == pygame.KEYDOWN and event.key == pygame.K_UP:
            self.scroll(50)
        elif event.type == pygame.KEYDOWN and event.key == pygame.K_PAGEUP:
            self.scroll(500)
        elif event.type == pygame.KEYDOWN and event.key == pygame.K_HOME:
            self.scroll('home')

        elif event.type == pygame.KEYDOWN and event.key == pygame.K_DOWN:
            self.scroll(-50)
        elif event.type == pygame.KEYDOWN and event.key == pygame.K_PAGEDOWN:
            self.scroll(-500)
        elif event.type == pygame.KEYDOWN and event.key == pygame.K_END:
            self.scroll('end')