diff --git a/README.md b/README.md index 18de4e3..576cb95 100644 --- a/README.md +++ b/README.md @@ -54,12 +54,13 @@ bool SDL_PhysFS_LoadWAV(const char* filename, SDL_AudioSpec* spec, Uint8** audio void* SDL_PhysFS_LoadFile(const char* filename, size_t* datasize); size_t SDL_PhysFS_WriteFile(const char* file, const void* buffer, size_t size); bool SDL_PhysFS_SetWriteDir(const char* path); -const char* SDL_PhysFS_GetWriteDir(void); +const char* SDL_PhysFS_GetWriteDir(); char** SDL_PhysFS_LoadDirectoryFiles(const char* directory); bool SDL_PhysFS_EnumerateDirectory(const char* path, SDL_EnumerateDirectoryCallback callback, void* userdata); void SDL_PhysFS_FreeDirectoryFiles(char** files); bool SDL_PhysFS_Exists(const char* file); SDL_IOStatus SDL_PhysFS_IOStatus(int error); +int SDL_PhysFS_GetVersion(); // Optional Integrations SDL_Surface* SDL_PhysFS_IMG_Load(const char* filename); // SDL_image diff --git a/include/SDL_PhysFS.h b/include/SDL_PhysFS.h index b85a274..3a76d63 100644 --- a/include/SDL_PhysFS.h +++ b/include/SDL_PhysFS.h @@ -1,5 +1,5 @@ /** - * SDL_PhysFS.h v3.1.0 - PhysFS virtual file system support for SDL. + * SDL_PhysFS.h v3.2.1 - PhysFS virtual file system support for SDL. * * https://github.com/RobLoach/SDL_PhysFS * @@ -36,10 +36,17 @@ #endif #endif +#define SDL_PHYSFS_MAJOR_VERSION 3 +#define SDL_PHYSFS_MINOR_VERSION 2 +#define SDL_PHYSFS_MICRO_VERSION 1 +#define SDL_PHYSFS_VERSION SDL_VERSIONNUM(SDL_PHYSFS_MAJOR_VERSION, SDL_PHYSFS_MINOR_VERSION, SDL_PHYSFS_MICRO_VERSION) +#define SDL_PHYSFS_VERSION_ATLEAST(X, Y, Z) (SDL_PHYSFS_VERSION >= SDL_VERSIONNUM(X, Y, Z)) + #ifdef __cplusplus extern "C" { #endif +SDL_PHYSFS_DEF int SDL_PhysFS_GetVersion(void); SDL_PHYSFS_DEF bool SDL_PhysFS_Init(const char* argv); SDL_PHYSFS_DEF bool SDL_PhysFS_InitEx(const char* argv, const char* org, const char* app); SDL_PHYSFS_DEF bool SDL_PhysFS_Quit(); @@ -183,6 +190,15 @@ static void SDL_PhysFS_AllocatorFree(void* mem) { return free_func(mem); } +/** + * Get the version of SDL_PhysFS that is linked against your program. + * + * @return Returns the version of the linked library. + */ +int SDL_PhysFS_GetVersion(void) { + return SDL_PHYSFS_VERSION; +} + /** * Initialize the PhysFS virtual file system. * diff --git a/test/SDL_PhysFS_Test.c b/test/SDL_PhysFS_Test.c index 535f04b..b5cb405 100644 --- a/test/SDL_PhysFS_Test.c +++ b/test/SDL_PhysFS_Test.c @@ -114,6 +114,9 @@ int main(int argc, char* argv[]) { SDL_assert(SDL_PhysFS_Exists("res/test.bmp") == true); SDL_assert(SDL_PhysFS_Exists("res/notfound.txt") == false); + // SDL_PhysFS_GetVersion + SDL_assert(SDL_PhysFS_GetVersion() > 2); + // SDL_PhysFS_LoadDirectoryFiles { char** files = SDL_PhysFS_LoadDirectoryFiles("res");