|
SDLGameEngine
|
Resource handling functions. More...
Data Structures | |
| struct | SGEFILE |
Defines | |
| #define | sgeDecryptBuffer sgeEncryptBuffer |
Functions | |
| SGEFILE * | sgeOpenFile (const char *filename, const char *encryptionkey) |
| Open a sge archive created with sga. | |
| void | sgeCloseFile (SGEFILE *f) |
| Close a sge archive and free its memory resources. | |
| void | sgeCreateFile (const char *filename, char *filenames[], Uint32 numberOfFiles, const char *encryptionkey) |
| Create a new sge archive. | |
| int | sgeGetFileIndex (SGEFILE *f, const char *filename) |
| Return the index a file is in the archives lookup table. | |
| Uint32 | sgeGetFileSize (SGEFILE *f, const char *filename) |
| Return the size of a file in the archive. | |
| void * | sgeReadFile (SGEFILE *f, const char *filename) |
| Read a file from the archive to memory. | |
| SDL_Surface * | sgeReadImage (SGEFILE *f, const char *filename) |
| Read a video accelerated image file from archive. | |
| SDL_Surface * | sgeReadImageMemory (SGEFILE *f, const char *filename) |
| Read a image file from archive into RAM. | |
| Mix_Chunk * | sgeReadSound (SGEFILE *f, const char *filename) |
| Read a sound file from archive. | |
| SDL_Surface * | sgeDuplicateSDLSurface (SDL_Surface *s) |
| Duplicate a sdl surface. | |
Variables | |
| int | SGEFILE::numberOfFiles |
| The number of files contained in the archive. | |
Resource handling functions.
Functions to handle resources like encrypted files, images, audio data, ...
| void sgeCreateFile | ( | const char * | filename, |
| char * | filenames[], | ||
| Uint32 | numberOfFiles, | ||
| const char * | encryptionkey | ||
| ) |
Create a new sge archive.
| filename | The name of the new sge archive |
| filenames | A list of char pointers of the filenames to add to the archive |
| numberOfFiles | The number of files to add to the archive |
| encryptionkey | The password |
Use this function only if for some reason you need to create a archive yourself. If you just want to pack data for your game it is recommended to use the commandline utility 'sga' which is in the 'tools' directory.
Definition at line 109 of file sgeresource.c.
| SDL_Surface* sgeDuplicateSDLSurface | ( | SDL_Surface * | s | ) |
Duplicate a sdl surface.
| s | A SDL_Surface aka image |
Definition at line 239 of file sgeresource.c.
| int sgeGetFileIndex | ( | SGEFILE * | f, |
| const char * | filename | ||
| ) |
Return the index a file is in the archives lookup table.
| f | A SGEFILE oject |
| filename | The filename to search for |
Definition at line 167 of file sgeresource.c.
| Uint32 sgeGetFileSize | ( | SGEFILE * | f, |
| const char * | filename | ||
| ) |
Return the size of a file in the archive.
| f | A SGEFILE oject |
| filename | The filename to search for |
Definition at line 177 of file sgeresource.c.
| SGEFILE* sgeOpenFile | ( | const char * | filename, |
| const char * | encryptionkey | ||
| ) |
Open a sge archive created with sga.
| filename | The name of the archive file |
| encryptionkey | The password of the file |
A sge archive is not automatically read into memory, it may be much larger then the available ram. Think of it more like a encrypted disk image.
Please note, this uses a very simple encryption. It is meant to prevent standard users from extracting your game data. It is not hack safe and is not intended to hold real security relevand information.
Definition at line 31 of file sgeresource.c.
| void* sgeReadFile | ( | SGEFILE * | f, |
| const char * | filename | ||
| ) |
Read a file from the archive to memory.
| f | A SGEFILE object |
| filename | The filename to read |
Definition at line 182 of file sgeresource.c.
| SDL_Surface* sgeReadImage | ( | SGEFILE * | f, |
| const char * | filename | ||
| ) |
Read a video accelerated image file from archive.
| f | A SGEFILE object |
| filename | The filename to read |
The image will be hold in video ram if possible, use only on images you really need for your actual game drawing functions.
Definition at line 218 of file sgeresource.c.
| SDL_Surface* sgeReadImageMemory | ( | SGEFILE * | f, |
| const char * | filename | ||
| ) |
Read a image file from archive into RAM.
| f | A SGEFILE object |
| filename | The filename to read |
The image will be hold in the computers RAM. Use on images that are not that important to draw fast, otherwise use sgeReadImage
Definition at line 222 of file sgeresource.c.
| Mix_Chunk* sgeReadSound | ( | SGEFILE * | f, |
| const char * | filename | ||
| ) |
Read a sound file from archive.
| f | A SGEFILE object |
| filename | The filename to read |
Definition at line 226 of file sgeresource.c.