本文整理汇总了C++中Point2D::moveTo方法的典型用法代码示例。如果您正苦于以下问题:C++ Point2D::moveTo方法的具体用法?C++ Point2D::moveTo怎么用?C++ Point2D::moveTo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Point2D
的用法示例。
在下文中一共展示了Point2D::moveTo方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: render
void ConfigScene::render( unsigned int ticks )
{
Point2D textSize;
vector<Point3D> vertices;
vector<Color> colors;
vector<unsigned int short> indices;
if( ticks - this->lastDrawTicks > 15 )
{
Screen::get()->clear();
for( vector<ColoredRectangle *>::iterator it = this->rectangles.begin() ; it != this->rectangles.end() ; it++ )
(*it)->prepareRendering( vertices, colors, indices );
ColoredRectangle::render( vertices, colors, indices );
unsigned int screenWidth = Screen::get()->getWidth() - this->left - this->right;
unsigned int screenHeight = Screen::get()->getHeight() - this->top - this->bottom;
// Top
textSize.moveTo( 0, 0 );
Font::get("bitmap")->getTextSize( textSize, this->sTop );
Font::get("bitmap")->write( Point2D( this->left + (screenWidth - textSize.getX()) / 2.0f, this->top + 20 ), this->sTop );
// Left
textSize.moveTo( 0, 0 );
Font::get("bitmap")->getTextSize( textSize, this->sLeft );
Font::get("bitmap")->write( Point2D( this->left + 20, this->top + (screenHeight - textSize.getY()) / 2.0f ), this->sLeft );
// Right
textSize.moveTo( 0, 0 );
Font::get("bitmap")->getTextSize( textSize, this->sRight );
Font::get("bitmap")->write( Point2D( this->left + screenWidth - textSize.getX() - 20, this->top + (screenHeight - textSize.getY()) / 2.0f ), this->sRight );
// Bottom
textSize.moveTo( 0, 0 );
Font::get("bitmap")->getTextSize( textSize, this->sBottom );
Font::get("bitmap")->write( Point2D( this->left + (screenWidth - textSize.getX()) / 2.0f, this->top + screenHeight - textSize.getY() - 20 ), this->sBottom );
// Instructions
textSize.moveTo( 0, this->top + (screenHeight - Font::get("bitmap")->getTextHeight( this->instructions ) ) / 2.0f );
string line;
unsigned int index = 0;
size_t newLineIndex = this->instructions.find( '\n', index );
while( newLineIndex != string::npos )
{
line = this->instructions.substr( index, newLineIndex - index );
textSize.setX( this->left + (screenWidth - Font::get("bitmap")->getTextWidth( line )) / 2.0f );
Font::get("bitmap")->write( textSize, line );
textSize.moveBy( 0, Font::get("bitmap")->getTextHeight( line ) );
index = newLineIndex + 1;
newLineIndex = this->instructions.find( '\n', index );
}
if( index < this->instructions.length() )
{
line = this->instructions.substr( index );
textSize.setX( this->left + (screenWidth - Font::get("bitmap")->getTextWidth( line )) / 2.0f );
Font::get("bitmap")->write( textSize, line );
}
Font::get("bitmap")->render();
Screen::get()->render();
this->lastDrawTicks = ticks;
}
}