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


C++ Text::SetTextAlignment方法代码示例

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


在下文中一共展示了Text::SetTextAlignment方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: CreateUI

void Navigation::CreateUI()
{
    ResourceCache* cache = GetSubsystem<ResourceCache>();
    UI* ui = GetSubsystem<UI>();
    
    // Create a Cursor UI element because we want to be able to hide and show it at will. When hidden, the mouse cursor will
    // control the camera, and when visible, it will point the raycast target
    XMLFile* style = cache->GetResource<XMLFile>("UI/DefaultStyle.xml");
    SharedPtr<Cursor> cursor(new Cursor(context_));
    cursor->SetStyleAuto(style);
    ui->SetCursor(cursor);

    // Set starting position of the cursor at the rendering window center
    Graphics* graphics = GetSubsystem<Graphics>();
    cursor->SetPosition(graphics->GetWidth() / 2, graphics->GetHeight() / 2);
    
    // Construct new Text object, set string to display and font to use
    Text* instructionText = ui->GetRoot()->CreateChild<Text>();
    instructionText->SetText(
        "Use WASD keys to move, RMB to rotate view\n"
        "Shift+LMB to set path start, LMB to set path end\n"
        "MMB to add or remove obstacles\n"
        "Space to toggle debug geometry"
    );
    instructionText->SetFont(cache->GetResource<Font>("Fonts/Anonymous Pro.ttf"), 15);
    // The text has multiple rows. Center them in relation to each other
    instructionText->SetTextAlignment(HA_CENTER);
    
    // Position the text relative to the screen center
    instructionText->SetHorizontalAlignment(HA_CENTER);
    instructionText->SetVerticalAlignment(VA_CENTER);
    instructionText->SetPosition(0, ui->GetRoot()->GetHeight() / 4);
}
开发者ID:PeteX,项目名称:Urho3D,代码行数:33,代码来源:Navigation.cpp

示例2: CreateInstructions

void VehicleDemo::CreateInstructions()
{
    ResourceCache* cache = GetSubsystem<ResourceCache>();
    UI* ui = GetSubsystem<UI>();
    
    // Construct new Text object, set string to display and font to use
    Text* instructionText = ui->GetRoot()->CreateChild<Text>();
    instructionText->SetText(
                             "Use WASD keys to drive, mouse/touch to rotate camera\n"
                             "F5 to save scene, F7 to load"
                             );
    instructionText->SetFont(cache->GetResource<Font>("Fonts/Anonymous Pro.ttf"), 15);
    // The text has multiple rows. Center them in relation to each other
    instructionText->SetTextAlignment(HA_CENTER);
    
    // Position the text relative to the screen center
    instructionText->SetHorizontalAlignment(HA_CENTER);
    instructionText->SetVerticalAlignment(VA_CENTER);
    instructionText->SetPosition(0, ui->GetRoot()->GetHeight() / 4);
    
    
    
    // insert speed
    Text* speedText = ui->GetRoot()->CreateChild<Text>("UITextSpeed");
    speedText->SetText("x km/h");
    speedText->SetFont(cache->GetResource<Font>("Fonts/Anonymous Pro.ttf"), 15);
    // The text has multiple rows. Center them in relation to each other
    speedText->SetTextAlignment(HA_CENTER);
    // Position the text relative to the screen center
    speedText->SetHorizontalAlignment(HA_CENTER);
    speedText->SetVerticalAlignment(VA_CENTER);
    speedText->SetPosition(ui->GetRoot()->GetWidth()/8, ui->GetRoot()->GetHeight() / 8);
    
    Text* gearText = ui->GetRoot()->CreateChild<Text>("UITextGear");
    gearText->SetText("x gear");
    gearText->SetFont(cache->GetResource<Font>("Fonts/Anonymous Pro.ttf"), 15);
    // The text has multiple rows. Center them in relation to each other
    gearText->SetTextAlignment(HA_CENTER);
    // Position the text relative to the screen center
    gearText->SetHorizontalAlignment(HA_CENTER);
    gearText->SetVerticalAlignment(VA_CENTER);
    gearText->SetPosition(ui->GetRoot()->GetWidth()/8, ui->GetRoot()->GetHeight() / 6);
    
    
}
开发者ID:l19g2004,项目名称:Urho3D,代码行数:45,代码来源:VehicleDemo.cpp

示例3:

void Urho2DSpriterAnimation::CreateInstructions()
{
    ResourceCache* cache = GetSubsystem<ResourceCache>();
    UI* ui = GetSubsystem<UI>();

    // Construct new Text object, set string to display and font to use
    Text* instructionText = ui->GetRoot()->CreateChild<Text>();
    instructionText->SetText("Mouse click to play next animation, \nUse WASD keys to move, use PageUp PageDown keys to zoom.");
    instructionText->SetFont(cache->GetResource<Font>("Fonts/Anonymous Pro.ttf"), 15);
    instructionText->SetTextAlignment(HA_CENTER); // Center rows in relation to each other

    // Position the text relative to the screen center
    instructionText->SetHorizontalAlignment(HA_CENTER);
    instructionText->SetVerticalAlignment(VA_CENTER);
    instructionText->SetPosition(0, ui->GetRoot()->GetHeight() / 4);
}
开发者ID:ClockTeam,项目名称:Clockwork,代码行数:16,代码来源:Urho2DSpriterAnimation.cpp

示例4:

