本文整理汇总了C++中common::List::begin方法的典型用法代码示例。如果您正苦于以下问题:C++ List::begin方法的具体用法?C++ List::begin怎么用?C++ List::begin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类common::List
的用法示例。
在下文中一共展示了List::begin方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: listUsableThemes
void ThemeEngine::listUsableThemes(Common::List<ThemeDescriptor> &list) {
#ifndef DISABLE_GUI_BUILTIN_THEME
ThemeDescriptor th;
th.name = "ScummVM Classic Theme (Builtin Version)";
th.id = "builtin";
th.filename.clear();
list.push_back(th);
#endif
if (ConfMan.hasKey("themepath"))
listUsableThemes(Common::FSNode(ConfMan.get("themepath")), list);
listUsableThemes(SearchMan, list);
// Now we need to strip all duplicates
// TODO: It might not be the best idea to strip duplicates. The user might
// have different versions of a specific theme in his paths, thus this code
// might show him the wrong version. The problem is we have no ways of checking
// a theme version currently. Also since we want to avoid saving the full path
// in the config file we can not do any better currently.
Common::List<ThemeDescriptor> output;
for (Common::List<ThemeDescriptor>::const_iterator i = list.begin(); i != list.end(); ++i) {
if (Common::find_if(output.begin(), output.end(), TDComparator(i->id)) == output.end())
output.push_back(*i);
}
list = output;
output.clear();
}
示例2: findCompatibleFormat
/**
* Determines the first matching format between two lists.
*
* @param backend The higher priority list, meant to be a list of formats supported by the backend
* @param frontend The lower priority list, meant to be a list of formats supported by the engine
* @return The first item on the backend list that also occurs on the frontend list
* or PixelFormat::createFormatCLUT8() if no matching formats were found.
*/
inline Graphics::PixelFormat findCompatibleFormat(const Common::List<Graphics::PixelFormat> &backend, const Common::List<Graphics::PixelFormat> &frontend) {
#ifdef USE_RGB_COLOR
for (Common::List<Graphics::PixelFormat>::const_iterator i = backend.begin(); i != backend.end(); ++i) {
for (Common::List<Graphics::PixelFormat>::const_iterator j = frontend.begin(); j != frontend.end(); ++j) {
if (*i == *j)
return *i;
}
}
#endif
return Graphics::PixelFormat::createFormatCLUT8();
}
示例3: findCompatibleFormat
/**
* Determines the first matching format between two lists.
*
* @param backend The higher priority list, meant to be a list of formats supported by the backend
* @param frontend The lower priority list, meant to be a list of formats supported by the engine
* @return The first item on the backend list that also occurs on the frontend list
* or PixelFormat::createFormatCLUT8() if no matching formats were found.
*/
inline PixelFormat findCompatibleFormat(Common::List<PixelFormat> backend, Common::List<PixelFormat> frontend) {
#ifdef USE_RGB_COLOR
for (Common::List<PixelFormat>::iterator i = backend.begin(); i != backend.end(); ++i) {
for (Common::List<PixelFormat>::iterator j = frontend.begin(); j != frontend.end(); ++j) {
if (*i == *j)
return *i;
}
}
#endif
return PixelFormat::createFormatCLUT8();
}
示例4: getNewFrame
void RMWindow::getNewFrame(RMGfxTargetBuffer &bigBuf, Common::Rect *rcBoundEllipse) {
// Get a pointer to the bytes of the source buffer
byte *lpBuf = bigBuf;
if (rcBoundEllipse != NULL) {
// Circular wipe effect
getNewFrameWipe(lpBuf, *rcBoundEllipse);
_wiping = true;
} else if (_wiping) {
// Just finished a wiping effect, so copy the full screen
copyRectToScreen(lpBuf, RM_SX * 2, 0, 0, RM_SX, RM_SY);
_wiping = false;
} else {
// Standard screen copy - iterate through the dirty rects
Common::List<Common::Rect> dirtyRects = bigBuf.getDirtyRects();
Common::List<Common::Rect>::iterator i;
// If showing dirty rects, copy the entire screen background and set up a surface pointer
Graphics::Surface *s = NULL;
if (_showDirtyRects) {
copyRectToScreen(lpBuf, RM_SX * 2, 0, 0, RM_SX, RM_SY);
s = g_system->lockScreen();
}
for (i = dirtyRects.begin(); i != dirtyRects.end(); ++i) {
Common::Rect &r = *i;
const byte *lpSrc = lpBuf + (RM_SX * 2) * r.top + (r.left * 2);
copyRectToScreen(lpSrc, RM_SX * 2, r.left, r.top, r.width(), r.height());
}
if (_showDirtyRects) {
for (i = dirtyRects.begin(); i != dirtyRects.end(); ++i) {
// Frame the copied area with a rectangle
s->frameRect(*i, 0xffffff);
}
g_system->unlockScreen();
}
}
if (_bGrabThumbnail) {
// Need to generate a thumbnail
RMSnapshot s;
s.grabScreenshot(lpBuf, 4, _wThumbBuf);
_bGrabThumbnail = false;
}
// Clear the dirty rect list
bigBuf.clearDirtyRects();
}
示例5: detectMessageFunctionType
SciVersion GameFeatures::detectMessageFunctionType() {
if (_messageFunctionType != SCI_VERSION_NONE)
return _messageFunctionType;
if (getSciVersion() > SCI_VERSION_1_1) {
_messageFunctionType = SCI_VERSION_1_1;
return _messageFunctionType;
} else if (getSciVersion() < SCI_VERSION_1_1) {
_messageFunctionType = SCI_VERSION_1_LATE;
return _messageFunctionType;
}
Common::List<ResourceId> resources = g_sci->getResMan()->listResources(kResourceTypeMessage, -1);
if (resources.empty()) {
// No messages found, so this doesn't really matter anyway...
_messageFunctionType = SCI_VERSION_1_1;
return _messageFunctionType;
}
Resource *res = g_sci->getResMan()->findResource(*resources.begin(), false);
assert(res);
// Only v2 Message resources use the kGetMessage kernel function.
// v3-v5 use the kMessage kernel function.
if (READ_SCI11ENDIAN_UINT32(res->data) / 1000 == 2)
_messageFunctionType = SCI_VERSION_1_LATE;
else
_messageFunctionType = SCI_VERSION_1_1;
debugC(1, kDebugLevelVM, "Detected message function type: %s", getSciVersionDesc(_messageFunctionType));
return _messageFunctionType;
}
示例6: clearList
void clearList(Common::List<T> &list) {
while (!list.empty()) {
T p = list.front();
list.erase(list.begin());
delete p;
}
}
示例7: getThemeFile
Common::String ThemeEngine::getThemeFile(const Common::String &id) {
// FIXME: Actually "default" rather sounds like it should use
// our default theme which would mean "scummmodern" instead
// of the builtin one.
if (id.equalsIgnoreCase("default"))
return Common::String();
// For our builtin theme we don't have to do anything for now too
if (id.equalsIgnoreCase("builtin"))
return Common::String();
Common::FSNode node(id);
// If the given id is a full path we'll just use it
if (node.exists() && (node.isDirectory() || node.getName().matchString("*.zip", true)))
return id;
// FIXME:
// A very ugly hack to map a id to a filename, this will generate
// a complete theme list, thus it is slower than it could be.
// But it is the easiest solution for now.
Common::List<ThemeDescriptor> list;
listUsableThemes(list);
for (Common::List<ThemeDescriptor>::const_iterator i = list.begin(); i != list.end(); ++i) {
if (id.equalsIgnoreCase(i->id))
return i->filename;
}
warning("Could not find theme '%s' falling back to builtin", id.c_str());
// If no matching id has been found we will
// just fall back to the builtin theme
return Common::String();
}
示例8: processVideoEvents
void VideoPlayer::processVideoEvents(Common::List<Common::Event> &stopEvents) {
Common::Event curEvent;
Common::EventManager *eventMan = g_system->getEventManager();
// Process events, and skip video if esc is pressed
while (eventMan->pollEvent(curEvent)) {
if (curEvent.type == Common::EVENT_RTL || curEvent.type == Common::EVENT_QUIT) {
_skipVideo = true;
}
for (Common::List<Common::Event>::const_iterator iter = stopEvents.begin(); iter != stopEvents.end(); iter++) {
if (curEvent.type == iter->type) {
if (iter->type == Common::EVENT_KEYDOWN || iter->type == Common::EVENT_KEYUP) {
if (curEvent.kbd.keycode == iter->kbd.keycode) {
_skipVideo = true;
break;
}
} else {
_skipVideo = true;
break;
}
}
}
}
}
示例9: updateState
void ViewManager::updateState() {
Common::List<View *> viewList = _views;
for (ListIterator i = viewList.begin(); i != viewList.end(); ++i) {
if (_vm->_events->quitFlag)
return;
View *v = *i;
v->updateState();
}
}
示例10: freeList
void Location::freeList(Common::List<T> &list, bool removeAll, Common::MemFunc1<bool, T, Location> filter) {
typedef typename Common::List<T>::iterator iterator;
iterator it = list.begin();
while (it != list.end()) {
T z = *it;
if (!removeAll && filter(this, z)) {
++it;
} else {
z->_commands.clear();
it = list.erase(it);
}
}
}
示例11: initGraphicsMode
void GlkEngine::initGraphicsMode() {
uint width = ConfMan.hasKey("width") ? ConfMan.getInt("width") : 640;
uint height = ConfMan.hasKey("height") ? ConfMan.getInt("height") : 480;
Common::List<Graphics::PixelFormat> formats = g_system->getSupportedFormats();
Graphics::PixelFormat format = formats.front();
for (Common::List<Graphics::PixelFormat>::iterator i = formats.begin(); i != formats.end(); ++i) {
if ((*i).bytesPerPixel > 1) {
format = *i;
break;
}
}
initGraphics(width, height, &format);
}
示例12: play
bool Diving::play(uint16 playerCount, bool hasPearlLocation) {
init();
initScreen();
_vm->_draw->blitInvalidated();
_vm->_video->retrace();
EvilFish shark(*_objects, 320, 0, 14, 8, 9, 3);
Common::List<ANIObject *> objects;
objects.push_back(_water);
objects.push_back(&shark);
shark.enter(EvilFish::kDirectionLeft, 90);
while (!_vm->_util->keyPressed() && !_vm->shouldQuit()) {
int16 left, top, right, bottom;
// Clear the previous animation frames
for (Common::List<ANIObject *>::iterator o = objects.reverse_begin();
o != objects.end(); --o) {
(*o)->clear(*_vm->_draw->_backSurface, left, top, right, bottom);
_vm->_draw->dirtiedRect(_vm->_draw->_backSurface, left, top, right, bottom);
}
// Draw the current animation frames
for (Common::List<ANIObject *>::iterator o = objects.begin();
o != objects.end(); ++o) {
(*o)->draw(*_vm->_draw->_backSurface, left, top, right, bottom);
_vm->_draw->dirtiedRect(_vm->_draw->_backSurface, left, top, right, bottom);
(*o)->advance();
}
_vm->_draw->blitInvalidated();
_vm->_util->waitEndFrame();
_vm->_util->processInput();
}
deinit();
return true;
}
示例13: result
Common::Archive *ResLoaderInsMalcolm::load(Common::ArchiveMemberPtr memberFile, Common::SeekableReadStream &stream) const {
Common::List<Common::String> filenames;
Common::ScopedPtr<PlainArchive> result(new PlainArchive(memberFile));
if (!result)
return 0;
// thanks to eriktorbjorn for this code (a bit modified though)
stream.seek(3, SEEK_SET);
// first file is the index table
uint32 size = stream.readUint32LE();
Common::String temp;
for (uint32 i = 0; i < size; ++i) {
byte c = stream.readByte();
if (c == '\\') {
temp.clear();
} else if (c == 0x0D) {
// line endings are CRLF
c = stream.readByte();
assert(c == 0x0A);
++i;
filenames.push_back(temp);
} else {
temp += (char)c;
}
}
stream.seek(3, SEEK_SET);
for (Common::List<Common::String>::iterator file = filenames.begin(); file != filenames.end(); ++file) {
const uint32 fileSize = stream.readUint32LE();
const uint32 fileOffset = stream.pos();
result->addFileEntry(*file, PlainArchive::Entry(fileOffset, fileSize));
stream.seek(fileSize, SEEK_CUR);
}
return result.release();
}
示例14: interpret
bool ScriptInterpreter::interpret(Common::List<ScriptChunk *> &chunks) {
bool queued = false;
// Create new random variables for the evaluation below
_vm->_variables->reRollRandom();
// Push the first script with met conditions into the queue
for (Common::List<ScriptChunk *>::iterator it = chunks.begin(); it != chunks.end(); ++it) {
if ((*it)->conditionsMet() && _vm->_events->cameFrom((*it)->getFrom())) {
(*it)->rewind();
_scripts.push_back(Script(*it));
queued = true;
break;
}
}
if (queued)
_updatesWithoutChanges = 0;
return queued;
}
示例15:
Common::SeekableReadStream *LangFilter::createReadStreamForMember(const Common::String &name) const {
if (!_arc)
return 0;
//Search the right file
Common::String fullName;
Common::List<Common::String> namesToTry;
namesToTry.push_front(kLanguages1[_lang] + name);
namesToTry.push_front(kLanguages1[kCommon] + name);
namesToTry.push_front(kLanguages2[_lang] + name);
namesToTry.push_front(kLanguages2[kCommon] + name);
for (Common::List<Common::String>::const_iterator it = namesToTry.begin(); it != namesToTry.end(); it++)
if (_arc->hasFile(*it)) {
fullName = *it;
break;
}
if (fullName.empty())
return 0;
return _arc->createReadStreamForMember(fullName);
}