![]() |
Xors3d Engine
|
Functions | |
void | xChangeDir (const char *path) |
Sets directory as current. | |
void | xCloseDir (int handle) |
Closes previously opened directory. | |
void | xCloseFile (xFile *file) |
Closes opened file. | |
int | xCopyFile (const char *pathSrc, const char *pathDest) |
Copies file from source path to destination. | |
int | xCreateDir (const char *path) |
Creates new directory. | |
const char * | xCurrentDir () |
Returns current directory path. | |
int | xDeleteDir (const char *path) |
Deletes directory. | |
int | xDeleteFile (const char *path) |
Deletes file. | |
int | xEof (xFile *file) |
Checks to see if the End of File of an opened file or stream has been reached. | |
int | xFileCreationTime (const char *path) |
Returns the time the file was created. | |
const char * | xFileCreationTimeStr (const char *path) |
Returns the time the file was created. | |
int | xFileModificationTime (const char *path) |
Returns the time the file was last modified. | |
const char * | xFileModificationTimeStr (const char *path) |
Returns the time the file was last modified. | |
int | xFilePos (xFile *file) |
Returns the current position within a file that is being processed following xReadFile(), xWriteFile() or xOpenFile() | |
int | xFileSize (const char *path) |
Returns the size of the file. | |
int | 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. | |
xPackFile * | 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. | |
const char * | xNextFile (int handle) |
Returns the next file or folder from the currently open directory. | |
xFile * | 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. | |
int | xReadByte (xFile *file) |
Reads byte value from file (1 byte) | |
int | 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). | |
xFile * | xReadFile (const char *path) |
Opens the designated filename and prepares it to be read from. | |
float | xReadFloat (xFile *file) |
Reads float value from file (4 bytes) | |
int | xReadInt (xFile *file) |
Reads integer value from file (4 bytes) | |
const char * | 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. | |
int | xReadShort (xFile *file) |
Reads short integer value from file (2 bytes) | |
const char * | xReadString (xFile *file) |
Reads a string value from file. | |
void | xSeekFile (xFile *file, int offset) |
Sets current position in file. | |
void | xUnmountPackFile (xPackFile *packfile) |
Unmounts a pack file from the file system. | |
void | xWriteByte (xFile *file, int value) |
Writes a byte value into file (1 byte) | |
xFile * | xWriteFile (const char *path) |
Opens the designated filename and prepares it to be written to. | |
void | xWriteFloat (xFile *file, float value) |
Writes a float value into file (4 bytes) | |
void | xWriteInt (xFile *file, int value) |
Writes an integer value into file (4 bytes) | |
void | 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. | |
void | xWriteShort (xFile *file, int value) |
Writes a short integer value into file (2 bytes) | |
void | xWriteString (xFile *file, const char *value) |
Writes a string into file. |
xPackFile* 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. |
void xUnmountPackFile | ( | xPackFile * | packfile | ) |
Unmounts a pack file from the file system.
packfile | Packfile handle. |
xFile* 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 |
xFile* xReadFile | ( | const char * | path | ) |
Opens the designated filename and prepares it to be read from.
path | Filename to opens |
xFile* xWriteFile | ( | const char * | path | ) |
Opens the designated filename and prepares it to be written to.
path | Filename to opens |
void xCloseFile | ( | xFile * | file | ) |
Closes opened file.
file | File handle |
int xFilePos | ( | xFile * | file | ) |
Returns the current position within a file that is being processed following xReadFile(), xWriteFile() or xOpenFile()
file | File handle |
void xSeekFile | ( | xFile * | file, |
int | offset | ||
) |
Sets current position in file.
file | File handle |
offset | Offset in bytes from the start of file |
int 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 |
int xFileSize | ( | const char * | path | ) |
Returns the size of the file.
path | Filename to check |
int 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 |
const char* 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 |
int 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 |
const char* 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 |
int 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 |
void xCloseDir | ( | int | handle | ) |
Closes previously opened directory.
handle | Directory handle |
const char* xNextFile | ( | int | handle | ) |
Returns the next file or folder from the currently open directory.
handle | Directory handle |
const char* xCurrentDir | ( | ) |
Returns current directory path.
void xChangeDir | ( | const char * | path | ) |
Sets directory as current.
path | Directory path |
int xCreateDir | ( | const char * | path | ) |
Creates new directory.
path | Directory path |
int xDeleteDir | ( | const char * | path | ) |
Deletes directory.
path | Directory path |
int xCopyFile | ( | const char * | pathSrc, |
const char * | pathDest | ||
) |
Copies file from source path to destination.
pathSrc | Source file |
pathDest | Destination file |
int xDeleteFile | ( | const char * | path | ) |
Deletes file.
path | Filename to delete |
int xEof | ( | xFile * | file | ) |
Checks to see if the End of File of an opened file or stream has been reached.
file | File handle |
int xReadByte | ( | xFile * | file | ) |
Reads byte value from file (1 byte)
file | File handle |
int xReadShort | ( | xFile * | file | ) |
Reads short integer value from file (2 bytes)
file | File handle |
int xReadInt | ( | xFile * | file | ) |
Reads integer value from file (4 bytes)
file | File handle |
float xReadFloat | ( | xFile * | file | ) |
Reads float value from file (4 bytes)
file | File handle |
const char* 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 |
const char* 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. |
void xWriteByte | ( | xFile * | file, |
int | value | ||
) |
Writes a byte value into file (1 byte)
file | File handle |
value | Value to write |
void xWriteShort | ( | xFile * | file, |
int | value | ||
) |
Writes a short integer value into file (2 bytes)
file | File handle |
value | Value to write |
void xWriteInt | ( | xFile * | file, |
int | value | ||
) |
Writes an integer value into file (4 bytes)
file | File handle |
value | Value to write |
void xWriteFloat | ( | xFile * | file, |
float | value | ||
) |
Writes a float value into file (4 bytes)
file | File handle |
value | Value to write |
void 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 |
void 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. |