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 | 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 a 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) |
| Reads null-terminated string value from file.
|
BBDECL int BBCALL | xReadShort (xFile *file) |
| Reads short integer value from file (2 bytes)
|
BBDECL const char *BBCALL | xReadString (xFile *file) |
| Reads 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 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 float value into file (4 bytes)
|
BBDECL void BBCALL | xWriteInt (xFile *file, int value) |
| Writes integer value into file (4 bytes)
|
BBDECL void BBCALL | xWriteLine (xFile *file, const char *value) |
| Writes null-terminated string into file.
|
BBDECL void BBCALL | xWriteShort (xFile *file, int value) |
| Writes short integer value into file (2 bytes)
|
BBDECL void BBCALL | xWriteString (xFile *file, const char *value) |
| Writes 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 search 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 development 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.
Note: With packfiles works only xReadFile(), xFileType() and xFileSize() commands. You can't create, delete or change files in packfiles.
- Parameters:
-
path | A path to the pack file. |
mountpoint | Mount point of the pack file. |
password | A password of the pack file. |