コード例 #1
0
ファイル: sprite.py プロジェクト: gdos/pgreloaded
    def render(self, sprites, x=None, y=None):
        """Draws the passed sprites (or sprite) on the Window's surface.

        x and y are optional arguments that can be used as relative
        drawing location for sprites. If set to None, the location
        information of the sprites are used. If set and sprites is an
        iterable, such as a list of SoftwareSprite objects, x and y are relative
        location values that will be added to each individual sprite's
        position. If sprites is a single SoftwareSprite, x and y denote the
        absolute position of the SoftwareSprite, if set.
        """
        r = SDL_Rect(0, 0, 0, 0)
        if isiterable(sprites):
            blit_surface = sdlsurface.blit_surface
            surface = self.surface
            x = x or 0
            y = y or 0
            for sp in sprites:
                r.x = x + sp.x
                r.y = y + sp.y
                blit_surface(sp.surface, None, surface, r)
        else:
            r.x = x or sprites.x
            r.y = y or sprites.y
            sdlsurface.blit_surface(sprites.surface, None, self.surface, r)
        video.update_window_surface(self.window)
コード例 #2
0
ファイル: window.py プロジェクト: gdos/pgreloaded
    def refresh(self):
        """Refreshes the entire window surface.

        This only needs to be called, if a SDL_Surface was acquired via
        get_surface() and is used to display contents.
        """
        sdlvideo.update_window_surface(self.window)
コード例 #3
0
ファイル: sdl_video_test.py プロジェクト: gdos/pgreloaded
 def test_update_window_surface(self):
     flags = (video.SDL_WINDOW_BORDERLESS,
              video.SDL_WINDOW_BORDERLESS | video.SDL_WINDOW_HIDDEN,
              video.SDL_WINDOW_RESIZABLE | video.SDL_WINDOW_MINIMIZED)
     for flag in flags:
         window = video.create_window("Test", 200, 200, 200, 200, flag)
         video.update_window_surface(window)
         video.destroy_window(window)