예제 #1
0
import sdl2_parser, sdl2_generator

if __name__ == "__main__":

    ctx = sdl2_parser.ParseContext('./SDL2/SDL_vulkan.h')
    sdl2_parser.execute(ctx)

    sdl2_generator.sanitize(ctx)
    sdl2_generator.generate(ctx)
예제 #2
0
import sdl2_parser, sdl2_generator

if __name__ == "__main__":

    ctx = sdl2_parser.ParseContext('./SDL2/SDL_shape.h')
    sdl2_parser.execute(ctx)

    sdl2_generator.sanitize(ctx)
    sdl2_generator.generate(
        ctx,
        prefix=sdl2_generator.PREFIX + "from .sdl2_pixels import SDL_Color\n",
    )
예제 #3
0
import sdl2_parser, sdl2_generator

if __name__ == "__main__":

    ctx = sdl2_parser.ParseContext('./SDL2/SDL2_imageFilter.h')
    sdl2_parser.execute(ctx)

    sdl2_generator.sanitize(ctx)
    sdl2_generator.generate(
        ctx,
        prefix=sdl2_generator.PREFIX +
        "from .api import SDL2_GFX_API_NAMES, SDL2_GFX_API_ARGS_MAP, SDL2_GFX_API_RETVAL_MAP\n",
        table_prefix="SDL2_GFX_")
    _fields_ = [
        ("button", ctypes.c_int),
        ("axis", ctypes.c_int),
        ("hat", _SDL_GameControllerButtonBind_value_hat),
    ]

class SDL_GameControllerButtonBind(ctypes.Structure):
    _fields_ = [
        ("bindType", ctypes.c_int),
        ("value", _SDL_GameControllerButtonBind_value),
    ]
"""

if __name__ == "__main__":

    ctx = sdl2_parser.ParseContext('./SDL2/SDL_gamecontroller.h')
    sdl2_parser.execute(ctx)

    # TODO : Merge anonymous structs into one union (e.g. SDL_RWops)
    #
    # SDL_GameControllerButtonBind is a bit complicated so I unfortunately have to
    # substitute the parsed definition with my handwritten one.
    ctx.decl_structs['SDL_GameControllerButtonBind'] = None

    sdl2_generator.sanitize(ctx)
    sdl2_generator.generate(ctx,
                            prefix=sdl2_generator.PREFIX +
                            "from .sdl2_joystick import SDL_JoystickGUID\n",
                            postfix=sdl2_generator.POSTFIX +
                            POSTFIX_GAMECONTROLLER)
예제 #5
0
import sdl2_parser, sdl2_generator

POSTFIX_AUDIO = """
# TODO : def SDL_LoadWAV
"""

if __name__ == "__main__":

    ctx = sdl2_parser.ParseContext('./SDL2/SDL_audio.h')
    sdl2_parser.execute(ctx)

    sdl2_generator.sanitize(ctx)
    sdl2_generator.generate(ctx,
                            postfix=sdl2_generator.POSTFIX + POSTFIX_AUDIO)
예제 #6
0
class _Win32_SDL_RWops(ctypes.Structure):
    _fields_ = [
        ("size", ctypes.c_void_p),
        ("seek", ctypes.c_void_p),
        ("read", ctypes.c_void_p),
        ("write", ctypes.c_void_p),
        ("close", ctypes.c_void_p),
        ("type", ctypes.c_uint),
        ("hidden", _Win32_SDL_RWops_hidden),
    ]

SDL_RWops = _Win32_SDL_RWops if os.name == "nt" else _Default_SDL_RWops
"""

if __name__ == "__main__":

    ctx = sdl2_parser.ParseContext('./SDL2/SDL_rwops.h')
    sdl2_parser.execute(ctx)

    # TODO : Merge anonymous structs into one union (e.g. SDL_RWops)
    #
    # SDL_RWops is a bit complicated so I unfortunately have to
    # substitute the parsed definition with my handwritten one.
    ctx.decl_structs['SDL_RWops'] = None

    sdl2_generator.sanitize(ctx)
    sdl2_generator.generate(ctx,
                            prefix=sdl2_generator.PREFIX + PREFIX_RWOPS,
                            postfix=sdl2_generator.POSTFIX + POSTFIX_RWOPS)
예제 #7
0
import sdl2_parser, sdl2_generator

if __name__ == "__main__":

    ctx = sdl2_parser.ParseContext('./SDL2/SDL_events.h')
    sdl2_parser.execute(ctx)

    sdl2_generator.sanitize(ctx)
    sdl2_generator.generate(ctx,
                            prefix=sdl2_generator.PREFIX +
                            "from .sdl2_keyboard import SDL_Keysym\n")
예제 #8
0
import sdl2_parser, sdl2_generator

if __name__ == "__main__":

    ctx = sdl2_parser.ParseContext('./SDL2/SDL_surface.h')
    sdl2_parser.execute(ctx)

    sdl2_generator.sanitize(ctx)
    sdl2_generator.generate(ctx,
                            prefix=sdl2_generator.PREFIX +
                            "from .sdl2_rect import SDL_Rect\n")