From 23ae570a9f3fb4cd38a51baa6515671fefaae64d Mon Sep 17 00:00:00 2001 From: Mathieu Virbel Date: Tue, 10 May 2011 00:15:22 +0200 Subject: [PATCH] sdl: start. --- kivy/core/sdl.pyx | 19 +++++++++++++++++++ setup.py | 13 ++++++++++++- 2 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 kivy/core/sdl.pyx diff --git a/kivy/core/sdl.pyx b/kivy/core/sdl.pyx new file mode 100644 index 000000000..25f807f5a --- /dev/null +++ b/kivy/core/sdl.pyx @@ -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() diff --git a/setup.py b/setup.py index 01b3e3a9c..fab0dcb24 100644 --- a/setup.py +++ b/setup.py @@ -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):