コード例 #1
0
ファイル: world.cpp プロジェクト: PaulFSherwood/cplusplus
void World::update()
{
	int timeElapsed_ms = calcTimeElapsed();
	
	// Update all gameobjects
	std::list<GameObject *>::iterator it;
	for(it = objects.begin(); it != objects.end(); )
	{
		// If update returns false, object should be deleted
		if((*it)->update(timeElapsed_ms) == false)
		{
			delete (*it);
			it = objects.erase(it);
		}
		else
			++it;
	}
}
コード例 #2
0
inline unsigned long calcTimeLeft(unsigned long currentTs, unsigned long startTs, unsigned long duration) {
	return isTimePassed(currentTs, startTs, duration) ? 0 : duration - calcTimeElapsed(currentTs, startTs);
}
コード例 #3
0
inline bool isTimePassed(unsigned long currentTs, unsigned long startTs, unsigned long duration) {
	return calcTimeElapsed(currentTs, startTs) >= duration;
}