Codex Documentation


Welcome to Codex documentation. Here you will find a detailed view of all Codex classes.
If you are looking for support, you can visit the official website at

CSS based on SFML1.6 documentation

Short Example

Example of encoding structured data to a file:

 #include <Codex/Default.hpp>
 // An hardcoded secret key for example purposes
 char SECRET_KEY[16] = {
    0xd8, 0x44, 0x3d, 0x09, 0x8c, 0x86, 0x47, 0x17,
    0x00, 0x69, 0x49, 0x74, 0x96, 0xb2, 0xba, 0x94
 // A resource class for serialization
 class MyResource: public cx::Resource{
     bool myBool;
     float myFloat;
     // Constructor
     Batery(bool aBool, float aFloat): myBool(aBool), myFloat(aFloat){}
     // Save MyResource to output
     void write(cx::DataOutputStream& output) const{
         output << myBool << myFloat;
     // Load MyResource from input
     void read(cx::DataInputStream& input){
         input >> myBool >> myFloat
 int main(){
     cx::Compressor compressor;           // default compression filter
     cx::Encrypter encrypter(SECRET_KEY); // default encryption filter
     // Let's compress, then encrypt our data into the file "output.dat"
     cx::FileOutputStream stream(compressor, encrypter, "output.dat");
     // write some data
     stream.writeUint32(524288); // write an unsigned int of 4 bytes
     stream.writeInt16(512);     // write a signed integer of 2 bytes
     // write a bool, a float and a string
     stream << true << 3.1415f << "some text";
     // write a resource object
     MyResource rscObj(true, 3.1415f);
     stream << rscObj;
     // close the stream in the end