A small, game development focused asset packager for statically embedding assets.
This is a small and simple to use asset packager for statically embedding assets into an executable. The main focus of this packager is for use with video game assets but isn't limited to them.
Somewhere in your CMakeLists.txt, you can add the following:
# Set the assets files/folders that are to be packaged.
set(Sushi-Package-Assets assets/)
# Add packager library.
add_subdirectory(Sushi-Packager)
target_link_libraries(${PROJECT_NAME} PUBLIC Sushi-Unpacker)
target_include_directories(${PROJECT_NAME} PUBLIC Sushi-Packager/include)And in your code, such as a main.cpp, you can use it like so:
#include <cstdio>
#include <sushi-packager/unpacker.hpp>
int main() {
SushiPackager::Unpacker unpacker;
const char* filename = "filename.txt";
size_t fileSize;
const void* fileData = unpacker.getFile(filename, &fileSize);
if (fileData) {
// File exists and is available in fileData.
printf("%s\n", fileData);
} else {
// File does not exist.
printf("Failed to find file \"%s\".\n", filename);
}
}