photon/csdl/__init__.py

56 lines
1.0 KiB
Python
Raw Normal View History

import ctypes
2011-03-27 05:46:06 +00:00
from .internal import _SDL, errcheck, Version
2011-03-27 17:30:13 +00:00
from enum import CEnum
# Constants
2011-03-27 17:30:13 +00:00
class INIT(CEnum):
2011-03-16 18:41:54 +00:00
TIMER = 0x00000001
AUDIO = 0x00000010
VIDEO = 0x00000020
JOYSTICK = 0x00000200
HAPTIC = 0x00001000
NOPARACHUTE = 0x00100000
EVERYTHING = 0x0000FFFF
##### Error Handling
_SDL.SDL_GetError.restype = ctypes.c_char_p
def get_error():
return _SDL.SDL_GetError()
def set_error(msg):
_SDL.SDL_SetError(msg)
def clear_error():
_SDL.SDL_ClearError()
##### Initialization
def init(flags):
errcheck(_SDL.SDL_Init(flags))
def init_sub_system(flags):
errcheck(_SDL.SDL_InitSubSystem(flags))
def quit_sub_system(flags):
errcheck(_SDL.SDL_QuitSubSystem(flags))
def was_init(flags=0):
errcheck(_SDL.SDL_WasInit(flags))
def quit():
_SDL.SDL_Quit()
##### Version Info
def get_version():
v = Version()
_SDL.SDL_GetVersion(ctypes.byref(v))
return v
_SDL.SDL_GetRevision.restype = ctypes.c_char_p
def get_revision():
return _SDL.SDL_GetRevision()