本文整理汇总了C++中LabelRefPtr::setAlignment方法的典型用法代码示例。如果您正苦于以下问题:C++ LabelRefPtr::setAlignment方法的具体用法?C++ LabelRefPtr::setAlignment怎么用?C++ LabelRefPtr::setAlignment使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LabelRefPtr
的用法示例。
在下文中一共展示了LabelRefPtr::setAlignment方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createInterface
ForegroundRefPtr ApplicationStartScreen::createInterface(void)
{
// Create the Graphics
GraphicsRefPtr StartScreenUIGraphics = OSG::Graphics2D::create();
UIFontRefPtr ButtonFont = OSG::UIFont::create();
ButtonFont->setSize(32);
ButtonRefPtr BuilderButton = ::OSG::Button::create();
BuilderButton->setPreferredSize(Vec2f(200, 75));
BuilderButton->setText("Builder");
BuilderButton->setFont(ButtonFont);
BuilderButton->addActionListener(&_BuilderButtonActionListener);
ButtonRefPtr PlayerButton = ::OSG::Button::create();
PlayerButton->setPreferredSize(Vec2f(200, 75));
PlayerButton->setText("Player");
PlayerButton->setFont(ButtonFont);
PlayerButton->addActionListener(&_PlayerButtonActionListener);
ButtonRefPtr ExitButton = ::OSG::Button::create();
ExitButton->setPreferredSize(Vec2f(200, 75));
ExitButton->setText("Exit");
ExitButton->setFont(ButtonFont);
ExitButton->addActionListener(&_ExitButtonActionListener);
//ButtonPanel
PanelRefPtr ButtonPanel = Panel::createEmpty();
LayoutRefPtr ButtonPanelLayout = OSG::FlowLayout::create();
ButtonPanel->pushToChildren(BuilderButton);
ButtonPanel->pushToChildren(PlayerButton);
ButtonPanel->pushToChildren(ExitButton);
ButtonPanel->setLayout(ButtonPanelLayout);
//Font
UIFontRefPtr LabelFont = UIFont::create();
LabelFont->setSize(16);
//Version Label
LabelRefPtr VersionLabel = OSG::Label::create();
VersionLabel->setText("Version:");
VersionLabel->setAlignment(Vec2f(1.0f,0.5f));
VersionLabel->setPreferredSize(Vec2f(100,20));
VersionLabel->setTextColors(Color4f(1.0f,1.0f,1.0f,1.0f));
VersionLabel->setBackgrounds(NULL);
VersionLabel->setBorders(NULL);
VersionLabel->setFont(LabelFont);
//Version Value Label
LabelRefPtr VersionValueLabel = OSG::Label::create();
VersionValueLabel->setText(getKabalaEngineVersion() + " - " + getKabalaEngineBuildType());
VersionValueLabel->setPreferredSize(Vec2f(110,20));
VersionValueLabel->setTextColors(Color4f(1.0f,1.0f,1.0f,1.0f));
VersionValueLabel->setBackgrounds(NULL);
VersionValueLabel->setBorders(NULL);
VersionValueLabel->setFont(LabelFont);
//Author Value Label
LabelRefPtr AuthorValueLabel = OSG::Label::create();
AuthorValueLabel->setText(getKabalaEngineAuthors());
AuthorValueLabel->setPreferredSize(Vec2f(300,20));
AuthorValueLabel->setTextColors(Color4f(1.0f,1.0f,1.0f,1.0f));
AuthorValueLabel->setBackgrounds(NULL);
AuthorValueLabel->setBorders(NULL);
AuthorValueLabel->setFont(LabelFont);
// Create The Main InternalWindow
InternalWindowRefPtr StartScreenInternalWindow = OSG::InternalWindow::create();
//Layout
SpringLayoutRefPtr StartScreenInternalWindowLayout = OSG::SpringLayout::create();
//::OSG::Button Panel
StartScreenInternalWindowLayout->putConstraint(SpringLayoutConstraints::WEST_EDGE, ButtonPanel, 0, SpringLayoutConstraints::WEST_EDGE, StartScreenInternalWindow);
StartScreenInternalWindowLayout->putConstraint(SpringLayoutConstraints::EAST_EDGE, ButtonPanel, 0, SpringLayoutConstraints::EAST_EDGE, StartScreenInternalWindow);
StartScreenInternalWindowLayout->putConstraint(SpringLayoutConstraints::NORTH_EDGE, ButtonPanel, 0, SpringLayoutConstraints::NORTH_EDGE, StartScreenInternalWindow);
StartScreenInternalWindowLayout->putConstraint(SpringLayoutConstraints::SOUTH_EDGE, ButtonPanel, 0, SpringLayoutConstraints::SOUTH_EDGE, StartScreenInternalWindow);
//Version Label
StartScreenInternalWindowLayout->putConstraint(SpringLayoutConstraints::EAST_EDGE, VersionLabel, 0, SpringLayoutConstraints::WEST_EDGE, VersionValueLabel);
StartScreenInternalWindowLayout->putConstraint(SpringLayoutConstraints::SOUTH_EDGE, VersionLabel, 0, SpringLayoutConstraints::SOUTH_EDGE, StartScreenInternalWindow);
StartScreenInternalWindowLayout->putConstraint(SpringLayoutConstraints::HEIGHT_EDGE, VersionLabel, LayoutSpring::height(VersionLabel));
StartScreenInternalWindowLayout->putConstraint(SpringLayoutConstraints::WIDTH_EDGE, VersionLabel, LayoutSpring::width(VersionLabel));
//Version Value Label
StartScreenInternalWindowLayout->putConstraint(SpringLayoutConstraints::EAST_EDGE, VersionValueLabel, 0, SpringLayoutConstraints::EAST_EDGE, StartScreenInternalWindow);
StartScreenInternalWindowLayout->putConstraint(SpringLayoutConstraints::SOUTH_EDGE, VersionValueLabel, 0, SpringLayoutConstraints::SOUTH_EDGE, StartScreenInternalWindow);
StartScreenInternalWindowLayout->putConstraint(SpringLayoutConstraints::HEIGHT_EDGE, VersionValueLabel, LayoutSpring::height(VersionValueLabel));
StartScreenInternalWindowLayout->putConstraint(SpringLayoutConstraints::WIDTH_EDGE, VersionValueLabel, LayoutSpring::width(VersionValueLabel));
//Author Value Label
StartScreenInternalWindowLayout->putConstraint(SpringLayoutConstraints::WEST_EDGE, AuthorValueLabel, 0, SpringLayoutConstraints::WEST_EDGE, StartScreenInternalWindow);
StartScreenInternalWindowLayout->putConstraint(SpringLayoutConstraints::SOUTH_EDGE, AuthorValueLabel, 0, SpringLayoutConstraints::SOUTH_EDGE, StartScreenInternalWindow);
StartScreenInternalWindowLayout->putConstraint(SpringLayoutConstraints::HEIGHT_EDGE, AuthorValueLabel, LayoutSpring::height(AuthorValueLabel));
StartScreenInternalWindowLayout->putConstraint(SpringLayoutConstraints::WIDTH_EDGE, AuthorValueLabel, LayoutSpring::width(AuthorValueLabel));
StartScreenInternalWindow->pushToChildren(ButtonPanel);
StartScreenInternalWindow->pushToChildren(AuthorValueLabel);
StartScreenInternalWindow->pushToChildren(VersionLabel);
//.........这里部分代码省略.........
示例2: createCodeEditor
void LuaDebuggerInterface::createCodeEditor(void)
{
//Create the Breakpoint images
BoostPath BreakpointIconPath(_BaseIconDir / BoostPath("breakpoint.png")),
BreakpointDisabledIconPath(_BaseIconDir / BoostPath("breakpoint-disabled.png")),
BreakpointConditionalIconPath(_BaseIconDir / BoostPath("breakpoint-conditional.png")),
BreakpointConditionalDisabledIconPath(_BaseIconDir / BoostPath("breakpoint-conditional-disabled.png")),
BreakpointCountIconPath(_BaseIconDir / BoostPath("breakpoint-count.png")),
BreakpointCountDisabledIconPath(_BaseIconDir / BoostPath("breakpoint-count-disabled.png"));
//Breakpoint Button prototypes
//Regular Breakpoint
ButtonRecPtr BreakpointProtoButton = Button::create();
BreakpointProtoButton->setPreferredSize(Vec2f(18.0f, 18.0f));
BreakpointProtoButton->setImages(BreakpointIconPath.string());
BreakpointProtoButton->setDisabledImage(BreakpointDisabledIconPath.string());
BreakpointProtoButton->setBorders(NULL);
BreakpointProtoButton->setBackgrounds(NULL);
BreakpointProtoButton->setForegrounds(NULL);
//Count Breakpoint
ButtonRecPtr BreakpointCountProtoButton = Button::create();
BreakpointCountProtoButton->setPreferredSize(Vec2f(18.0f, 18.0f));
BreakpointCountProtoButton->setImages(BreakpointCountIconPath.string());
BreakpointCountProtoButton->setDisabledImage(BreakpointCountDisabledIconPath.string());
BreakpointCountProtoButton->setBorders(NULL);
BreakpointCountProtoButton->setBackgrounds(NULL);
BreakpointCountProtoButton->setForegrounds(NULL);
//Conditional breakpoint
ButtonRecPtr BreakpointConditionalProtoButton = Button::create();
BreakpointConditionalProtoButton->setPreferredSize(Vec2f(18.0f, 18.0f));
BreakpointConditionalProtoButton->setImages(BreakpointConditionalIconPath.string());
BreakpointConditionalProtoButton->setDisabledImage(BreakpointConditionalDisabledIconPath.string());
BreakpointConditionalProtoButton->setBorders(NULL);
BreakpointConditionalProtoButton->setBackgrounds(NULL);
BreakpointConditionalProtoButton->setForegrounds(NULL);
//Create the default font
_CodeFont = UIFont::create();
_CodeFont->setFamily("Courier New");
_CodeFont->setSize(21);
_CodeFont->setGlyphPixelSize(22);
_CodeFont->setAntiAliasing(false);
// Create a TextArea component
_CodeTextArea = TextEditor::create();
_CodeTextArea->setIsSplit(false);
_CodeTextArea->setClipboardVisible(false);
//_CodeTextArea->getTextDomArea()->setFont(_CodeFont);
//_CodeTextArea->setGutterWidth(50.0f);
_CodeTextArea->setText(createDefaultCodeText());
//_CodeTextArea->connectCaretChanged(boost::bind(&LuaDebuggerInterface::codeAreaCaretChanged,this, _1));
//_CodeTextArea->connectMouseClicked(boost::bind(&LuaDebuggerInterface::handleCodeAreaMouseClicked,this, _1));
_MainSplitPanel = SplitPanel::create();
_MainSplitPanel->setMinComponent(_CodeTextArea);
_MainSplitPanel->setMaxComponent(_InfoTabPanel);
_MainSplitPanel->setOrientation(SplitPanel::VERTICAL_ORIENTATION);
_MainSplitPanel->setDividerPosition(0.7);
// location from the left/top
_MainSplitPanel->setDividerSize(4);
_MainSplitPanel->setMaxDividerPosition(.8);
_MainSplitPanel->setMinDividerPosition(.2);
//Code Area Info
LabelRefPtr LineLabel = Label::create();
LineLabel->setText("Line:");
LineLabel->setPreferredSize(Vec2f(40.0f, 30.0f));
LineLabel->setAlignment(Vec2f(1.0f, 0.5f));
_LineValueLabel = Label::create();
_LineValueLabel->setText("");
_LineValueLabel->setPreferredSize(Vec2f(40.0f, 30.0f));
LabelRefPtr ColumnLabel = Label::create();
ColumnLabel->setText("Column:");
ColumnLabel->setPreferredSize(Vec2f(55.0f, 30.0f));
ColumnLabel->setAlignment(Vec2f(1.0f, 0.5f));
_ColumnValueLabel = Label::create();
_ColumnValueLabel->setText("");
_ColumnValueLabel->setPreferredSize(Vec2f(40.0f, 30.0f));
//TextArea Info Panel
_CodeAreaInfoPanel = Panel::create();
SpringLayoutRefPtr CodeAreaInfoLayout = SpringLayout::create();
//ColumnValueLabel
CodeAreaInfoLayout->putConstraint(SpringLayoutConstraints::NORTH_EDGE, _ColumnValueLabel, 0, SpringLayoutConstraints::NORTH_EDGE, _CodeAreaInfoPanel);
CodeAreaInfoLayout->putConstraint(SpringLayoutConstraints::SOUTH_EDGE, _ColumnValueLabel, 0, SpringLayoutConstraints::SOUTH_EDGE, _CodeAreaInfoPanel);
CodeAreaInfoLayout->putConstraint(SpringLayoutConstraints::EAST_EDGE, _ColumnValueLabel, 0, SpringLayoutConstraints::EAST_EDGE, _CodeAreaInfoPanel);
//ColumnLabel
CodeAreaInfoLayout->putConstraint(SpringLayoutConstraints::NORTH_EDGE, ColumnLabel, 0, SpringLayoutConstraints::NORTH_EDGE, _CodeAreaInfoPanel);
CodeAreaInfoLayout->putConstraint(SpringLayoutConstraints::SOUTH_EDGE, ColumnLabel, 0, SpringLayoutConstraints::SOUTH_EDGE, _CodeAreaInfoPanel);
CodeAreaInfoLayout->putConstraint(SpringLayoutConstraints::EAST_EDGE, ColumnLabel, -1, SpringLayoutConstraints::WEST_EDGE, _ColumnValueLabel);
//.........这里部分代码省略.........
示例3: createLeftPanelButtonPanel
ComponentRefPtr createLeftPanelButtonPanel(void)
{
// Create Label for this Panel
LabelRefPtr LeftPanelButtonPanelLabel = OSG::Label::create();
LeftPanelButtonPanelLabel->setTextColor(Color4f(1.0,1.0,1.0,1.0));
LeftPanelButtonPanelLabel->setRolloverTextColor(Color4f(1.0,1.0,1.0,1.0));
LeftPanelButtonPanelLabel->setBackground(createComplexBackground());
LeftPanelButtonPanelLabel->setPreferredSize(Vec2f(100, 50));
LeftPanelButtonPanelLabel->setText("Various Options");
LeftPanelButtonPanelLabel->setAlignment(Vec2f(0.5,0.5));
// Create and edit the Panel buttons
ButtonRefPtr LeftPanelButton1 = OSG::Button::create();
ButtonRefPtr LeftPanelButton2 = OSG::Button::create();
ButtonRefPtr LeftPanelButton3 = OSG::Button::create();
ButtonRefPtr LeftPanelButton4 = OSG::Button::create();
ButtonRefPtr LeftPanelButton5 = OSG::Button::create();
ButtonRefPtr LeftPanelButton6 = OSG::Button::create();
LeftPanelButton1->setText("This");
LeftPanelButton1->setPreferredSize(Vec2f(100,50));
LeftPanelButton2->setText("is");
LeftPanelButton2->setPreferredSize(Vec2f(100,50));
LeftPanelButton3->setText("an");
LeftPanelButton3->setPreferredSize(Vec2f(100,50));
LeftPanelButton4->setText("example");
LeftPanelButton4->setPreferredSize(Vec2f(100,50));
LeftPanelButton5->setText("user");
LeftPanelButton5->setPreferredSize(Vec2f(100,50));
LeftPanelButton6->setText("interface.");
LeftPanelButton6->setPreferredSize(Vec2f(100,50));
// Create and edit Panel layout
BoxLayoutRefPtr LeftPanelButtonPanelLayout = OSG::BoxLayout::create();
LeftPanelButtonPanelLayout->setOrientation(BoxLayout::VERTICAL_ORIENTATION);
// Create an edit Panel Background
ColorLayerRefPtr LeftPanelButtonPanelBackground = OSG::ColorLayer::create();
LeftPanelButtonPanelBackground->setColor(Color4f(0.93,0.93,0.93,1.0));
// Create Panel Border
LineBorderRefPtr LeftPanelBorder = OSG::LineBorder::create();
LeftPanelBorder->setColor(Color4f(0.0,0.0,0.0,1.0));
LeftPanelBorder->setWidth(1);
// Create and edit Panel
PanelRefPtr LeftPanelButtonPanel = OSG::Panel::create();
LeftPanelButtonPanel->setPreferredSize(Vec2f(180, 500));
LeftPanelButtonPanel->pushToChildren(LeftPanelButtonPanelLabel);
LeftPanelButtonPanel->pushToChildren(LeftPanelButton1);
LeftPanelButtonPanel->pushToChildren(LeftPanelButton2);
LeftPanelButtonPanel->pushToChildren(LeftPanelButton3);
LeftPanelButtonPanel->pushToChildren(LeftPanelButton4);
LeftPanelButtonPanel->pushToChildren(LeftPanelButton5);
LeftPanelButtonPanel->pushToChildren(LeftPanelButton6);
LeftPanelButtonPanel->setLayout(LeftPanelButtonPanelLayout);
LeftPanelButtonPanel->setBackgrounds(LeftPanelButtonPanelBackground);
LeftPanelButtonPanel->setBorders(LeftPanelBorder);
return LeftPanelButtonPanel;
}