Example #1
0
def init(*flags):
    """Loads dynamic libraries and prepares them for use.

    Args:
        *flags (Set[ImageInitFlag]): The desired image file formats.
    """
    check_int_err(lib.IMG_Init(enumtools.get_mask(flags)))
Example #2
0
def init(*flags):
    """Loads dynamic libraries and prepares them for use.

    Args:
        *flags (Set[ImageInitFlag]): The desired image file formats.
    """
    check_int_err(lib.IMG_Init(enumtools.get_mask(flags)))
Example #3
0
def init(*flags):
    """Loads dynamic libraries and prepares them for use.
    
    Args:
        *flags (Set[AudioInitFlag]): The desired audio file formats.
    """
    lib.Mix_Init(enumtools.get_mask(flags))
Example #4
0
def init(*flags):
    """Loads dynamic libraries and prepares them for use.
    
    Args:
        *flags (Set[AudioInitFlag]): The desired audio file formats.
    """
    lib.Mix_Init(enumtools.get_mask(flags))
Example #5
0
def init(*flags):
    """This function initializes the subsystems specified by flags.

    Args:
        *flags (InitFlag): Flags specifying which subsystems to initialize.

    Raises:
        SDLError: If there's an error initializing SDL.
    """
    check_int_err(lib.SDL_Init(enumtools.get_mask(flags)))
Example #6
0
def init(*flags):
    """This function initializes the subsystems specified by flags.

    Args:
        *flags (InitFlag): Flags specifying which subsystems to initialize.

    Raises:
        SDLError: If there's an error initializing SDL.
    """
    check_int_err(lib.SDL_Init(enumtools.get_mask(flags)))
Example #7
0
    def __init__(self, window, index=-1, flags=frozenset()):
        """Create a 2D rendering context for a window.

        Args:
            window (Window): The window where rendering is displayed.
            index (int): The index of the rendering driver to initialize, or -1 to initialize the first one supporting
                         the requested flags.
            flags (Set[RendererFlags]): The requested renderer flags.

        Raises:
            SDLError: If there was an error creating the renderer.
        """
        self._ptr = check_ptr_err(lib.SDL_CreateRenderer(window._ptr, index, enumtools.get_mask(flags)))
Example #8
0
    def __init__(self, window, index=-1, flags=frozenset()):
        """Create a 2D rendering context for a window.

        Args:
            window (Window): The window where rendering is displayed.
            index (int): The index of the rendering driver to initialize, or -1 to initialize the first one supporting
                         the requested flags.
            flags (Set[RendererFlags]): The requested renderer flags.

        Raises:
            SDLError: If there was an error creating the renderer.
        """
        self._ptr = check_ptr_err(
            lib.SDL_CreateRenderer(window._ptr, index,
                                   enumtools.get_mask(flags)))
Example #9
0
    def __init__(self,
                 title='sdl2',
                 x=lib.SDL_WINDOWPOS_CENTERED,
                 y=lib.SDL_WINDOWPOS_CENTERED,
                 w=640,
                 h=480,
                 flags=frozenset()):
        """Create a window with the specified position, dimensions, and flags.

        Args:
            title (str): The title of the window.
            x (int): The x postion of the window.
            y (int): The y position of the window.
            w (int): The width of the window.
            h (int): The height of the window.
            flags (Set[WindowFlags]): The flags for the window.
        Raises:
            SDLError: If the window could not be created.
        """
        self._ptr = check_ptr_err(
            lib.SDL_CreateWindow(title.encode('utf-8'), x, y, w, h,
                                 enumtools.get_mask(flags)))
Example #10
0
    def __init__(self, title='sdl2', x=lib.SDL_WINDOWPOS_CENTERED, y=lib.SDL_WINDOWPOS_CENTERED,
                 w=640, h=480, flags=frozenset()):
        """Create a window with the specified position, dimensions, and flags.

        Args:
            title (str): The title of the window.
            x (int): The x postion of the window.
            y (int): The y position of the window.
            w (int): The width of the window.
            h (int): The height of the window.
            flags (Set[WindowFlags]): The flags for the window.
        Raises:
            SDLError: If the window could not be created.
        """
        self._ptr = check_ptr_err(lib.SDL_CreateWindow(title.encode('utf-8'), x, y, w, h, enumtools.get_mask(flags)))