本文整理汇总了C++中Entity::GetLight方法的典型用法代码示例。如果您正苦于以下问题:C++ Entity::GetLight方法的具体用法?C++ Entity::GetLight怎么用?C++ Entity::GetLight使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Entity
的用法示例。
在下文中一共展示了Entity::GetLight方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CalculateLights
void Map::CalculateLights(bool firstTime) {
if (!firstTime)
{
for (int i = minX; i < maxX; i++)
{
for (int j = minY; j < maxY; j++)
{
blocks[i][j].lightValue = 0;
}
}
}
for (int i = minX; i < maxX; i++)
{
for (int j = minY; j < maxY; j++)
{
if (blocks[i][j].lightSource > 0) {
UpdateLight(i, j, blocks[i][j].lightSource);
}
}
}
Entity* entity;
for (std::vector<Entity*>::iterator it = entities.begin(); it != entities.end(); ++it)
{
entity = (*it);
if (entity->GetLight() > 0)
UpdateLight((int) entity->shape->GetCenterX(), (int) entity->shape->GetCenterY(), entity->GetLight());
}
}
示例2: Update
void Map::Update()
{
for (std::vector<Entity*>::iterator it = entities.begin(); it != entities.end();)
{
if ((*it)->active)
++it;
else {
delete *it;
it = entities.erase(it);
}
}
HandleCollision();
HandleEvents();
Entity* entity;
for (std::vector<Entity*>::iterator it = entities.begin(); it != entities.end(); ++it)
{
entity = (*it);
if (entity->OnScreen == false)
continue;
if (entity->GetLight() > 0 && ((int) entity->shape->GetCenterX() != (int) (entity->prevPos.x + entity->GetSize().x / 2.0) || (int) entity->shape->GetCenterY() != (int) (entity->prevPos.y + entity->GetSize().y / 2.0)))
lightDirty = true;
}
skyManager->Update();
}