Exemplo n.º 1
0
void GraphicsSystem::resetAllObjectsProperties() {
  AllocatedLazyArrayIterator<GraphicsObject> it =
    graphics_object_impl_->foreground_objects.allocated_begin();
  AllocatedLazyArrayIterator<GraphicsObject> end =
    graphics_object_impl_->foreground_objects.allocated_end();
  for (; it != end; ++it)
    it->resetProperties();

  it = graphics_object_impl_->background_objects.allocated_begin();
  end = graphics_object_impl_->background_objects.allocated_end();
  for (; it != end; ++it)
    it->resetProperties();
}
Exemplo n.º 2
0
bool GraphicsSystem::animationsPlaying() const {
  AllocatedLazyArrayIterator<GraphicsObject> it =
    graphics_object_impl_->foreground_objects.allocated_begin();
  AllocatedLazyArrayIterator<GraphicsObject> end =
    graphics_object_impl_->foreground_objects.allocated_end();
  for (; it != end; ++it) {
    if (it->hasObjectData()) {
      GraphicsObjectData& data = it->objectData();
      if (data.isAnimation() && data.currentlyPlaying())
        return true;
    }
  }

  return false;
}
Exemplo n.º 3
0
void GraphicsSystem::renderObjects(std::ostream* tree) {
  // Render all visible foreground objects
  AllocatedLazyArrayIterator<GraphicsObject> it =
    graphics_object_impl_->foreground_objects.allocated_begin();
  AllocatedLazyArrayIterator<GraphicsObject> end =
    graphics_object_impl_->foreground_objects.allocated_end();
  for (; it != end; ++it) {
    const ObjectSettings& settings = getObjectSettings(it.pos());
    if (settings.obj_on_off == 1 && showObject1() == false)
      continue;
    else if (settings.obj_on_off == 2 && showObject2() == false)
      continue;
    else if (settings.weather_on_off && showWeather() == false)
      continue;
    else if (settings.space_key && interfaceHidden())
      continue;

    it->render(it.pos(), tree);
  }
}
Exemplo n.º 4
0
void GraphicsSystem::renderObjects(std::ostream* tree) {
  // The tuple is order, layer, depth, objid, GraphicsObject. Tuples are easy
  // to sort.
  typedef std::vector<std::tuple<int, int, int, int, GraphicsObject*> >
      ToRenderVec;
  ToRenderVec to_render;

  // Collate all objects that we might want to render.
  AllocatedLazyArrayIterator<GraphicsObject> it =
    graphics_object_impl_->foreground_objects.allocated_begin();
  AllocatedLazyArrayIterator<GraphicsObject> end =
    graphics_object_impl_->foreground_objects.allocated_end();
  for (; it != end; ++it) {
    const ObjectSettings& settings = getObjectSettings(it.pos());
    if (settings.obj_on_off == 1 && showObject1() == false)
      continue;
    else if (settings.obj_on_off == 2 && showObject2() == false)
      continue;
    else if (settings.weather_on_off && showWeather() == false)
      continue;
    else if (settings.space_key && interfaceHidden())
      continue;

    to_render.push_back(std::make_tuple(
        it->zOrder(), it->zLayer(), it->zDepth(), it.pos(), &*it));
  }

  // Sort by all the ordering values.
  std::sort(to_render.begin(), to_render.end());

  for (ToRenderVec::iterator it = to_render.begin(); it != to_render.end();
       ++it) {
    get<4>(*it)->render(get<3>(*it), NULL, tree);
  }
}