string IdxSigEntryList::serialize() { header_t bodysize, realbodysize = 0; string buf; vector<IdxSigEntry>::iterator iter; bodysize = bodySize(); appendToBuffer(buf, &bodysize, sizeof(bodysize)); //cout << "list body put in: " << bodysize << endl; for ( iter = list.begin() ; iter != list.end() ; iter++ ) { string tmpbuf; tmpbuf = iter->serialize(); if ( tmpbuf.size() > 0 ) { appendToBuffer(buf, &tmpbuf[0], tmpbuf.size()); } realbodysize += tmpbuf.size(); } assert(realbodysize == bodysize); //cout << realbodysize << "==" << bodysize << endl; return buf; }
string IdxSigEntry::serialize() { header_t totalsize = 0; string buf, tmpbuf; header_t datasize; totalsize = bodySize(); //cout << "IdxSigEntry totalsize put in: " << totalsize << endl; appendToBuffer(buf, &totalsize, sizeof(totalsize)); appendToBuffer(buf, &original_chunk, sizeof(original_chunk)); appendToBuffer(buf, &new_chunk_id, sizeof(new_chunk_id)); //cout << "IdxSigEntry original_chunk put in: " << original_chunk << endl; //this tmpbuf includes [data size][data] tmpbuf = logical_offset.serialize(); appendToBuffer(buf, &tmpbuf[0], tmpbuf.size()); tmpbuf = length.serialize(); appendToBuffer(buf, &tmpbuf[0], tmpbuf.size()); tmpbuf = physical_offset.serialize(); appendToBuffer(buf, &tmpbuf[0], tmpbuf.size()); return buf; }
void SceneEditorScreenMain::SetSize(const Vector2 &newSize) { UIScreen::SetSize(newSize); Vector2 bodySize(newSize.x, newSize.y - ControlsFactory::BUTTON_HEIGHT - 1); for(int32 i = 0; i < (int32)bodies.size(); ++i) { bodies[i]->bodyControl->SetSize(bodySize); } }
string PatternUnit::serialize() { string buf; //let me put it in string and see if it works header_t seqbodysize; header_t totalsize; totalsize = bodySize(); appendToBuffer(buf, &totalsize, sizeof(totalsize)); appendToBuffer(buf, &init, sizeof(init)); appendToBuffer(buf, &cnt, sizeof(cnt)); seqbodysize = seq.size()*sizeof(off_t); appendToBuffer(buf, &(seqbodysize), sizeof(header_t)); if (seqbodysize > 0 ) { appendToBuffer(buf, &seq[0], seqbodysize); } return buf; }
hkpBoxShape* DestructibleBridgeUtil::createBoxShape(hkReal width, hkReal height, hkReal length, hkReal scale) { hkVector4 bodySize(width, height, length); bodySize.mul4(0.5f * scale); return new hkpBoxShape(bodySize, 0); }
unsigned int KPaquet::totalSize() { return headerSize() + bodySize(); }
void EnemySniper::Paint() { DOUBLE2 bodySize(24, 26), leggSize(16, 21); //if( m_AnimationFrame>=3) m_AnimationFrame=0; double newMax = 2 * M_PI / 8; // Kartelig laten bewegen double tussenWaarde = -m_PointingDir.AngleWith(DOUBLE2(1, 0)); tussenWaarde /= newMax; double naKomma = tussenWaarde - (int)tussenWaarde; tussenWaarde = (int)tussenWaarde; if (naKomma > 0.5) ++tussenWaarde; double paintDirRadians = tussenWaarde *newMax; //if( sin(paintDirRadians) < sin(M_PI/8*3) ){ // De y-as is geflipt!! de sinus geeft een omgekeerd resultaat m_AnimationFrame = 0; if (sin(paintDirRadians) < sin(M_PI / 8 * 1)) { m_AnimationFrame = 1; if (sin(paintDirRadians) < sin(-M_PI / 8 * 1)) { m_AnimationFrame = 2; } } //} MATRIX3X2 matCenter, matScale, matTranslate; matCenter.SetAsTranslate(-bodySize.x / 2 + 4, -bodySize.y + 7); if (m_PointingDir.x > 0) { // voor te scalen/flippen matScale.SetAsScale(1, 1); } else matScale.SetAsScale(-1, 1); matTranslate.SetAsTranslate(m_Pos); RECT2 clip; // BODY --------------------------------------- GAME_ENGINE->SetTransformMatrix(matCenter * matScale * matTranslate * (*m_MatViewPtr)); clip.left = m_AnimationFrame * bodySize.x; clip.top = 0; clip.right = clip.left + bodySize.x; clip.bottom = clip.top + bodySize.y; GAME_ENGINE->DrawBitmap(m_BmpSpritePtr, 0, 0, clip); // LEGS --------------------------------------- matCenter.SetAsTranslate(-leggSize.x / 2, 0); //matScale. SetAsScale( m_PointingDir.x, 1); matTranslate.SetAsTranslate(m_Pos); GAME_ENGINE->SetTransformMatrix(matCenter * matScale * matTranslate * (*m_MatViewPtr)); clip.left = 0; clip.top = bodySize.y; clip.right = clip.left + leggSize.x; clip.bottom = clip.top + leggSize.y; GAME_ENGINE->DrawBitmap(m_BmpSpritePtr, 0, 0, clip); /*GAME_ENGINE->SetTransformMatrix((*m_MatViewPtr)); GAME_ENGINE->SetColor(255,0,0, 200); GAME_ENGINE->FillHitRegion(m_HitRegionPtr); GAME_ENGINE->FillEllipse(m_Pos,2,2);//*/ }