本文整理汇总了C++中WorldPtr::getHeight方法的典型用法代码示例。如果您正苦于以下问题:C++ WorldPtr::getHeight方法的具体用法?C++ WorldPtr::getHeight怎么用?C++ WorldPtr::getHeight使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WorldPtr
的用法示例。
在下文中一共展示了WorldPtr::getHeight方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: initRenderingContext
void AbstractGLDisplayHelper::initRenderingContext(WorldPtr world)
{
int height = world->getHeight();
int width = world->getWidth();
int depth = world->getDepth();
int pixelResolution = world->getPixelResolution();
_renderContext = std::make_shared<OpenGLRenderContext>(width, height, depth, pixelResolution);
}
示例2:
void GL2DDisplayHelper::paintSingleSolution(WorldPtr world, PartLocationListPtr parts)
{
for (tuple<PartOrientationPtr, Point>& partLocation : *parts)
{
PartOrientationPtr currentOrientation = std::get<0>(partLocation);
Point anchorPartPoint = std::get<1>(partLocation);
RGB_COLOR orientationColor = _colorManager->getColor(*currentOrientation);
float r = std::get<0>(orientationColor);
float g = std::get<1>(orientationColor);
float b = std::get<2>(orientationColor);
float a;
r /= 255.0;
g /= 255.0;
b /= 255.0;
a = 1.0f;
for (Point& relativePartCoordinate : *(currentOrientation->getPointList()))
{
Point point = anchorPartPoint + relativePartCoordinate;
// Paint a square for each unmasked pixel in the world
float v1x = point.getX();
float v1y = world->getHeight() - point.getY() - 1; // OpenGL Y axis is inverted
float v2x = v1x + SQUARE_SIZE;
float v2y = v1y;
float v3x = v1x;
float v3y = v1y + SQUARE_SIZE;
float v4x = v1x + SQUARE_SIZE;
float v4y = v1y + SQUARE_SIZE;
_renderContext->write2DTriangle(v1x, v1y, v2x, v2y, v3x, v3y, r, g, b, a);
_renderContext->write2DTriangle(v2x, v2y, v3x, v3y, v4x, v4y, r, g, b, a);
if (currentOrientation->isContainsPointAbovePoint(relativePartCoordinate))
_renderContext->writeLine(v1x, v1y, v2x, v2y);
else
_renderContext->writeBoldLine(v1x, v1y, v2x, v2y);
if (currentOrientation->isContainsPointRightOfPoint(relativePartCoordinate))
_renderContext->writeLine(v2x, v2y, v4x, v4y);
else
_renderContext->writeBoldLine(v2x, v2y, v4x, v4y);
if (currentOrientation->isContainsPointBelowPoint(relativePartCoordinate))
_renderContext->writeLine(v3x, v3y, v4x, v4y);
else
_renderContext->writeBoldLine(v3x, v3y, v4x, v4y);
if (currentOrientation->isContainsPointLeftPoint(relativePartCoordinate))
_renderContext->writeLine(v3x, v3y, v1x, v1y);
else
_renderContext->writeBoldLine(v3x, v3y, v1x, v1y);
}
}
}