当前位置: 首页>>代码示例>>C++>>正文


C++ Point2D::moveBy方法代码示例

本文整理汇总了C++中Point2D::moveBy方法的典型用法代码示例。如果您正苦于以下问题:C++ Point2D::moveBy方法的具体用法?C++ Point2D::moveBy怎么用?C++ Point2D::moveBy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Point2D的用法示例。


在下文中一共展示了Point2D::moveBy方法的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;
		}
	}
开发者ID:julienvaslet,项目名称:arcade,代码行数:72,代码来源:ConfigScene.cpp


注:本文中的Point2D::moveBy方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。