photon/csdl/internal.py

14 lines
323 B
Python
Raw Normal View History

2011-03-27 02:13:22 +00:00
import ctypes
_SDL = ctypes.cdll.LoadLibrary('/usr/local/lib/libSDL-1.3.so.0.0.0')
2011-03-27 02:46:16 +00:00
class SDLError(Exception):
""" Exception representing an error in an SDL call """
def errcheck(result):
if result < 0:
msg = _SDL.SDL_GetError()
_SDL.SDL_ClearError()
raise SDLError(msg)
return result