_ _ _
_| |_ _| |_ _ _ ___ ___ ___ ___| |_
| . | | | . | | |___| . | .'| _| '_|
|___|___|___|___| | _|__,|___|_,_|
|_|
File Packer for use in games.
- Can pack multiple folders from a CMakeLists.txt configuration
- Can pack folders from C++
- Automatically reads from package if it exists, otherwise it reads from the folder at runtime
The following cmake code will tell dubu-pack to package the assets
and shaders
folders into packaged files.
dubu_pack_package("${PROJECT_SOURCE_DIR}/bin/assets"
"${PROJECT_SOURCE_DIR}/bin/shaders")
#include <dubu_pack/dubu_pack.h>
int main() {
dubu::pack::Packer packer("path/to/assets");
packer.Pack(); // Writes a package file at path/to/assets.dbp
}
#include <dubu_pack/dubu_pack.h>
int main() {
// Opens package file if it exists, otherwise it will read from disk
dubu::pack::Package package("path/to/assets");
// returns a blob containing the file data
auto fileContent = package.GetFileLocator()->ReadFile("test.png");
if (fileContent) {
// do cool image stuff with fileContent
}
}