Source

pysdl-cffi / sdl / __init__.py

Leonard Ritter 60fb5c7 


Leonard Ritter 16274db 
Leonard Ritter 60fb5c7 










Leonard Ritter 9534a29 





Leonard Ritter 15e1d15 





Leonard Ritter 99d0d72 





Leonard Ritter 87a59a3 











Leonard Ritter f4fb70b 
Leonard Ritter 87a59a3 



Leonard Ritter d17e66f 





Leonard Ritter 60fb5c7 
Leonard Ritter f9e58ba 



Leonard Ritter 8d3f870 
Leonard Ritter f9e58ba 




Leonard Ritter 16274db 


Leonard Ritter f9e58ba 
from __future__ import (print_function, division, absolute_import)

from ._sdl import *
from .internal import SDLError 

################################################################################

def SDL_Init(*args):
    result = _SDL_Init(*args)
    SDL_ClearError()
    return result

def SDL_GetError():
    return _ffi.string(_SDL_GetError()) 

def SDL_PollEvent():
    event = _ffi.new('SDL_Event *')
    if not _SDL_PollEvent(event):
        return None
    return event

def SDL_GetWindowSize(window):
    w = _ffi.new('int *')
    h = _ffi.new('int *')
    _SDL_GetWindowSize(window, w, h)
    return w[0], h[0]

def SDL_GetMouseState():
    x = _ffi.new('int *')
    y = _ffi.new('int *')
    state = _SDL_GetMouseState(x, y)
    return state, x[0], y[0]

def SDL_GetCurrentDisplayMode(displayIndex):
    mode = _ffi.new('SDL_DisplayMode *')
    result = _SDL_GetCurrentDisplayMode(displayIndex, mode)
    if result == 0:
        return mode

def SDL_GetDisplayMode(displayIndex, modeIndex):
    mode = _ffi.new('SDL_DisplayMode *')
    result = _SDL_GetDisplayMode(displayIndex, modeIndex, mode)
    if result == 0:
        return mode

def SDL_GetDesktopDisplayMode(displayIndex):
    mode = _ffi.new('SDL_DisplayMode *')
    result = _SDL_GetDesktopDisplayMode(displayIndex, mode)
    if result == 0:
        return mode

def SDL_GL_GetAttribute(attr):
    value = _ffi.new('int *')
    _SDL_GL_GetAttribute(attr, value)
    return value[0]

################################################################################

# add wrapped functions
_module_names = set(locals().keys())
def get_mangled_names():
    for name in UNMANGLED_EXPORTS:
        mangled_name = name.lstrip('_')
        if mangled_name in _module_names:
            yield mangled_name
        else:
            yield name 
__all__ = [
    'SDLError',
] + EXPORTS + list(get_mangled_names())
del _module_names
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.