本文整理汇总了C++中OutputPersistenceBlock类的典型用法代码示例。如果您正苦于以下问题:C++ OutputPersistenceBlock类的具体用法?C++ OutputPersistenceBlock怎么用?C++ OutputPersistenceBlock使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了OutputPersistenceBlock类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: persist
bool WalkRegion::persist(OutputPersistenceBlock &writer) {
bool result = true;
// Persist the parent region
result &= Region::persist(writer);
// Persist the nodes
writer.write((uint32)_nodes.size());
Common::Array<Vertex>::const_iterator it = _nodes.begin();
while (it != _nodes.end()) {
writer.write((int32)it->x);
writer.write((int32)it->y);
++it;
}
// Persist the visibility matrix
writer.write((uint32)_visibilityMatrix.size());
Common::Array< Common::Array<int> >::const_iterator rowIter = _visibilityMatrix.begin();
while (rowIter != _visibilityMatrix.end()) {
writer.write((uint32)rowIter->size());
Common::Array<int>::const_iterator colIter = rowIter->begin();
while (colIter != rowIter->end()) {
writer.write((int32)*colIter);
++colIter;
}
++rowIter;
}
return result;
}
示例2: persist
bool Polygon::persist(OutputPersistenceBlock &writer) {
writer.write(vertexCount);
for (int i = 0; i < vertexCount; ++i) {
writer.write(vertices[i].x);
writer.write(vertices[i].y);
}
return true;
}
示例3: persist
bool Bitmap::persist(OutputPersistenceBlock &writer) {
bool result = true;
result &= RenderObject::persist(writer);
writer.write(_flipH);
writer.write(_flipV);
writer.write(_scaleFactorX);
writer.write(_scaleFactorY);
writer.write(_modulationColor);
writer.write(_originalWidth);
writer.write(_originalHeight);
return result;
}
示例4: persist
bool Text::persist(OutputPersistenceBlock &writer) {
bool result = true;
result &= RenderObject::persist(writer);
writer.write(_modulationColor);
writer.writeString(_font);
writer.writeString(_text);
writer.write(_autoWrap);
writer.write(_autoWrapThreshold);
result &= RenderObject::persistChildren(writer);
return result;
}
示例5: persist
bool InputEngine::persist(OutputPersistenceBlock &writer) {
// Write out the number of command callbacks and their names.
// Note: We do this only for compatibility with older engines resp.
// the original engine.
writer.write((uint32)1);
writer.writeString("LuaCommandCB");
// Write out the number of command callbacks and their names.
// Note: We do this only for compatibility with older engines resp.
// the original engine.
writer.write((uint32)1);
writer.writeString("LuaCharacterCB");
return true;
}
示例6: persist
bool AnimationTemplate::persist(OutputPersistenceBlock &writer) {
bool Result = true;
// Parent persistieren.
Result &= AnimationDescription::persist(writer);
// Frameanzahl schreiben.
writer.write(_frames.size());
// Frames einzeln persistieren.
Common::Array<const Frame>::const_iterator Iter = _frames.begin();
while (Iter != _frames.end()) {
writer.write(Iter->hotspotX);
writer.write(Iter->hotspotY);
writer.write(Iter->flipV);
writer.write(Iter->flipH);
writer.writeString(Iter->fileName);
writer.writeString(Iter->action);
++Iter;
}
// Restliche Member persistieren.
writer.writeString(_sourceAnimationPtr->getFileName());
writer.write(_valid);
return Result;
}
示例7: persist
bool StaticBitmap::persist(OutputPersistenceBlock &writer) {
bool result = true;
result &= Bitmap::persist(writer);
writer.writeString(_resourceFilename);
result &= RenderObject::persistChildren(writer);
return result;
}
示例8: persist
bool RenderObjectManager::persist(OutputPersistenceBlock &writer) {
bool result = true;
// Alle Kinder des Wurzelknotens speichern. Dadurch werden alle BS_RenderObjects gespeichert rekursiv gespeichert.
result &= _rootPtr->persistChildren(writer);
writer.write(_frameStarted);
// Referenzen auf die TimedRenderObjects persistieren.
writer.write((uint32)_timedRenderObjects.size());
RenderObjectList::const_iterator iter = _timedRenderObjects.begin();
while (iter != _timedRenderObjects.end()) {
writer.write((*iter)->getHandle());
++iter;
}
// Alle BS_AnimationTemplates persistieren.
result &= AnimationTemplateRegistry::instance().persist(writer);
return result;
}
示例9: persist
// Persistence
bool Region::persist(OutputPersistenceBlock &writer) {
bool Result = true;
writer.write(static_cast<uint32>(_type));
writer.write(_valid);
writer.write((int32)_position.x);
writer.write((int32)_position.y);
writer.write((uint32)_polygons.size());
Common::Array<Polygon>::iterator It = _polygons.begin();
while (It != _polygons.end()) {
Result &= It->persist(writer);
++It;
}
writer.write((int32)_boundingBox.left);
writer.write((int32)_boundingBox.top);
writer.write((int32)_boundingBox.right);
writer.write((int32)_boundingBox.bottom);
return Result;
}
示例10: persist
bool LuaScriptEngine::persist(OutputPersistenceBlock &writer) {
// Empty the Lua stack. pluto_persist() xepects that the stack is empty except for its parameters
lua_settop(_state, 0);
// Garbage Collection erzwingen.
lua_gc(_state, LUA_GCCOLLECT, 0);
// Permanents-Table is set on the stack
// pluto_persist expects these two items on the Lua stack
pushPermanentsTable(_state, PTT_PERSIST);
lua_getglobal(_state, "_G");
// Lua persists and stores the data in a Common::Array
Common::Array<byte> chunkData;
pluto_persist(_state, chunkwriter, &chunkData);
// Persistenzdaten in den Writer schreiben.
writer.writeByteArray(chunkData);
// Die beiden Tabellen vom Stack nehmen.
lua_pop(_state, 2);
return true;
}
示例11: error
bool PersistenceService::saveGame(uint slotID, const Common::String &screenshotFilename) {
// FIXME: This code is a hack which bypasses the savefile API,
// and should eventually be removed.
// Überprüfen, ob die Slot-ID zulässig ist.
if (slotID >= SLOT_COUNT) {
error("Tried to save to an invalid slot (%d). Only slot ids form 0 to %d are allowed.", slotID, SLOT_COUNT - 1);
return false;
}
// Dateinamen erzeugen.
Common::String filename = generateSavegameFilename(slotID);
// Spielstanddatei öffnen und die Headerdaten schreiben.
Common::SaveFileManager *sfm = g_system->getSavefileManager();
Common::OutSaveFile *file = sfm->openForSaving(filename);
file->writeString(FILE_MARKER);
file->writeByte(0);
file->writeString(VERSIONID);
file->writeByte(0);
char buf[20];
snprintf(buf, 20, "%d", VERSIONNUM);
file->writeString(buf);
file->writeByte(0);
TimeDate dt;
g_system->getTimeAndDate(dt);
file->writeString(formatTimestamp(dt));
file->writeByte(0);
if (file->err()) {
error("Unable to write header data to savegame file \"%s\".", filename.c_str());
}
// Alle notwendigen Module persistieren.
OutputPersistenceBlock writer;
bool success = true;
success &= Kernel::getInstance()->getScript()->persist(writer);
success &= RegionRegistry::instance().persist(writer);
success &= Kernel::getInstance()->getGfx()->persist(writer);
success &= Kernel::getInstance()->getSfx()->persist(writer);
success &= Kernel::getInstance()->getInput()->persist(writer);
if (!success) {
error("Unable to persist modules for savegame file \"%s\".", filename.c_str());
}
// Write the save game data uncompressed, since the final saved game will be
// compressed anyway.
char sBuffer[10];
snprintf(sBuffer, 10, "%u", writer.getDataSize());
file->writeString(sBuffer);
file->writeByte(0);
snprintf(sBuffer, 10, "%u", writer.getDataSize());
file->writeString(sBuffer);
file->writeByte(0);
file->write(writer.getData(), writer.getDataSize());
// Get the screenshot
Common::SeekableReadStream *thumbnail = Kernel::getInstance()->getGfx()->getThumbnail();
if (thumbnail) {
byte *buffer = new byte[FILE_COPY_BUFFER_SIZE];
thumbnail->seek(0, SEEK_SET);
while (!thumbnail->eos()) {
int bytesRead = thumbnail->read(&buffer[0], FILE_COPY_BUFFER_SIZE);
file->write(&buffer[0], bytesRead);
}
delete[] buffer;
} else {
warning("The screenshot file \"%s\" does not exist. Savegame is written without a screenshot.", filename.c_str());
}
file->finalize();
delete file;
// Savegameinformationen für diesen Slot aktualisieren.
_impl->readSlotSavegameInformation(slotID);
// Empty the cache, to remove old thumbnails
Kernel::getInstance()->getResourceManager()->emptyThumbnailCache();
// Erfolg signalisieren.
return true;
}
示例12: persist
bool SoundEngine::persist(OutputPersistenceBlock &writer) {
writer.write(_maxHandleId);
for (uint i = 0; i < SOUND_HANDLES; i++) {
writer.write(_handles[i].id);
// Don't restart sounds which already finished playing.
if (_handles[i].type != kFreeHandle && !_mixer->isSoundHandleActive(_handles[i].handle))
_handles[i].type = kFreeHandle;
writer.writeString(_handles[i].fileName);
if (_handles[i].type == kFreeHandle)
writer.write((int32)-1);
else
writer.write(_handles[i].sndType);
writer.write(_handles[i].volume);
writer.write(_handles[i].pan);
writer.write(_handles[i].loop);
writer.write(_handles[i].loopStart);
writer.write(_handles[i].loopEnd);
writer.write(_handles[i].layer);
}
return true;
}