Example #1
0
    def get_surface(self):
        """Gets the SDL_Surface used by the Window to display 2D pixel
        data.

        Using this method will make the usage of GL operations, such
        as texture handling, or using SDL renderers impossible.
        """
        return sdlvideo.get_window_surface(self.window)
Example #2
0
 def test_get_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)
         sf = video.get_window_surface(window)
         self.assertIsInstance(sf, surface.SDL_Surface)
         video.destroy_window(window)
         self.assertRaises(sdl.SDLError, video.get_window_surface, window)
Example #3
0
 def __init__(self, window):
     """Creates a new SoftSpriteRenderer for a specific Window."""
     super(SoftwareSpriteRenderer, self).__init__()
     if isinstance(window, Window):
         self.window = window.window
     elif isinstance(window, video.SDL_Window):
         self.window = window
     else:
         raise TypeError("unsupported window type")
     self.surface = video.get_window_surface(self.window)
     self.componenttypes = (SoftwareSprite,)
Example #4
0
 def test_update_window_surface_rects(self):
     rectlist = [rect.SDL_Rect(), rect.SDL_Rect(10, 10, 10, 10),
                 rect.SDL_Rect(0, 0, 5, 4), rect.SDL_Rect(-5, -5, 6, 2)]
     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)
         self.assertRaises(sdl.SDLError, video.update_window_surface_rects,
                           window, rectlist)
         surface = video.get_window_surface(window)
         video.update_window_surface_rects(window, rectlist)
         video.destroy_window(window)