Module cocos.audio.SDL.rwops

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.

Classes

  SDL_RWops
Read/write operations structure.

Functions

SDL_RWops SDL_RWFromObject(obj)
Construct an SDL_RWops structure from a Python file-like object.

Variables

  __package__ = 'cocos.audio.SDL'

Function Details

SDL_RWFromObject

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
Returns: SDL_RWops