{"id":16186973,"url":"https://github.com/robloach/raylib-physfs","last_synced_at":"2025-07-05T06:35:38.088Z","repository":{"id":43163874,"uuid":"352266731","full_name":"RobLoach/raylib-physfs","owner":"RobLoach","description":"Integrate PhysFS with raylib to load images, audio, and fonts, from .zip files.","archived":false,"fork":false,"pushed_at":"2023-09-10T20:22:13.000Z","size":1876,"stargazers_count":30,"open_issues_count":0,"forks_count":5,"subscribers_count":3,"default_branch":"master","last_synced_at":"2023-09-10T21:29:48.167Z","etag":null,"topics":["physfs","raylib"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"zlib","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/RobLoach.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-03-28T07:23:29.000Z","updated_at":"2024-06-15T18:45:47.249Z","dependencies_parsed_at":"2024-06-15T18:45:45.468Z","dependency_job_id":"fc2a5197-a14d-4711-ba96-a5f53634859a","html_url":"https://github.com/RobLoach/raylib-physfs","commit_stats":null,"previous_names":[],"tags_count":16,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RobLoach%2Fraylib-physfs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RobLoach%2Fraylib-physfs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RobLoach%2Fraylib-physfs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RobLoach%2Fraylib-physfs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RobLoach","download_url":"https://codeload.github.com/RobLoach/raylib-physfs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243963598,"owners_count":20375648,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["physfs","raylib"],"created_at":"2024-10-10T07:19:58.067Z","updated_at":"2025-03-19T03:30:36.451Z","avatar_url":"https://github.com/RobLoach.png","language":"C","readme":"# raylib-physfs\n\n[![Tests](https://github.com/RobLoach/raylib-physfs/actions/workflows/Tests.yml/badge.svg)](https://github.com/RobLoach/raylib-physfs/actions/workflows/Tests.yml)\n\nLoad [raylib](https://www.raylib.com/) images, sounds, music, fonts and shaders from data archives, like `.zip` files, through [PhysicsFS](https://github.com/icculus/physfs).\n\n[![Screenshot of textures_image_loading example](examples/textures/textures_image_loading.png)](examples/textures/textures_image_loading.c)\n\n## Features\n\n- Load various assets from data archives, including Images, Textures, Music, Waves, Fonts, Text, Data and Shaders\n- Check if directories and files exist within archives\n- Enumerate across multiple archives and mounted paths\n- Save files through PhysFS\n- Set all file loading to use PhysFS via `SetPhysFSCallbacks()`\n- Find the user's configuration directory with `GetPerfDirectory()`\n\n## Usage\n\nThis is a header-only library. To use it, you have to do two things...\n\n1. Link both the raylib and physfs libraries. With CMake, you will see examples of linking physfs in [examples/CMakeLists.txt](examples/CMakeLists.txt)\n2. Define `RAYLIB_PHYSFS_IMPLEMENTATION` in one `.c` source file before including [`raylib-physfs.h`](include/raylib-physfs.h)\n\n### Example\n\nThe below example will initialize PhysFS, mount a .zip file, and then load an Image directly from the .zip.\n\n``` c\n#define RAYLIB_PHYSFS_IMPLEMENTATION\n#include \"raylib-physfs.h\"\n\nint main() {\n    // Initiatize the file system.\n    InitPhysFS();\n\n    // Mount a directory or archive into a given namespace.\n    MountPhysFS(\"assets.zip\", \"assets\");\n\n    // Load an image through PhysFS directly from assets.zip.\n    Image dog = LoadImageFromPhysFS(\"assets/dog.png\");\n\n    // Close the file system.\n    ClosePhysFS();\n}\n```\n\n### API\n\n``` c\nbool InitPhysFS();                                              // Initialize the PhysFS file system\nbool InitPhysFSEx(const char* newDir, const char* mountPoint);  // Initialize the PhysFS file system with a mount point.\nbool ClosePhysFS();                                             // Close the PhysFS file system\nbool IsPhysFSReady();                                           // Check if PhysFS has been initialized successfully\nbool MountPhysFS(const char* newDir, const char* mountPoint);   // Mount the given directory or archive as a mount point\nbool MountPhysFSFromMemory(const unsigned char *fileData, int dataSize, const char* newDir, const char* mountPoint);  // Mount the given file data as a mount point\nbool UnmountPhysFS(const char* oldDir);                         // Unmounts the given directory\nbool FileExistsInPhysFS(const char* fileName);                  // Check if the given file exists in PhysFS\nbool DirectoryExistsInPhysFS(const char* dirPath);              // Check if the given directory exists in PhysFS\nunsigned char* LoadFileDataFromPhysFS(const char* fileName, unsigned int* bytesRead);  // Load a data buffer from PhysFS (memory should be freed)\nchar* LoadFileTextFromPhysFS(const char* fileName);             // Load text from a file (memory should be freed)\nbool SetPhysFSWriteDirectory(const char* newDir);               // Set the base directory where PhysFS should write files to (defaults to the current working directory)\nbool SaveFileDataToPhysFS(const char* fileName, void* data, unsigned int bytesToWrite);  // Save the given file data in PhysFS\nbool SaveFileTextToPhysFS(const char* fileName, char* text);    // Save the given file text in PhysFS\nFilePathList LoadDirectoryFilesFromPhysFS(const char* dirPath);  // Get filenames in a directory path (memory should be freed)\nlong GetFileModTimeFromPhysFS(const char* fileName);            // Get file modification time (last write time) from PhysFS\nImage LoadImageFromPhysFS(const char* fileName);                // Load an image from PhysFS\nTexture2D LoadTextureFromPhysFS(const char* fileName);          // Load a texture from PhysFS\nWave LoadWaveFromPhysFS(const char* fileName);                  // Load wave data from PhysFS\nMusic LoadMusicStreamFromPhysFS(const char* fileName);          // Load music data from PhysFS\nFont LoadFontFromPhysFS(const char* fileName, int fontSize, int *fontChars, int charsCount);  // Load a font from PhysFS\nShader LoadShaderFromPhysFS(const char* vsFileName, const char* fsFileName);  // Load shader from PhysFS\nvoid SetPhysFSCallbacks();                                      // Set the raylib file loader/saver callbacks to use PhysFS\nconst char* GetPerfDirectory(const char *organization, const char *application); // Get the user's current config directory for the application.\n```\n\n### Defines\n\nHave a look at [Cmake config](CMakeLists.txt) to see how to define different things that change the behavior of physfs, raylib, and raylib-physfs.\n\n## Development\n\nTo build the examples locally, and run tests, use [cmake](https://cmake.org/).\n\n``` bash\ngit clone https://github.com/RobLoach/raylib-physfs.git\ncd raylib-physfs\nmkdir build\ncd build\ncmake ..\nmake\nmake test\ncd examples\n./textures_image_loading\n```\n\n## Alternatives\n\nWhile physfs is great, there are alternative file systems available...\n- [raylib-assetsys](https://github.com/RobLoach/raylib-assetsys)\n\n## License\n\n*raylib-physfs* is licensed under an unmodified zlib/libpng license, which is an OSI-certified, BSD-like license that allows static linking with closed source software. Check [LICENSE](LICENSE) for further details.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobloach%2Fraylib-physfs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frobloach%2Fraylib-physfs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobloach%2Fraylib-physfs/lists"}