コード例 #1
0
ファイル: editor_level.cpp プロジェクト: drewbug/pingus
void
EditorLevel::lower_object(LevelObjPtr obj)
{
  Objects::reverse_iterator i = std::find(impl->objects.rbegin(), impl->objects.rend(), obj);
  if (i == impl->objects.rend())
  {
    log_error("couldn't find object: %1%", obj);
  }
  else
  {
    Objects::reverse_iterator j = i;
    ++j;
    j = std::find_if(j, impl->objects.rend(), OverlapsWith(obj->get_rect()));

    if (j == impl->objects.rend())
    {
      // object overlaps with no other object, no point in lowering it
    }
    else
    {
      // the base() of base in one further then where the reverse
      // iterator was, so we have to move back to get the same
      // position
      impl->objects.erase(--(i.base()));
      impl->objects.insert(--(j.base()), obj);
    }
  }
}
コード例 #2
0
ファイル: editor_level.cpp プロジェクト: drewbug/pingus
void
EditorLevel::raise_object(LevelObjPtr obj)
{
  Objects::iterator i = std::find(impl->objects.begin(), impl->objects.end(), obj);
  if (i == impl->objects.end())
  {
    log_error("couldn't find object: %1%", obj);
  }
  else
  {
    Objects::iterator j = i;
    ++j;
    j = std::find_if(j, impl->objects.end(), OverlapsWith(obj->get_rect()));

    if (j == impl->objects.end())
    {
      // object overlaps with no other object, no point in raising it
    }
    else
    {
      impl->objects.erase(i);
      impl->objects.insert(++j, obj);
    }
  }
}
コード例 #3
0
Boole AxisAlignedQuad::OverlapsWith(const Vector3& Other) const
{
    if(DistanceFromOrigin == Other[AlignedOn])
    {
        return OverlapsWith( DropAxisToCreateVector2(Other, AlignedOn) );
    }
    return false;
}
コード例 #4
0
ファイル: LabelBlock.cpp プロジェクト: Advi42/XCSoar
bool
LabelBlock::Bucket::Check(const PixelRect rc) const
{
  for (auto i = blocks.begin(), end = blocks.end(); i != end; ++i)
    if (i->OverlapsWith(rc))
      return false;

  return true;
}