cocos.audio.SDL.rwops module

General interface for SDL to read and write data sources.

For files, use SDL_RWFromFile. Other Python file-type objects can be used with SDL_RWFromObject. If another library provides a constant void pointer to a contiguous region of memory, SDL_RWFromMem and SDL_RWFromConstMem can be used.

class SDL_RWops

Bases: _ctypes.Structure

Read/write operations structure.

Ivariables
seekfunction

seek(context: SDL_RWops, offset: int, whence: int) -> int

readfunction

read(context: SDL_RWops, ptr: c_void_p, size: int, maxnum: int) -> int

writefunction

write(context: SDL_RWops, ptr: c_void_p, size: int, num: int) -> int

closefunction

close(context: SDL_RWops) -> int

typeint

Undocumented

close

Structure/Union member

read

Structure/Union member

seek

Structure/Union member

type

Structure/Union member

write

Structure/Union member

SDL_RWFromObject(obj)

Construct an SDL_RWops structure from a Python file-like object.

The object must support the following methods in the same fashion as the builtin file object:

  • read(len) -> data

  • write(data)

  • seek(offset, whence)

  • close()

Parameters
  • obj: Python file-like object to wrap

Return type

SDL_RWops