![]() |
Xors3d Engine
|
Functions | |
BBDECL void BBCALL | xChangeDir (const char *path) |
Sets directory as current. | |
BBDECL void BBCALL | xCloseDir (int handle) |
Closes previously opened directory. | |
BBDECL void BBCALL | xCloseFile (xFile *file) |
Closes opened file. | |
BBDECL int BBCALL | xCopyFile (const char *pathSrc, const char *pathDest) |
Copies file from source path to destination. | |
BBDECL int BBCALL | xCreateDir (const char *path) |
Creates new directory. | |
BBDECL const char *BBCALL | xCurrentDir () |
Returns current directory path. | |
BBDECL int BBCALL | xDeleteDir (const char *path) |
Deletes directory. | |
BBDECL int BBCALL | xDeleteFile (const char *path) |
Deletes file. | |
BBDECL int BBCALL | xEof (xFile *file) |
Checks to see if the End of File of an opened file or stream has been reached. | |
BBDECL int BBCALL | xFileCreationTime (const char *path) |
Returns the time the file was created. | |
BBDECL const char *BBCALL | xFileCreationTimeStr (const char *path) |
Returns the time the file was created. | |
BBDECL int BBCALL | xFileModificationTime (const char *path) |
Returns the time the file was last modified. | |
BBDECL const char *BBCALL | xFileModificationTimeStr (const char *path) |
Returns the time the file was last modified. | |
BBDECL int BBCALL | xFilePos (xFile *file) |
Returns the current position within a file that is being processed following xReadFile(), xWriteFile() or xOpenFile() | |
BBDECL int BBCALL | xFileSize (const char *path) |
Returns the size of the file. | |
BBDECL int BBCALL | xFileType (const char *path) |
Checks the filename you pass and determines if it exists and whether or not it is a valid filename or if it is a directory. | |
BBDECL xPackFile *BBCALL | xMountPackFile (const char *path, const char *mountpoint="", const char *password="") |
Mounts a zip file as a part of the file system and returns its handle. | |
BBDECL const char *BBCALL | xNextFile (int handle) |
Returns the next file or folder from the currently open directory. | |
BBDECL xFile *BBCALL | xOpenFile (const char *path) |
Opens the designated file and prepares it to be updated. The file must exists since this function will not create a new file. | |
BBDECL int BBCALL | xReadByte (xFile *file) |
Reads byte value from file (1 byte) | |
BBDECL int BBCALL | xReadDir (const char *path) |
Returns a directory handle. You will use the xNextFile() to iterate through each file entry (use xFileType() to see if it is a file or folder). | |
BBDECL xFile *BBCALL | xReadFile (const char *path) |
Opens the designated filename and prepares it to be read from. | |
BBDECL float BBCALL | xReadFloat (xFile *file) |
Reads float value from file (4 bytes) | |
BBDECL int BBCALL | xReadInt (xFile *file) |
Reads integer value from file (4 bytes) | |
BBDECL const char *BBCALL | xReadLine (xFile *file, int ls_flag=0) |
Reads a line from file. Line should be terminated with a line separator specified with ls_flag parameter. | |
BBDECL int BBCALL | xReadShort (xFile *file) |
Reads short integer value from file (2 bytes) | |
BBDECL const char *BBCALL | xReadString (xFile *file) |
Reads a string value from file. | |
BBDECL void BBCALL | xSeekFile (xFile *file, int offset) |
Sets current position in file. | |
BBDECL void BBCALL | xUnmountPackFile (xPackFile *packfile) |
Unmounts a pack file from the file system. | |
BBDECL void BBCALL | xWriteByte (xFile *file, int value) |
Writes a byte value into file (1 byte) | |
BBDECL xFile *BBCALL | xWriteFile (const char *path) |
Opens the designated filename and prepares it to be written to. | |
BBDECL void BBCALL | xWriteFloat (xFile *file, float value) |
Writes a float value into file (4 bytes) | |
BBDECL void BBCALL | xWriteInt (xFile *file, int value) |
Writes an integer value into file (4 bytes) | |
BBDECL void BBCALL | xWriteLine (xFile *file, const char *value, int ls_flag=0) |
Writes a line to file. Line is terminated with a line separator specified with ls_flag parameter. | |
BBDECL void BBCALL | xWriteShort (xFile *file, int value) |
Writes a short integer value into file (2 bytes) | |
BBDECL void BBCALL | xWriteString (xFile *file, const char *value) |
Writes a string into file. |
BBDECL xPackFile* BBCALL xMountPackFile | ( | const char * | path, |
const char * | mountpoint = "" , |
||
const char * | password = "" |
||
) |
Mounts a zip file as a part of the file system and returns its handle.
Use a zip file as a pack of your resources. Use of packs allows to compress the resources and to encrypt them with a password. Once mounted pack file becomes visible for the engine as a part of the file system. The second parameter is a mount point which is the location in the file system structure where a mounted pack file appears.
When you load some media, the engine searches that media in the mounted pack files first. For instance, the pack was mounted by using following
xMountPackFile("textures.zip", "textures\", "super_password");
Since now a pack file "textures.zip" is seen as a "textures\" directory.
If you load some texture by using
xLoadTexture("textures\something.dds");
the engine will try to load a texture "something.dds" from the pack mounted before since its mount point is "textures\". If there isn't such texture in the pack, the engine will try to load it from the disk using the path "textures\something.dds".
Such system allows you to develop and release your applications with ease. During development use loading from the disk. Before release pack your media and mount the packs using proper mount points.
path | A path to the pack file. |
mountpoint | Mount point of the pack file. |
password | A password of the pack file. |
BBDECL void BBCALL xUnmountPackFile | ( | xPackFile * | packfile | ) |
Unmounts a pack file from the file system.
packfile | Packfile handle. |
BBDECL xFile* BBCALL xOpenFile | ( | const char * | path | ) |
Opens the designated file and prepares it to be updated. The file must exists since this function will not create a new file.
path | Filename to opens |
BBDECL xFile* BBCALL xReadFile | ( | const char * | path | ) |
Opens the designated filename and prepares it to be read from.
path | Filename to opens |
BBDECL xFile* BBCALL xWriteFile | ( | const char * | path | ) |
Opens the designated filename and prepares it to be written to.
path | Filename to opens |
BBDECL void BBCALL xCloseFile | ( | xFile * | file | ) |
Closes opened file.
file | File handle |
BBDECL int BBCALL xFilePos | ( | xFile * | file | ) |
Returns the current position within a file that is being processed following xReadFile(), xWriteFile() or xOpenFile()
file | File handle |
BBDECL void BBCALL xSeekFile | ( | xFile * | file, |
int | offset | ||
) |
Sets current position in file.
file | File handle |
offset | Offset in bytes from the start of file |
BBDECL int BBCALL xFileType | ( | const char * | path | ) |
Checks the filename you pass and determines if it exists and whether or not it is a valid filename or if it is a directory.
The values to be returned: 0 - The file doesn't exist 1 - The file exists 2 - The file is not a file - but a directory
path | Filename to check |
BBDECL int BBCALL xFileSize | ( | const char * | path | ) |
Returns the size of the file.
path | Filename to check |
BBDECL int BBCALL xFileCreationTime | ( | const char * | path | ) |
Returns the time the file was created.
The time to be returned is the number of seconds since the beginning of January 1, 1970.
path | Filename to check |
BBDECL const char* BBCALL xFileCreationTimeStr | ( | const char * | path | ) |
Returns the time the file was created.
The time to be returned is a string in format "MM/DD/YYYY hh:mm:ss".
path | Filename to check |
BBDECL int BBCALL xFileModificationTime | ( | const char * | path | ) |
Returns the time the file was last modified.
The time to be returned is the number of seconds since the beginning of January 1, 1970.
path | Filename to check |
BBDECL const char* BBCALL xFileModificationTimeStr | ( | const char * | path | ) |
Returns the time the file was last modified.
The time to be returned is a string in format "MM/DD/YYYY hh:mm:ss".
path | Filename to check |
BBDECL int BBCALL xReadDir | ( | const char * | path | ) |
Returns a directory handle. You will use the xNextFile() to iterate through each file entry (use xFileType() to see if it is a file or folder).
path | Directory path |
BBDECL void BBCALL xCloseDir | ( | int | handle | ) |
Closes previously opened directory.
handle | Directory handle |
BBDECL const char* BBCALL xNextFile | ( | int | handle | ) |
Returns the next file or folder from the currently open directory.
handle | Directory handle |
BBDECL const char* BBCALL xCurrentDir | ( | ) |
Returns current directory path.
BBDECL void BBCALL xChangeDir | ( | const char * | path | ) |
Sets directory as current.
path | Directory path |
BBDECL int BBCALL xCreateDir | ( | const char * | path | ) |
Creates new directory.
path | Directory path |
BBDECL int BBCALL xDeleteDir | ( | const char * | path | ) |
Deletes directory.
path | Directory path |
BBDECL int BBCALL xCopyFile | ( | const char * | pathSrc, |
const char * | pathDest | ||
) |
Copies file from source path to destination.
pathSrc | Source file |
pathDest | Destination file |
BBDECL int BBCALL xDeleteFile | ( | const char * | path | ) |
Deletes file.
path | Filename to delete |
BBDECL int BBCALL xEof | ( | xFile * | file | ) |
Checks to see if the End of File of an opened file or stream has been reached.
file | File handle |
BBDECL int BBCALL xReadByte | ( | xFile * | file | ) |
Reads byte value from file (1 byte)
file | File handle |
BBDECL int BBCALL xReadShort | ( | xFile * | file | ) |
Reads short integer value from file (2 bytes)
file | File handle |
BBDECL int BBCALL xReadInt | ( | xFile * | file | ) |
Reads integer value from file (4 bytes)
file | File handle |
BBDECL float BBCALL xReadFloat | ( | xFile * | file | ) |
Reads float value from file (4 bytes)
file | File handle |
BBDECL const char* BBCALL xReadString | ( | xFile * | file | ) |
Reads a string value from file.
Each string is stored in the file as a 4 byte integer followed by the characters that form the string. The integer contains the number of characters in the string, i.e. its length. Note, that Carriage Return, Line Feed and Null characters are not use to indicate the end of the string.
file | File handle |
BBDECL const char* BBCALL xReadLine | ( | xFile * | file, |
int | ls_flag = 0 |
||
) |
Reads a line from file. Line should be terminated with a line separator specified with ls_flag parameter.
file | File handle. |
ls_flag | Line separator. Default value is 0 (LS_NUL). See 'Line separtor types' for more information. |
BBDECL void BBCALL xWriteByte | ( | xFile * | file, |
int | value | ||
) |
Writes a byte value into file (1 byte)
file | File handle |
value | Value to write |
BBDECL void BBCALL xWriteShort | ( | xFile * | file, |
int | value | ||
) |
Writes a short integer value into file (2 bytes)
file | File handle |
value | Value to write |
BBDECL void BBCALL xWriteInt | ( | xFile * | file, |
int | value | ||
) |
Writes an integer value into file (4 bytes)
file | File handle |
value | Value to write |
BBDECL void BBCALL xWriteFloat | ( | xFile * | file, |
float | value | ||
) |
Writes a float value into file (4 bytes)
file | File handle |
value | Value to write |
BBDECL void BBCALL xWriteString | ( | xFile * | file, |
const char * | value | ||
) |
Writes a string into file.
Each string is stored in the file as a 4 byte integer followed by the characters that form the string
file | File handle |
value | Value to write |
BBDECL void BBCALL xWriteLine | ( | xFile * | file, |
const char * | value, | ||
int | ls_flag = 0 |
||
) |
Writes a line to file. Line is terminated with a line separator specified with ls_flag parameter.
file | File handle |
value | Value to write |
ls_flag | Line separator. Default value is 0 (LS_NUL). See 'Line separtor types' for more information. |