本文整理汇总了C++中common::Rect::findIntersectingRect方法的典型用法代码示例。如果您正苦于以下问题:C++ Rect::findIntersectingRect方法的具体用法?C++ Rect::findIntersectingRect怎么用?C++ Rect::findIntersectingRect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类common::Rect
的用法示例。
在下文中一共展示了Rect::findIntersectingRect方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: rectSubtract
int BbvsEngine::rectSubtract(const Common::Rect &rect1, const Common::Rect &rect2, Common::Rect *outRects) {
int count = 0;
Common::Rect workRect = rect1.findIntersectingRect(rect2);
if (!workRect.isEmpty()) {
count = 0;
outRects[count] = Common::Rect(rect2.width(), workRect.top - rect2.top);
if (!outRects[count].isEmpty()) {
outRects[count].translate(rect2.left, rect2.top);
++count;
}
outRects[count] = Common::Rect(workRect.left - rect2.left, workRect.height());
if (!outRects[count].isEmpty()) {
outRects[count].translate(rect2.left, workRect.top);
++count;
}
outRects[count] = Common::Rect(rect2.right - workRect.right, workRect.height());
if (!outRects[count].isEmpty()) {
outRects[count].translate(workRect.right, workRect.top);
++count;
}
outRects[count] = Common::Rect(rect2.width(), rect2.bottom - workRect.bottom);
if (!outRects[count].isEmpty()) {
outRects[count].translate(rect2.left, workRect.bottom);
++count;
}
} else {
outRects[0] = rect2;
count = 1;
}
return count;
}
示例2: draw
void EnergyMonitor::draw(const Common::Rect &r) {
Common::Rect r2 = r.findIntersectingRect(_levelRect);
if (!r2.isEmpty()) {
Graphics::Surface *screen = ((PegasusEngine *)g_engine)->_gfx->getWorkArea();
screen->fillRect(r2, _barColor);
}
}
示例3: draw
void SoundLevel::draw(const Common::Rect &r) {
Common::Rect levelRect(_bounds.right + (8 * (_soundLevel - 12)), _bounds.top, _bounds.right, _bounds.bottom);
levelRect = r.findIntersectingRect(levelRect);
if (!levelRect.isEmpty()) {
Graphics::Surface *screen = ((PegasusEngine *)g_engine)->_gfx->getWorkArea();
screen->fillRect(levelRect, g_system->getScreenFormat().RGBToColor(0, 0, 0));
}
}
示例4: draw
void Movie::draw(const Common::Rect &r) {
Common::Rect worldBounds = _movieBox;
Common::Rect elementBounds;
getBounds(elementBounds);
worldBounds.moveTo(elementBounds.left, elementBounds.top);
Common::Rect r1 = r.findIntersectingRect(worldBounds);
Common::Rect r2 = r1;
r2.translate(_movieBox.left - elementBounds.left, _movieBox.top - elementBounds.top);
drawImage(r2, r1);
}
示例5: drawRect
void Director::drawRect(const Common::Rect &rect) {
_surface.fillRect(rect, 0);
for (uint i = 0; i < _sprites.size(); ++i) {
const Common::Rect &spriteRect = _sprites[i]->getBounds();
Common::Rect interRect = rect.findIntersectingRect(spriteRect);
if (interRect.isEmpty())
continue;
Common::Rect srcRect(interRect);
srcRect.translate(-spriteRect.left, -spriteRect.top);
_surface.transBlitFrom(*_sprites[i]->getDecoder()->getCurrentFrame(), srcRect, interRect, _sprites[i]->getDecoder()->getTransparentColourIndex());
}
}
示例6: drawSlideElement
void Slide::drawSlideElement(const Common::Rect &drawRect, const Common::Rect &oldBounds, DisplayElement *picture) {
if (picture && drawRect.intersects(oldBounds)) {
picture->moveElementTo(oldBounds.left, oldBounds.top);
picture->draw(drawRect.findIntersectingRect(oldBounds));
}
}