This tool was created to embed binary resources into c++ header/source files. It can process multiple files and even directories which makes it useful for IDE integration (pre-build steps).
Hint: The output files are ~5x larger then the binary resources, so only add small binary files!
Commandline
*
directories are scanned recursively Drag & Drop
Graphical Interface
The header file (resources.h) holds the declaration. All added files are members of the RESOURCES structure. The member names are converted to fit the C++ conventions. Invalid characters are replaced by undersores. Member names with a leading number are prefixed by an underscore. All letters are transformed to uppercase for visual purposes. The members are of type RCDATA, which has a data property (unsigned char*
) and a length property (unsigned int). The source file (resources.cpp) implements the data of all members. This file might be large, so treat it carefully. To use the resources you need to include resorces.h and add resources.cpp to your project.
Example:
Lets assume you added logo.png with bin2hpp into resources.h, then you should find a member with a name similar to LOGO_PNG inside the RESOURCES structure. This is how you can access the members:
unsigned char*
logo = RESOURCES::LOGO_PNG.data;
unsigned int logo_size = RESOURCES::LOGO_PNG.length;
Example resources.h file:
Example resources.cpp file: