当前位置: 首页>>代码示例>>C++>>正文


C++ List::front方法代码示例

本文整理汇总了C++中common::List::front方法的典型用法代码示例。如果您正苦于以下问题:C++ List::front方法的具体用法?C++ List::front怎么用?C++ List::front使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在common::List的用法示例。


在下文中一共展示了List::front方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: clearList

void clearList(Common::List<T> &list) {
	while (!list.empty()) {
		T p = list.front();
		list.erase(list.begin());
		delete p;
	}
}
开发者ID:salty-horse,项目名称:residualvm,代码行数:7,代码来源:resource.cpp

示例2: 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);
}
开发者ID:fingolfin,项目名称:scummvm,代码行数:15,代码来源:glk.cpp

示例3: purgeText

void EMIEngine::purgeText() {
	Common::List<TextObject *> toDelete;

	foreach (TextObject *t, TextObject::getPool()) {
		if (t->getStackLevel() == 0) {
			toDelete.push_back(t);
		}
	}

	while (!toDelete.empty()) {
		TextObject *t = toDelete.front();
		toDelete.pop_front();
		delete t;
	}

	invalidateTextObjectsSortOrder();
}
开发者ID:sietschie,项目名称:residualvm,代码行数:17,代码来源:emi.cpp

示例4: fillPathArray

int Actor::fillPathArray(const Point &fromPoint, const Point &toPoint, Point &bestPoint) {
	int bestRating;
	int currentRating;
	Point bestPath;
	int pointCounter;
	const PathDirectionData *samplePathDirection;
	Point nextPoint;
	int directionCount;
	int16 compressX = (_vm->getGameId() == GID_ITE) ? 2 : 1;

	Common::List<PathDirectionData> pathDirectionQueue;

	pointCounter = 0;
	bestRating = quickDistance(fromPoint, toPoint, compressX);
	bestPath = fromPoint;

	for (int8 startDirection = 0; startDirection < 4; startDirection++) {
		PathDirectionData tmp = { startDirection, fromPoint.x, fromPoint.y };
		pathDirectionQueue.push_back(tmp);
	}

	if (validPathCellPoint(fromPoint)) {
		setPathCell(fromPoint, kDirUp);

#ifdef ACTOR_DEBUG
		addDebugPoint(fromPoint, 24+36);
#endif
	}

	while (!pathDirectionQueue.empty()) {
		PathDirectionData curPathDirection = pathDirectionQueue.front();
		pathDirectionQueue.pop_front();
		for (directionCount = 0; directionCount < 3; directionCount++) {
			samplePathDirection = &pathDirectionLUT[curPathDirection.direction][directionCount];
			nextPoint = Point(curPathDirection.x, curPathDirection.y);
			nextPoint.x += samplePathDirection->x;
			nextPoint.y += samplePathDirection->y;

			if (!validPathCellPoint(nextPoint)) {
				continue;
			}

			if (getPathCell(nextPoint) != kPathCellEmpty) {
				continue;
			}

			setPathCell(nextPoint, samplePathDirection->direction);

#ifdef ACTOR_DEBUG
			addDebugPoint(nextPoint, samplePathDirection->direction + 96);
#endif
			PathDirectionData tmp = {
				samplePathDirection->direction,
				nextPoint.x, nextPoint.y };
			pathDirectionQueue.push_back(tmp);
			++pointCounter;
			if (nextPoint == toPoint) {
				bestPoint = toPoint;
				return pointCounter;
			}
			currentRating = quickDistance(nextPoint, toPoint, compressX);
			if (currentRating < bestRating) {
				bestRating = currentRating;
				bestPath = nextPoint;
			}
		}
	}

	bestPoint = bestPath;
	return pointCounter;
}
开发者ID:hchen1014,项目名称:scummvm,代码行数:71,代码来源:actor_path.cpp


注:本文中的common::List::front方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。