Commits

Marcus von Appen committed a26e8f5

- added sdl2.SDL_GL_FRAMEBUFFER_SRGB_CAPABLE, sdl2.SDL_TICKS_PASSED() and
sdl2.SDL_UpdateYUVTexture() from the recent SDL2 changes

Comments (0)

Files changed (4)

 from ctypes import Structure, POINTER, c_int, c_char_p, c_void_p, c_float, \
     c_double
-from .dll import _bind
+from .dll import _bind, nullfunc
 from .stdinc import Uint8, Uint32, SDL_bool
 from .blendmode import SDL_BlendMode
 from .rect import SDL_Point, SDL_Rect
            "SDL_RenderDrawRects", "SDL_RenderFillRect", "SDL_RenderFillRects",
            "SDL_RenderCopy", "SDL_RenderCopyEx", "SDL_RenderReadPixels",
            "SDL_RenderPresent", "SDL_DestroyTexture", "SDL_DestroyRenderer",
-           "SDL_GL_BindTexture", "SDL_GL_UnbindTexture"
+           "SDL_UpdateYUVTexture", "SDL_GL_BindTexture", "SDL_GL_UnbindTexture"
            ]
 
 SDL_RendererFlags = c_int
 SDL_DestroyRenderer = _bind("SDL_DestroyRenderer", [POINTER(SDL_Renderer)])
 SDL_GL_BindTexture = _bind("SDL_GL_BindTexture", [POINTER(SDL_Texture), POINTER(c_float), POINTER(c_float)], c_int)
 SDL_GL_UnbindTexture = _bind("SDL_GL_UnbindTexture", [POINTER(SDL_Texture)], c_int)
+SDL_UpdateYUVTexture = _bind("SDL_UpdateYUVTexture", [POINTER(SDL_Texture), POINTER(SDL_Rect), POINTER(Uint8), c_int, POINTER(Uint8), c_int, POINTER(Uint8), c_int], c_int, nullfunc)
+

sdl2/test/version_test.py

         self.assertEqual(type(v), version.SDL_version)
         self.assertEqual(v.major, 2)
         self.assertEqual(v.minor, 0)
-        self.assertEqual(v.patch, 0)
+        self.assertEqual(v.patch, 1)
 
     def test_SDL_VERSIONNUM(self):
         self.assertEqual(version.SDL_VERSIONNUM(1, 2, 3), 1203)
     def test_SDL_VERSION_ATLEAST(self):
         self.assertTrue(version.SDL_VERSION_ATLEAST(1, 2, 3))
         self.assertTrue(version.SDL_VERSION_ATLEAST(2, 0, 0))
-        self.assertFalse(version.SDL_VERSION_ATLEAST(2, 0, 1))
+        self.assertTrue(version.SDL_VERSION_ATLEAST(2, 0, 1))
+        self.assertFalse(version.SDL_VERSION_ATLEAST(2, 0, 2))
 
     def test_SDL_GetRevision(self):
         self.assertEqual(version.SDL_GetRevision()[0:3], b"hg-")
 
 SDL_AddTimer = _bind("SDL_AddTimer", [Uint32, SDL_TimerCallback, c_void_p], SDL_TimerID)
 SDL_RemoveTimer = _bind("SDL_RemoveTimer", [SDL_TimerID], SDL_bool)
+
+def SDL_TICKS_PASSED(A, B):
+    return (B - A) <= 0
+
            "SDL_GL_CONTEXT_MAJOR_VERSION", "SDL_GL_CONTEXT_MINOR_VERSION",
            "SDL_GL_CONTEXT_EGL", "SDL_GL_CONTEXT_FLAGS",
            "SDL_GL_CONTEXT_PROFILE_MASK", "SDL_GL_SHARE_WITH_CURRENT_CONTEXT",
-           "SDL_GLprofile", "SDL_GL_CONTEXT_PROFILE_CORE",
+           "SDL_GL_FRAMEBUFFER_SRGB_CAPABLE", "SDL_GLprofile",
+           "SDL_GL_CONTEXT_PROFILE_CORE",
            "SDL_GL_CONTEXT_PROFILE_COMPATIBILITY", "SDL_GL_CONTEXT_PROFILE_ES",
            "SDL_GLcontextFlag", "SDL_GL_CONTEXT_DEBUG_FLAG",
            "SDL_GL_CONTEXT_FORWARD_COMPATIBLE_FLAG",
 SDL_GL_CONTEXT_FLAGS = 20
 SDL_GL_CONTEXT_PROFILE_MASK = 21
 SDL_GL_SHARE_WITH_CURRENT_CONTEXT = 22
+SDL_GL_FRAMEBUFFER_SRGB_CAPABLE = 23
 
 SDL_GLprofile = c_int
 SDL_GL_CONTEXT_PROFILE_CORE = 0x0001