void Urho2DConstraints::CreateInstructions()
{
    ResourceCache* cache = GetSubsystem<ResourceCache>();
    UI* ui = GetSubsystem<UI>();

    // Construct new Text object, set string to display and font to use
    Text* instructionText = ui->GetRoot()->CreateChild<Text>();
    instructionText->SetText("Use WASD keys and mouse to move, Use PageUp PageDown to zoom.\n Space to toggle debug geometry and joints - F5 to save the scene.");
    instructionText->SetFont(cache->GetResource<Font>("Fonts/Anonymous Pro.ttf"), 15);
    instructionText->SetTextAlignment(HA_CENTER); // Center rows in relation to each other

    // Position the text relative to the screen center
    instructionText->SetHorizontalAlignment(HA_CENTER);
    instructionText->SetVerticalAlignment(VA_CENTER);
    instructionText->SetPosition(0, ui->GetRoot()->GetHeight() / 4);
}
开发者ID:AGreatFish,项目名称:Urho3D,代码行数:16,代码来源:Urho2DConstraints.cpp

示例5: CreateInstructions

void UIDrag::CreateInstructions()
{
    ResourceCache* cache = GetSubsystem<ResourceCache>();
    UI* ui = GetSubsystem<UI>();

    // Construct new Text object, set string to display and font to use
    Text* instructionText = ui->GetRoot()->CreateChild<Text>();
    instructionText->SetText("Drag on the buttons to move them around.\n"
                             "Touch input allows also multi-drag.\n"
                             "Press SPACE to show/hide tagged UI elements.");
    instructionText->SetFont(cache->GetResource<Font>("Fonts/Anonymous Pro.ttf"), 15);
    instructionText->SetTextAlignment(HA_CENTER);

    // Position the text relative to the screen center
    instructionText->SetHorizontalAlignment(HA_CENTER);
    instructionText->SetVerticalAlignment(VA_CENTER);
    instructionText->SetPosition(0, ui->GetRoot()->GetHeight() / 4);
}
开发者ID:JTippetts,项目名称:Urho3D,代码行数:18,代码来源:UIDrag.cpp

示例6: CreateInstructions

	void Sample::CreateInstructions()
	{
		ResourceCache* cache = GetSubsystem<ResourceCache>();
		UI* ui = GetSubsystem<UI>();

		// Construct new Text object, set string to display and font to use
		Text* instructionText = ui->GetRoot()->CreateChild<Text>();
		instructionText->SetText(
			"Use WASD keys and mouse to move\n"
			"Space to toggle debug geometry"
			);
		instructionText->SetFont(cache->GetResource<Font>("Fonts/Anonymous Pro.ttf"), 13);
		// The text has multiple rows. Center them in relation to each other
		instructionText->SetTextAlignment(HA_CENTER);

		// Position the text relative to the screen center
		instructionText->SetHorizontalAlignment(HA_CENTER);
		instructionText->SetVerticalAlignment(VA_CENTER);
		instructionText->SetPosition(0, ui->GetRoot()->GetHeight() / 4);
	}
开发者ID:lyz4534,项目名称:Urho3DSamples,代码行数:20,代码来源:Sample.cpp

示例7: CreateInstructions

void CharacterDemo::CreateInstructions()
{
    ResourceCache* cache = GetSubsystem<ResourceCache>();
    UI* ui = GetSubsystem<UI>();

    // Construct new Text object, set string to display and font to use
    Text* instructionText = ui->GetRoot()->CreateChild<Text>();
    instructionText->SetText(
        "Use WASD keys and mouse/touch to move\n"
        "Space to jump, F to toggle 1st/3rd person\n"
        "F5 to save scene, F7 to load"
    );
    instructionText->SetFont(cache->GetResource<Font>("Fonts/Anonymous Pro.ttf"), 15);
    // The text has multiple rows. Center them in relation to each other
    instructionText->SetTextAlignment(HA_CENTER);

    // Position the text relative to the screen center
    instructionText->SetHorizontalAlignment(HA_CENTER);
    instructionText->SetVerticalAlignment(VA_CENTER);
    instructionText->SetPosition(0, ui->GetRoot()->GetHeight() / 4);
}
开发者ID:evolarium,项目名称:Urho3D,代码行数:21,代码来源:CharacterDemo.cpp

示例8: CreateInstructions

void Ragdolls::CreateInstructions()
{
    ResourceCache* cache = GetContext()->m_ResourceCache.get();
    UI* ui = GetContext()->m_UISystem.get();

    // Construct new Text object, set string to display and font to use
    Text* instructionText = ui->GetRoot()->CreateChild<Text>();
    instructionText->SetText(
        "Use WASD keys and mouse/touch to move\n"
        "LMB to spawn physics objects\n"
        "F5 to save scene, F7 to load\n"
        "Space to toggle physics debug geometry"
    );
    instructionText->SetFont(cache->GetResource<Font>("Fonts/Anonymous Pro.ttf"), 15);
    // The text has multiple rows. Center them in relation to each other
    instructionText->SetTextAlignment(HA_CENTER);

    // Position the text relative to the screen center
    instructionText->SetHorizontalAlignment(HA_CENTER);
    instructionText->SetVerticalAlignment(VA_CENTER);
    instructionText->SetPosition(0, ui->GetRoot()->GetHeight() / 4);
}
开发者ID:nemerle,项目名称:lutefisk3d,代码行数:22,代码来源:Ragdolls.cpp


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