All Projects → RobLoach → raylib-physfs

RobLoach / raylib-physfs

Licence: Zlib license
Integrate PhysFS with raylib to load images, audio, and fonts, from .zip files.

Programming Languages

c
50402 projects - #5 most used programming language
CMake
9771 projects

Projects that are alternatives of or similar to raylib-physfs

raylib-nelua
Raylib wrapper to nelua language
Stars: ✭ 27 (+28.57%)
Mutual labels:  raylib
raster-master
Raster Master Sprite/Icon/Map editor for Windows 10/11 that generates RayLib code / Put image and map code for Open Watcom, gcc, AmigaBASIC, Amiga C, Amiga Pascal ,QuickBasic, QB64, Quick C, Turbo Pascal, freepascal, Turbo C, Turbo Basic, Power Basic, FreeBASIC, GWBASIC, BASICA, PC-BASIC,, DOS XLIB LBM/PBM
Stars: ✭ 40 (+90.48%)
Mutual labels:  raylib
ecs
Build your own Game-Engine based on the Entity Component System concept in Golang.
Stars: ✭ 68 (+223.81%)
Mutual labels:  raylib
tbag
Tea-bag is Third party extension utility project
Stars: ✭ 13 (-38.1%)
Mutual labels:  raylib
raylib-cpp-starter
A portable, automated template for raylib projects with C++ bindings
Stars: ✭ 32 (+52.38%)
Mutual labels:  raylib
rPBR
Physically based rendering (PBR) for raylib
Stars: ✭ 72 (+242.86%)
Mutual labels:  raylib
raylib-odin
Odin bindings for the raylib gamedev library
Stars: ✭ 29 (+38.1%)
Mutual labels:  raylib
learn-dlang
Learn D programming language by creating games!
Stars: ✭ 42 (+100%)
Mutual labels:  raylib
Raylib
A simple and easy-to-use library to enjoy videogames programming
Stars: ✭ 8,169 (+38800%)
Mutual labels:  raylib
nelua-tetris
Tetris game clone made in Nelua with Raylib
Stars: ✭ 16 (-23.81%)
Mutual labels:  raylib
nelua-game2048
Clone of the 2048 game in Nelua using Raylib
Stars: ✭ 16 (-23.81%)
Mutual labels:  raylib
raylib-php
PHP 8 Bindings to raylib
Stars: ✭ 112 (+433.33%)
Mutual labels:  raylib
FNode
Tool based in nodes to build GLSL shaders without any programming knowledge written in C using OpenGL and GLFW.
Stars: ✭ 81 (+285.71%)
Mutual labels:  raylib
raylib-lua
A modern LuaJIT binding for Raylib (also available at https://gitlab.com/TSnake41/raylib-lua)
Stars: ✭ 47 (+123.81%)
Mutual labels:  raylib
raylib-nuklear
Nuklear immediate mode GUI for raylib
Stars: ✭ 47 (+123.81%)
Mutual labels:  raylib
cl-raylib
Common Lisp binding of raylib
Stars: ✭ 72 (+242.86%)
Mutual labels:  raylib
ruck
🧬 Modularised Evolutionary Algorithms For Python with Optional JIT and Multiprocessing (Ray) support. Inspired by PyTorch Lightning
Stars: ✭ 50 (+138.1%)
Mutual labels:  raylib
GameSystemsInC
Game systems for games in C. Examples using Raylib.
Stars: ✭ 16 (-23.81%)
Mutual labels:  raylib
Raylib-Forever
:.raylib headers for Nim anytime.:
Stars: ✭ 63 (+200%)
Mutual labels:  raylib
raylua
Cross-Platform, Modern, And updated LuaJIT bindings for raylib library.
Stars: ✭ 77 (+266.67%)
Mutual labels:  raylib

raylib-physfs

Tests

Load raylib images, sounds, music, fonts and shaders from data archives, like .zip files, through PhysicsFS.

Features

  • Load various assets from data archives, including Images, Textures, Music, Waves, Fonts, Text, Data and Shaders
  • Check if directories and files exist within archives
  • Enumerate across multiple archives and mounted paths
  • Save files through PhysFS
  • Set all file loading to use PhysFS via SetPhysFSCallbacks()
  • Find the user's configuration directory with GetPerfDirectory()

Usage

This is a header-only library. To use it, you have to do two things...

  1. Link both the raylib and physfs libraries. With CMake, you will see examples of linking physfs in examples/CMakeLists.txt
  2. Define RAYLIB_PHYSFS_IMPLEMENTATION in one .c source file before including raylib-physfs.h

Example

The below example will initialize PhysFS, mount a .zip file, and then load an Image directly from the .zip.

#define RAYLIB_PHYSFS_IMPLEMENTATION
#include "raylib-physfs.h"

int main() {
    // Initiatize the file system.
    InitPhysFS();

    // Mount a directory or archive into a given namespace.
    MountPhysFS("assets.zip", "assets");

    // Load an image through PhysFS directly from assets.zip.
    Image dog = LoadImageFromPhysFS("assets/dog.png");

    // Close the file system.
    ClosePhysFS();
}

API

bool InitPhysFS();                                              // Initialize the PhysFS file system
bool ClosePhysFS();                                             // Close the PhysFS file system
bool IsPhysFSReady();                                           // Check if PhysFS has been initialized successfully
bool MountPhysFS(const char* newDir, const char* mountPoint);   // Mount the given directory or archive as a mount point
bool MountPhysFSFromMemory(const unsigned char *fileData, int dataSize, const char* newDir, const char* mountPoint);  // Mount the given file data as a mount point
bool UnmountPhysFS(const char* oldDir);                         // Unmounts the given directory
bool FileExistsInPhysFS(const char* fileName);                  // Check if the given file exists in PhysFS
bool DirectoryExistsInPhysFS(const char* dirPath);              // Check if the given directory exists in PhysFS
unsigned char* LoadFileDataFromPhysFS(const char* fileName, unsigned int* bytesRead);  // Load a data buffer from PhysFS (memory should be freed)
char* LoadFileTextFromPhysFS(const char* fileName);             // Load text from a file (memory should be freed)
bool SetPhysFSWriteDirectory(const char* newDir);               // Set the base directory where PhysFS should write files to (defaults to the current working directory)
bool SaveFileDataToPhysFS(const char* fileName, void* data, unsigned int bytesToWrite);  // Save the given file data in PhysFS
bool SaveFileTextToPhysFS(const char* fileName, char* text);    // Save the given file text in PhysFS
char** GetDirectoryFilesFromPhysFS(const char* dirPath, int* count);  // Get filenames in a directory path (memory should be freed)
void ClearDirectoryFilesFromPhysFS(char** filesList);           // Clear directory files paths buffers (free memory)
long GetFileModTimeFromPhysFS(const char* fileName);            // Get file modification time (last write time) from PhysFS
Image LoadImageFromPhysFS(const char* fileName);                // Load an image from PhysFS
Texture2D LoadTextureFromPhysFS(const char* fileName);          // Load a texture from PhysFS
Wave LoadWaveFromPhysFS(const char* fileName);                  // Load wave data from PhysFS
Music LoadMusicStreamFromPhysFS(const char* fileName);          // Load music data from PhysFS
Font LoadFontFromPhysFS(const char* fileName, int fontSize, int *fontChars, int charsCount);  // Load a font from PhysFS
Shader LoadShaderFromPhysFS(const char *vsFileName, const char *fsFileName);  // Load shader from PhysFS
void SetPhysFSCallbacks();                                      // Set the raylib file loader/saver callbacks to use PhysFS
const char* GetPerfDirectory(const char *org, const char *app); // Get the user's current config directory for the application.

Defines

Have a look at Cmake config to see how to define different things that change the behavior of physfs, raylib, and raylib-physfs.

Development

To build the examples locally, and run tests, use cmake.

git clone https://github.com/RobLoach/raylib-physfs.git
cd raylib-physfs
mkdir build
cd build
cmake ..
make
make test
cd examples
./textures_image_loading

License

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 for further details.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].