本文整理汇总了C++中InternalWindowRefPtr::setPosition方法的典型用法代码示例。如果您正苦于以下问题:C++ InternalWindowRefPtr::setPosition方法的具体用法?C++ InternalWindowRefPtr::setPosition怎么用?C++ InternalWindowRefPtr::setPosition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类InternalWindowRefPtr
的用法示例。
在下文中一共展示了InternalWindowRefPtr::setPosition方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char **argv)
{
// OSG init
osgInit(argc,argv);
// Set up Window
TutorialWindow = createNativeWindow();
TutorialWindow->initWindow();
TutorialWindow->setDisplayCallback(display);
TutorialWindow->setReshapeCallback(reshape);
TutorialKeyListener TheKeyListener;
TutorialWindow->addKeyListener(&TheKeyListener);
// Make Torus Node (creates Torus in background of scene)
NodeRefPtr TorusGeometryNode = makeTorus(.5, 2, 16, 16);
// Make Main Scene Node and add the Torus
NodeRefPtr scene = OSG::Node::create();
scene->setCore(OSG::Group::create());
scene->addChild(TorusGeometryNode);
// Create the Graphics
GraphicsRefPtr TutorialGraphics = OSG::Graphics2D::create();
// Initialize the LookAndFeelManager to enable default settings
LookAndFeelManager::the()->getLookAndFeel()->init();
/******************************************************
Create an Button Component and
a simple Font.
See 17Label_Font for more
information about Fonts.
******************************************************/
ButtonRefPtr ExampleButton = OSG::Button::create();
UIFontRefPtr ExampleFont = OSG::UIFont::create();
ExampleFont->setSize(16);
ExampleButton->setMinSize(Vec2f(50, 25));
ExampleButton->setMaxSize(Vec2f(200, 100));
ExampleButton->setPreferredSize(Vec2f(100, 50));
ExampleButton->setToolTipText("Button 1 ToolTip");
ExampleButton->setText("Button 1");
ExampleButton->setFont(ExampleFont);
ExampleButton->setTextColor(Color4f(1.0, 0.0, 0.0, 1.0));
ExampleButton->setRolloverTextColor(Color4f(1.0, 0.0, 1.0, 1.0));
ExampleButton->setActiveTextColor(Color4f(1.0, 0.0, 0.0, 1.0));
ExampleButton->setAlignment(Vec2f(1.0,0.0));
/******************************************************
Create a ToggleButton and determine its
characteristics. ToggleButton inherits
off of Button, so all characteristsics
used above can be used with ToggleButtons
as well.
The only difference is that when pressed,
ToggleButton remains pressed until pressed
again.
-setSelected(bool): Determine whether the
ToggleButton is Selected (true) or
deselected (false).
******************************************************/
ToggleButtonRefPtr ExampleToggleButton = OSG::ToggleButton::create();
ExampleToggleButton->setSelected(false);
ExampleToggleButton->setText("ToggleMe");
ExampleToggleButton->setToolTipText("Toggle Button ToolTip");
// Create Background to be used with the MainInternalWindow
ColorLayerRefPtr MainInternalWindowBackground = OSG::ColorLayer::create();
MainInternalWindowBackground->setColor(Color4f(1.0,1.0,1.0,0.5));
// Create The Internal Window
InternalWindowRefPtr MainInternalWindow = OSG::InternalWindow::create();
LayoutRefPtr MainInternalWindowLayout = OSG::FlowLayout::create();
// Assign the Button to the MainInternalWindow so it will be displayed
// when the view is rendered.
MainInternalWindow->pushToChildren(ExampleButton);
MainInternalWindow->setLayout(MainInternalWindowLayout);
MainInternalWindow->setBackgrounds(MainInternalWindowBackground);
MainInternalWindow->setPosition(Pnt2f(50,50));
MainInternalWindow->setPreferredSize(Vec2f(300,300));
MainInternalWindow->setTitle(std::string("Internal Window 1"));
// Create The Internal Window
InternalWindowRefPtr MainInternalWindow2 = OSG::InternalWindow::create();
LayoutRefPtr MainInternalWindowLayout2 = OSG::FlowLayout::create();
// Assign the Button to the MainInternalWindow so it will be displayed
// when the view is rendered.
//.........这里部分代码省略.........