1. Marcus von Appen
  2. py-sdl2

Commits

David Farler  committed 964dec2

Add logical_size property to sdl2.ext.Renderer

  • Participants
  • Parent commits fbd98b8
  • Branches default

Comments (0)

Files changed (1)

File sdl2/ext/sprite.py

View file
         self.rendertarget = None
 
     @property
+    def logical_size(self):
+        """The logical pixel size of the Renderer"""
+        w, h = c_int(), c_int()
+        render.SDL_RenderGetLogicalSize(self.renderer, byref(w), byref(h))
+        return w.value, h.value
+
+    @logical_size.setter
+    def logical_size(self, size):
+        """The logical pixel size of the Renderer"""
+        width, height = size
+        ret = render.SDL_RenderSetLogicalSize(self.renderer, width, height)
+        if ret != 0:
+            raise SDLError()
+
+    @property
     def color(self):
         """The drawing color of the Renderer."""
         r, g, b, a = Uint8(), Uint8(), Uint8(), Uint8()