nCine 2022.04.r504-20bd01e
A cross-platform 2D game engine
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
ncine::EmscriptenLocalFile Class Reference

The class dealing with opening and saving a local file on Emscripten. More...

#include <EmscriptenLocalFile.h>

Public Types

using LoadedCallbackType = void(const EmscriptenLocalFile &localFile, void *userData)
 

Public Member Functions

void load ()
 Opens a dialog in the browser to choose a file to load.
 
void load (const char *fileFilter)
 Opens a filtered dialog in the browser to choose a file to load.
 
void save (const char *filename)
 Saves a file from the browser to the local machine.
 
unsigned long int read (void *buffer, unsigned long int bytes) const
 Reads a certain amount of bytes from the file to a buffer.
 
unsigned long int write (void *buffer, unsigned long int bytes)
 Writes a certain amount of bytes from a buffer to the file.
 
void setLoadedCallback (LoadedCallbackType *loadedCallback)
 Sets the callback to be invoked when loading is complete.
 
void setLoadedCallback (LoadedCallbackType *loadedCallback, void *userData)
 Sets the callback to be invoked when loading is complete, together with user data.
 
const char * data () const
 Returns a read-only pointer to the internal file buffer.
 
long int size () const
 Returns the file size in bytes.
 
const char * filename () const
 Returns the file name.
 
bool isLoading () const
 Returns true if loading is in progress.
 

Detailed Description

The class dealing with opening and saving a local file on Emscripten.

Member Function Documentation

◆ read()

unsigned long int ncine::EmscriptenLocalFile::read ( void *  buffer,
unsigned long int  bytes 
) const

Reads a certain amount of bytes from the file to a buffer.

Returns
Number of bytes read

◆ write()

unsigned long int ncine::EmscriptenLocalFile::write ( void *  buffer,
unsigned long int  bytes 
)

Writes a certain amount of bytes from a buffer to the file.

Returns
Number of bytes written

The documentation for this class was generated from the following files: