sdl: start.

This commit is contained in:
Mathieu Virbel 2011-05-10 00:15:22 +02:00
parent 416a11fc20
commit 23ae570a9f
2 changed files with 31 additions and 1 deletions

19
kivy/core/sdl.pyx Normal file
View File

@ -0,0 +1,19 @@
__all__ = ('sdl_init', 'sdl_quit')
cdef extern from "SDL.h":
int SDL_Init(unsigned int flags)
void SDL_Quit()
cdef int SDL_INIT_TIMER = 0x00000001
cdef int SDL_INIT_AUDIO = 0x00000010
cdef int SDL_INIT_VIDEO = 0x00000020
cdef int SDL_INIT_JOYSTICK = 0x00000200
cdef int SDL_INIT_NOPARACHUTE = 0x00100000
cdef int SDL_INIT_EVENTTHREAD = 0x01000000
cdef int SDL_INIT_EVERYTHING = 0x0000FFFF
def sdl_init():
SDL_Init(SDL_INIT_VIDEO|SDL_INIT_AUDIO)
def sdl_quit():
SDL_Quit()

View File

@ -151,10 +151,21 @@ if True:
return OrigExtension(*args, **kwargs)
# simple extensions
sdl_libraries = ['SDL']
sdl_includes = ['/usr/include/SDL']
for pyx in (x for x in pyx_files if not 'graphics' in x):
pxd = [x for x in pxd_files if not 'graphics' in x]
module_name = get_modulename_from_file(pyx)
ext_modules.append(Extension(module_name, [pyx] + pxd))
la = libraries
lb = include_dirs
if pyx.endswith('sdl.pyx'):
la += sdl_libraries
lb += sdl_includes
ext_modules.append(Extension(
module_name, [pyx] + pxd,
libraries=la,
include_dirs=lb,
extra_link_args=extra_link_args))
# opengl aware modules
for pyx in (x for x in pyx_files if 'graphics' in x):