本文整理汇总了C++中DrawingContext::PushCommand方法的典型用法代码示例。如果您正苦于以下问题:C++ DrawingContext::PushCommand方法的具体用法?C++ DrawingContext::PushCommand怎么用?C++ DrawingContext::PushCommand使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DrawingContext
的用法示例。
在下文中一共展示了DrawingContext::PushCommand方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Draw
void HorizontalLayout::Draw(DrawingContext & drawingContext)
{
UpdateLayout();
POMDOG_ASSERT(!needToUpdateLayout);
auto transform = GetTransform() * drawingContext.Top();
#if 0
renderCommand.SetInvoker([transform, this](PrimitiveBatch& primitiveBatch) {
const Color backgroundColor = {45, 45, 48, 225};
const Color borderColor = {40, 40, 40, 255};
const Color highlightColor = {106, 106, 106, 255};
const auto width = static_cast<float>(GetWidth());
const auto height = static_cast<float>(GetHeight());
primitiveBatch.DrawRectangle(transform, Vector2::Zero, width, height, backgroundColor);
primitiveBatch.DrawLine(transform, Vector2{0.0f, 0.0f}, Vector2{width, 0.0f}, borderColor, 1.0f);
primitiveBatch.DrawLine(transform, Vector2{0.0f, 0.0f}, Vector2{0.0f, height}, borderColor, 1.0f);
primitiveBatch.DrawLine(transform, Vector2{0.0f, height}, Vector2{width, height}, borderColor, 1.0f);
primitiveBatch.DrawLine(transform, Vector2{width, 0.0f}, Vector2{width, height}, borderColor, 1.0f);
});
drawingContext.PushCommand(renderCommand);
#endif
drawingContext.Push(transform);
for (auto & child : children) {
POMDOG_ASSERT(child);
child->Draw(drawingContext);
}
drawingContext.Pop();
}
示例2: Draw
void DisclosureTriangleButton::Draw(DrawingContext & drawingContext)
{
auto transform = GetTransform() * drawingContext.Top();
renderCommand.SetInvoker([this, transform](PrimitiveBatch& primitiveBatch) {
Color thumbColor = isOn ? Color{27, 161, 226, 255} : Color{162, 160, 161, 255};
const auto transformOffset = Vector2{transform(2, 0), transform(2, 1)};
const auto triangleWidth = 6.0f;
if (isOn) {
primitiveBatch.DrawTriangle(
transformOffset + Vector2{0.0f, 0.0f},
transformOffset + Vector2{triangleWidth, triangleWidth},
transformOffset + Vector2{triangleWidth, 0.0f},
thumbColor);
}
else {
const float squareRoot = 1.41421356f;
primitiveBatch.DrawTriangle(
transformOffset + Vector2{0.0f, 0.0f},
transformOffset + Vector2{0.0f, triangleWidth * squareRoot},
transformOffset + Vector2{triangleWidth / squareRoot, triangleWidth * 0.5f * squareRoot},
thumbColor);
}
});
drawingContext.PushCommand(renderCommand);
}
示例3: Draw
void HorizontalLine::Draw(DrawingContext & drawingContext)
{
auto transform = GetTransform() * drawingContext.Top();
renderCommand.SetInvoker([this, transform](PolygonBatch & polygonBatch) {
auto offset = Vector2{transform(2, 0), transform(2, 1)};
auto start = offset + Vector2{0.0f, 0.0f};
auto end = offset + Vector2{static_cast<float>(GetWidth()), 0.0f};
polygonBatch.DrawLine(start, end, Color{92, 91, 90, 255}, 1.0f);
});
drawingContext.PushCommand(renderCommand);
}