void RoundConfig::saveFile(const std::string &path) const { ofxXmlSettings settings; writeVec2(settings, "settings:brickSize", _brickSize); settings.setValue("settings:brickGap", _brickGap); writeVec2(settings, "settings:paddleSize", _paddleSize); settings.setValue("settings:ballRadius", _ballRadius); writePhysics(settings, "settings:ball", _ballPhysics); writePhysics(settings, "settings:paddle", _paddlePhysics); writeVec2(settings, "settings:ballInitialVelocity", _ballInitialVelocity); //... settings.save(path); }
void DataOutputStream::writeVec2Array(const osg::Vec2Array* a) { int size = a->size(); writeInt(size); for(int i=0;i<size;i++){ writeVec2((*a)[i]); } if (_verboseOutput) std::cout<<"read/writeVec2Array() ["<<size<<"]"<<std::endl; }
void EntityTemplateInterpreter::generateTestByteCode() { std::ofstream out("autoGenerated.tpl", std::ofstream::binary); writeByte(0xB0, out); writeByte(0x01, out);writeString("size", out); writeByte(0x02, out);writeString("testFloat", out); writeByte(0x03, out);writeString("testString", out); writeByte(0x04, out);writeString("I AM SUCH A STRING", out); writeByte(0x05, out);writeString("testInt", out); writeByte(0x06, out);writeString("ball.png", out); writeByte(0x07, out);writeString("fancy", out); writeByte(0xB1, out); writeVec2(glm::vec2(100,100), out); //Size writeByte(0x01, out); writeFloat(33.544f, out); //testFloat writeByte(0x02, out); writeByte(0xD5, out);writeByte(0x04, out); //testString writeByte(0x03, out); writeVec3(glm::vec3(349,43,435), out); //testInt writeByte(0x05, out); writeByte(0xB2, out); writeByte(0xC0, out); //TextureComponent writeByte(0xD5, out); writeByte(0x06, out); writeUint16(5, out); writeUint16(1, out); writeUint16(3, out); writeUint16(1, out); writeByte(0xC1, out); //ScriptComponent writeByte(0xD5, out); writeByte(0x07, out); writeByte(0xC2, out); //MoveComponent writeFloat(20.f, out); //Acc writeFloat(4.f, out); //Damping writeFloat(20.f, out); //Mass writeFloat(4.f, out); //Deacc writeByte(0xC3, out); //CollisionComponent writeUint16(1, out); //Box Count writeFloat(20.f, out); //x writeFloat(4.f, out); //y writeFloat(20.f, out); //w writeFloat(4.f, out); //h writeByte(0xD5, out); writeByte(0xA7, out); //Trigger Name }