本文整理汇总了C++中TextLayout::addRightLine方法的典型用法代码示例。如果您正苦于以下问题:C++ TextLayout::addRightLine方法的具体用法?C++ TextLayout::addRightLine怎么用?C++ TextLayout::addRightLine使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TextLayout
的用法示例。
在下文中一共展示了TextLayout::addRightLine方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setup
void TextTestApp::setup()
{
printFontNames();
#if defined( CINDER_COCOA_TOUCH )
std::string normalFont( "Arial" );
std::string boldFont( "Arial-BoldMT" );
std::string differentFont( "AmericanTypewriter" );
#else
std::string normalFont( "Arial" );
std::string boldFont( "Arial Bold" );
std::string differentFont( "Papyrus" );
#endif
// Japanese
unsigned char japanese[] = { 0xE6, 0x97, 0xA5, 0xE6, 0x9C, 0xAC, 0xE8, 0xAA, 0x9E, 0 };
// this does a complicated layout
TextLayout layout;
layout.clear( ColorA( 0.2f, 0.2f, 0.2f, 0.2f ) );
layout.setFont( Font( normalFont, 24 ) );
layout.setColor( Color( 1, 1, 1 ) );
layout.addLine( std::string( "Unicode: " ) + (const char*)japanese );
layout.setColor( Color( 0.5f, 0.25f, 0.8f ) );
layout.setFont( Font( boldFont, 12 ) );
layout.addRightLine( "Now is the time" );
layout.setFont( Font( normalFont, 22 ) );
layout.setColor( Color( 0.75f, 0.25f, 0.6f ) );
layout.append( " for all good men" );
layout.addCenteredLine( "center justified" );
layout.addRightLine( "right justified" );
layout.setFont( Font( differentFont, 24 ) );
layout.addCenteredLine( "A different font" );
layout.setFont( Font( normalFont, 22 ) );
layout.setColor( Color( 1.0f, 0.5f, 0.25f ) );
layout.addLine( " • Point 1 " );
layout.setLeadingOffset( -10 );
layout.addLine( " • Other point with -10 leading offset " );
layout.setLeadingOffset( 0 );
layout.setColor( ColorA( 0.25f, 0.5f, 1, 0.5f ) );
layout.addLine( " • Back to regular leading but translucent" );
Surface8u rendered = layout.render( true, PREMULT );
mTexture = gl::Texture( rendered );
// Create a custom font by loading it from a resource
Font customFont( Font( loadResource( RES_CUSTOM_FONT ), 72 ) );
console() << "This font is called " << customFont.getFullName() << std::endl;
TextLayout simple;
simple.setFont( customFont );
simple.setColor( Color( 1, 0, 0.1f ) );
simple.addLine( "Cinder" );
simple.addLine( "Font From Resource" );
mSimpleTexture = gl::Texture( simple.render( true, PREMULT ) );
}