Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/RobLoach/SDL_assetsys
Use the file abstraction library, assetsys, with SDL
https://github.com/RobLoach/SDL_assetsys
Last synced: 3 months ago
JSON representation
Use the file abstraction library, assetsys, with SDL
- Host: GitHub
- URL: https://github.com/RobLoach/SDL_assetsys
- Owner: RobLoach
- License: zlib
- Created: 2023-09-09T18:54:06.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2024-03-19T18:14:51.000Z (10 months ago)
- Last Synced: 2024-03-19T19:35:21.590Z (10 months ago)
- Language: C
- Size: 11.7 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-sdl - SDL_assetsys
README
# SDL_assetsys
Use the file system abstraction library, [assetsys.h](https://github.com/mattiasgustavsson/libs/blob/main/assetsys.h), with SDL.
## API
``` c
SDL_RWops* SDL_RWFromAssetsys(assetsys_t* sys, const char* path);
SDL_Surface* SDL_LoadBMP_Assetsys(sys, path);
SDL_Surface* IMG_Load_Assetsys(sys, path);
SDL_Texture* IMG_LoadTexture_Assetsys(renderer, sys, path);
Mix_Chunk* SDL_LoadWAV_Assetsys(sys, path, spec, audio_buf, audio_len);
Mix_Music* Mix_LoadMUS_Assetsys(sys, path);
Mix_Chunk* Mix_LoadWAV_Assetsys(sys, path);
void* SDL_LoadFile_Assetsys(sys, path, datasize);
SDL_Surface* STBIMG_Load_Assetsys(sys, path);
```## Example
``` c
#include
#include#define SDL_ASSETSYS_IMPLEMENTATION
#include "SDL_assetsys.h"int main(int argc, char* argv[]) {
SDL_Init(0);assetsys_t* sys = assetsys_create(0);
assetsys_mount(sys, "resources", "/res");SDL_RWops* file = SDL_RWFromAssetsys(sys, "/res/test.txt");
int size = SDL_RWsize(file);
char output[256];
SDL_RWread(file, output, 1, size);printf("Output: %s\n", output);
// => Hello, World!SDL_RWclose(file);
assetsys_destroy(sys);
SDL_Quit();return 0;
}
```## License
*SDL_assetsys* 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.