ComponentTransitPtr GenericFieldContainerEditor::createFCToolTip(const FieldContainerType &FCType) { std::string FieldDoc(doxygenToPlainFormatting(FCType.getDocumentation())); //TypeName LabelRecPtr TypeLabel = Label::create(); TypeLabel->setText(FCType.getName()); TypeLabel->setAlignment(Vec2f(0.5f,0.5f)); TypeLabel->setBackgrounds(NULL); //Separator SeparatorRecPtr MainSeparator = Separator::create(); MainSeparator->setOrientation(Separator::HORIZONTAL_ORIENTATION); MainSeparator->setSeparatorSize(1.0f); MainSeparator->setPreferredSize(Vec2f(1.0f,5.0f)); MainSeparator->setBackgrounds(NULL); //Inheritance Panel Layout //LabelRecPtr InheritanceLabel = Label::create(); //InheritanceLabel->setText("Inheritance"); //FlowLayoutRecPtr InheritancePanelLayout = FlowLayout::create(); //InheritancePanelLayout->setOrientation(FlowLayout::VERTICAL_ORIENTATION); //InheritancePanelLayout->setVerticalGap(3.0f); //InheritancePanelLayout->setMajorAxisAlignment(0.0f); //InheritancePanelLayout->setMinorAxisAlignment(0.5f); //InheritancePanelLayout->setComponentAlignment(0.5f); ////Inheritance Panel //PanelRecPtr InheritancePanel = Panel::createEmpty(); //InheritancePanel->setAllInsets(5.0f); //InheritancePanel->setLayout(InheritancePanelLayout); //const TypeBase *ParentType(&FCType); ////while() ////{ ////ToolTipPanel->pushToChildren(DescriptionTextArea); ////} //LabelRecPtr TypeNameLabel = Label::create(); //TypeNameLabel->setText(FCType.getName()); //TypeNameLabel->setAlignment(Vec2f(0.5f,0.5f)); //InheritancePanel->pushToChildren(TypeNameLabel); //Set the layout constraints BorderLayoutConstraintsRecPtr CenterConstraints = BorderLayoutConstraints::create(); CenterConstraints->setRegion(BorderLayoutConstraints::BORDER_CENTER); //Description Panel LabelRecPtr DescriptionLabel = Label::create(); DescriptionLabel->setText("Description:"); DescriptionLabel->setBackgrounds(NULL); TextAreaRecPtr DescriptionTextArea = TextArea::create(); DescriptionTextArea->setText(FieldDoc); DescriptionTextArea->setEditable(false); DescriptionTextArea->setBorders(NULL); DescriptionTextArea->setBackgrounds(NULL); DescriptionTextArea->setConstraints(CenterConstraints); //Description Panel PanelRecPtr DescriptionPanel = Panel::create(); BorderLayoutRecPtr DescriptionPanelLayout = BorderLayout::create(); DescriptionPanel->setAllInsets(5.0f); DescriptionPanel->setLayout(DescriptionPanelLayout); DescriptionPanel->pushToChildren(DescriptionTextArea); DescriptionPanel->setBackgrounds(NULL); //ToolTip Layout PanelRecPtr ToolTipPanel = Panel::createEmpty(); SpringLayoutRecPtr MainLayout = SpringLayout::create(); //TypeLabel MainLayout->putConstraint(SpringLayoutConstraints::NORTH_EDGE, TypeLabel, 5, SpringLayoutConstraints::NORTH_EDGE, ToolTipPanel); MainLayout->putConstraint(SpringLayoutConstraints::EAST_EDGE, TypeLabel, -5, SpringLayoutConstraints::EAST_EDGE, ToolTipPanel); MainLayout->putConstraint(SpringLayoutConstraints::WEST_EDGE, TypeLabel, 5, SpringLayoutConstraints::WEST_EDGE, ToolTipPanel); //MainSeparator MainLayout->putConstraint(SpringLayoutConstraints::NORTH_EDGE, MainSeparator, 1, SpringLayoutConstraints::SOUTH_EDGE, TypeLabel); MainLayout->putConstraint(SpringLayoutConstraints::EAST_EDGE, MainSeparator, -15, SpringLayoutConstraints::EAST_EDGE, ToolTipPanel); MainLayout->putConstraint(SpringLayoutConstraints::WEST_EDGE, MainSeparator, 15, SpringLayoutConstraints::WEST_EDGE, ToolTipPanel); ////InheritancePanel //MainLayout->putConstraint(SpringLayoutConstraints::NORTH_EDGE, InheritanceLabel, 1, //SpringLayoutConstraints::SOUTH_EDGE, MainSeparator); //MainLayout->putConstraint(SpringLayoutConstraints::EAST_EDGE, InheritanceLabel, 0, //SpringLayoutConstraints::EAST_EDGE, ToolTipPanel); //MainLayout->putConstraint(SpringLayoutConstraints::WEST_EDGE, InheritanceLabel, 0, //SpringLayoutConstraints::WEST_EDGE, ToolTipPanel); ////InheritancePanel //MainLayout->putConstraint(SpringLayoutConstraints::NORTH_EDGE, InheritancePanel, 1, //SpringLayoutConstraints::SOUTH_EDGE, InheritanceLabel); //MainLayout->putConstraint(SpringLayoutConstraints::EAST_EDGE, InheritancePanel, 0, //SpringLayoutConstraints::EAST_EDGE, ToolTipPanel); //MainLayout->putConstraint(SpringLayoutConstraints::WEST_EDGE, InheritancePanel, 0, //SpringLayoutConstraints::WEST_EDGE, ToolTipPanel); //DescriptionTextArea MainLayout->putConstraint(SpringLayoutConstraints::NORTH_EDGE, DescriptionLabel, 1, SpringLayoutConstraints::SOUTH_EDGE, MainSeparator); MainLayout->putConstraint(SpringLayoutConstraints::EAST_EDGE, DescriptionLabel, -5, SpringLayoutConstraints::EAST_EDGE, ToolTipPanel); MainLayout->putConstraint(SpringLayoutConstraints::WEST_EDGE, DescriptionLabel, 5, SpringLayoutConstraints::WEST_EDGE, ToolTipPanel); //DescriptionTextArea MainLayout->putConstraint(SpringLayoutConstraints::NORTH_EDGE, DescriptionPanel, 1, SpringLayoutConstraints::SOUTH_EDGE, DescriptionLabel); MainLayout->putConstraint(SpringLayoutConstraints::SOUTH_EDGE, DescriptionPanel, -5, SpringLayoutConstraints::SOUTH_EDGE, ToolTipPanel); MainLayout->putConstraint(SpringLayoutConstraints::EAST_EDGE, DescriptionPanel, -5, SpringLayoutConstraints::EAST_EDGE, ToolTipPanel); MainLayout->putConstraint(SpringLayoutConstraints::WEST_EDGE, DescriptionPanel, 5, SpringLayoutConstraints::WEST_EDGE, ToolTipPanel); //ToolTip Panel Component* DefaultToolTip(LookAndFeelManager::the()->getLookAndFeel()->getDefaultToolTip()); ToolTipPanel->setBorders(DefaultToolTip->getBorder()); ToolTipPanel->setBackgrounds(DefaultToolTip->getBackground()); ToolTipPanel->setForegrounds(DefaultToolTip->getForeground()); ToolTipPanel->setLayout(MainLayout); ToolTipPanel->pushToChildren(TypeLabel); ToolTipPanel->pushToChildren(MainSeparator); //ToolTipPanel->pushToChildren(InheritanceLabel); //ToolTipPanel->pushToChildren(InheritancePanel); ToolTipPanel->pushToChildren(DescriptionLabel); ToolTipPanel->pushToChildren(DescriptionPanel); Real32 Height(100.0f + DescriptionTextArea->getLineHeight() * (DescriptionTextArea->getText().size()/40)); ToolTipPanel->setPreferredSize(Vec2f(300.0f,Height)); return ComponentTransitPtr(ToolTipPanel); }
PanelTransitPtr createLeftPanelRadioTextPanel(void) { // Create TextArea TextAreaRecPtr LeftPanelTextArea = TextArea::create(); LeftPanelTextArea->setPreferredSize(Vec2f(125, 200)); LeftPanelTextArea->setText("Text Area"); // Create the RadioButton group RadioButtonRecPtr RadioButton1 = RadioButton::create(); RadioButtonRecPtr RadioButton2 = RadioButton::create(); RadioButtonRecPtr RadioButton3 = RadioButton::create(); RadioButtonRecPtr RadioButton4 = RadioButton::create(); RadioButton1->setAlignment(Vec2f(0.0,0.5)); RadioButton1->setPreferredSize(Vec2f(100, 40)); RadioButton1->setText("Black Text"); RadioButton1->setToolTipText("Set TextArea text black"); RadioButton1->connectButtonSelected(boost::bind(setTextColors, LeftPanelTextArea.get(), Color4f(0.0f,0.0f,0.0f,1.0f))); RadioButton2->setAlignment(Vec2f(0.0,0.5)); RadioButton2->setPreferredSize(Vec2f(100, 40)); RadioButton2->setText("Red Text"); RadioButton2->setToolTipText("Set TextArea text red"); RadioButton2->connectButtonSelected(boost::bind(setTextColors, LeftPanelTextArea.get(), Color4f(1.0f,0.0f,0.0f,1.0f))); RadioButton3->setAlignment(Vec2f(0.0,0.5)); RadioButton3->setPreferredSize(Vec2f(100, 40)); RadioButton3->setText("Green Text"); RadioButton3->setToolTipText("Set TextArea text green"); RadioButton3->connectButtonSelected(boost::bind(setTextColors, LeftPanelTextArea.get(), Color4f(0.0f,1.0f,0.0f,1.0f))); RadioButton4->setAlignment(Vec2f(0.0,0.5)); RadioButton4->setPreferredSize(Vec2f(100, 40)); RadioButton4->setText("Blue Text"); RadioButton4->setToolTipText("Set TextArea text blue"); RadioButton4->connectButtonSelected(boost::bind(setTextColors, LeftPanelTextArea.get(), Color4f(0.0f,0.0f,1.0f,1.0f))); RadioButtonGroupRecPtr buttonGroup = RadioButtonGroup::create(); buttonGroup->addButton(RadioButton1); buttonGroup->addButton(RadioButton2); buttonGroup->addButton(RadioButton3); buttonGroup->addButton(RadioButton4); // Create Panel and its Background/Border to label TextField LabelRecPtr LeftPanelTextFieldLabel = Label::create(); EmptyLayerRecPtr LeftPanelTextFieldLabelBackground = EmptyLayer::create(); EmptyBorderRecPtr LeftPanelTextFieldLabelBorder = EmptyBorder::create(); LeftPanelTextFieldLabel->setPreferredSize(Vec2f(100, 25)); LeftPanelTextFieldLabel->setBorders(LeftPanelTextFieldLabelBorder); LeftPanelTextFieldLabel->setBackgrounds(LeftPanelTextFieldLabelBackground); LeftPanelTextFieldLabel->setText("Text Field"); // Create TextField TextFieldRecPtr LeftPanelTextField = TextField::create(); LeftPanelTextField->setPreferredSize(Vec2f(125.0f, 22.0f)); // Create an edit Panel Background ColorLayerRecPtr LeftPanelRadioTextPanelBackground = ColorLayer::create(); LeftPanelRadioTextPanelBackground->setColor(Color4f(0.93f,0.93f,0.93f,1.0f)); // Create and edit Panel layouts FlowLayoutRecPtr LeftPanelRadioTextPanelLayout = FlowLayout::create(); FlowLayoutRecPtr LeftPanelRadioTextPanelRadioPanelLayout = FlowLayout::create(); FlowLayoutRecPtr LeftPanelRadioTextPanelTextPanelLayout = FlowLayout::create(); LeftPanelRadioTextPanelLayout->setMinorAxisAlignment(0.0f); // Create two Panels for this Panel PanelRecPtr LeftPanelRadioTextPanelRadioPanel = Panel::createEmpty(); PanelRecPtr LeftPanelRadioTextPanelTextPanel = Panel::createEmpty(); // Create some Borders EmptyBorderRecPtr LeftPanelRadioTextPanelRadioPanelBorder = EmptyBorder::create(); LeftPanelRadioTextPanelRadioPanel->setBorders(LeftPanelRadioTextPanelRadioPanelBorder); LeftPanelRadioTextPanelRadioPanel->setPreferredSize(Vec2f(125, 200)); LeftPanelRadioTextPanelRadioPanel->setLayout(LeftPanelRadioTextPanelRadioPanelLayout); LeftPanelRadioTextPanelRadioPanel->setBackgrounds(LeftPanelRadioTextPanelBackground); LeftPanelRadioTextPanelRadioPanel->pushToChildren(RadioButton1); LeftPanelRadioTextPanelRadioPanel->pushToChildren(RadioButton2); LeftPanelRadioTextPanelRadioPanel->pushToChildren(RadioButton3); LeftPanelRadioTextPanelRadioPanel->pushToChildren(RadioButton4); // Create Panel Border LineBorderRecPtr PanelBorder1 = LineBorder::create(); PanelBorder1->setColor(Color4f(0.0,0.0,0.0,1.0)); PanelBorder1->setWidth(1); // Create and edit Panel PanelRecPtr LeftPanelRadioTextPanel = Panel::createEmpty(); LeftPanelRadioTextPanel->setPreferredSize(Vec2f(180, 500)); LeftPanelRadioTextPanel->pushToChildren(LeftPanelRadioTextPanelRadioPanel); //LeftPanelRadioTextPanel->pushToChildren(LeftPanelTextArea); LeftPanelRadioTextPanel->pushToChildren(LeftPanelTextFieldLabel); LeftPanelRadioTextPanel->pushToChildren(LeftPanelTextField); LeftPanelRadioTextPanel->setLayout(LeftPanelRadioTextPanelLayout); LeftPanelRadioTextPanel->setBackgrounds(LeftPanelRadioTextPanelBackground); LeftPanelRadioTextPanel->setBorders(PanelBorder1); return PanelTransitPtr(LeftPanelRadioTextPanel); }
ComponentTransitPtr GenericFieldContainerEditor::createEventToolTip(const EventDescription *EventDesc) { std::string FieldDoc(doxygenToPlainFormatting(EventDesc->getDescription())); //TypeName LabelRecPtr TypeLabel = Label::create(); TypeLabel->setText(EventDesc->getName()); TypeLabel->setAlignment(Vec2f(0.5f,0.5f)); TypeLabel->setBackgrounds(NULL); //Separator SeparatorRecPtr MainSeparator = Separator::create(); MainSeparator->setOrientation(Separator::HORIZONTAL_ORIENTATION); MainSeparator->setSeparatorSize(1.0f); MainSeparator->setPreferredSize(Vec2f(1.0f,5.0f)); MainSeparator->setBackgrounds(NULL); //Consumable Label LabelRecPtr ConsumableLabel = Label::create(); ConsumableLabel->setText(EventDesc->getConsumable() ? "Consumable" : "Not Consumable"); ConsumableLabel->setAlignment(Vec2f(0.0f,0.5f)); ConsumableLabel->setBackgrounds(NULL); //Set the layout constraints BorderLayoutConstraintsRecPtr CenterConstraints = BorderLayoutConstraints::create(); CenterConstraints->setRegion(BorderLayoutConstraints::BORDER_CENTER); //Description Panel LabelRecPtr DescriptionLabel = Label::create(); DescriptionLabel->setText("Description:"); DescriptionLabel->setBackgrounds(NULL); TextAreaRecPtr DescriptionTextArea = TextArea::create(); DescriptionTextArea->setText(FieldDoc); DescriptionTextArea->setEditable(false); DescriptionTextArea->setBorders(NULL); DescriptionTextArea->setBackgrounds(NULL); DescriptionTextArea->setConstraints(CenterConstraints); //Description Panel PanelRecPtr DescriptionPanel = Panel::create(); BorderLayoutRecPtr DescriptionPanelLayout = BorderLayout::create(); DescriptionPanel->setAllInsets(5.0f); DescriptionPanel->setLayout(DescriptionPanelLayout); DescriptionPanel->pushToChildren(DescriptionTextArea); DescriptionPanel->setBackgrounds(NULL); //ToolTip Layout PanelRecPtr ToolTipPanel = Panel::createEmpty(); SpringLayoutRecPtr MainLayout = SpringLayout::create(); //TypeLabel MainLayout->putConstraint(SpringLayoutConstraints::NORTH_EDGE, TypeLabel, 5, SpringLayoutConstraints::NORTH_EDGE, ToolTipPanel); MainLayout->putConstraint(SpringLayoutConstraints::EAST_EDGE, TypeLabel, -5, SpringLayoutConstraints::EAST_EDGE, ToolTipPanel); MainLayout->putConstraint(SpringLayoutConstraints::WEST_EDGE, TypeLabel, 5, SpringLayoutConstraints::WEST_EDGE, ToolTipPanel); //MainSeparator MainLayout->putConstraint(SpringLayoutConstraints::NORTH_EDGE, MainSeparator, 1, SpringLayoutConstraints::SOUTH_EDGE, TypeLabel); MainLayout->putConstraint(SpringLayoutConstraints::EAST_EDGE, MainSeparator, -15, SpringLayoutConstraints::EAST_EDGE, ToolTipPanel); MainLayout->putConstraint(SpringLayoutConstraints::WEST_EDGE, MainSeparator, 15, SpringLayoutConstraints::WEST_EDGE, ToolTipPanel); //ConsumableLabel MainLayout->putConstraint(SpringLayoutConstraints::NORTH_EDGE, ConsumableLabel, 1, SpringLayoutConstraints::NORTH_EDGE, MainSeparator); MainLayout->putConstraint(SpringLayoutConstraints::EAST_EDGE, ConsumableLabel, -5, SpringLayoutConstraints::EAST_EDGE, ToolTipPanel); MainLayout->putConstraint(SpringLayoutConstraints::WEST_EDGE, ConsumableLabel, 5, SpringLayoutConstraints::WEST_EDGE, ToolTipPanel); //DescriptionTextArea MainLayout->putConstraint(SpringLayoutConstraints::NORTH_EDGE, DescriptionLabel, 5, SpringLayoutConstraints::SOUTH_EDGE, ConsumableLabel); MainLayout->putConstraint(SpringLayoutConstraints::EAST_EDGE, DescriptionLabel, -5, SpringLayoutConstraints::EAST_EDGE, ToolTipPanel); MainLayout->putConstraint(SpringLayoutConstraints::WEST_EDGE, DescriptionLabel, 5, SpringLayoutConstraints::WEST_EDGE, ToolTipPanel); //DescriptionTextArea MainLayout->putConstraint(SpringLayoutConstraints::NORTH_EDGE, DescriptionPanel, 1, SpringLayoutConstraints::SOUTH_EDGE, DescriptionLabel); MainLayout->putConstraint(SpringLayoutConstraints::SOUTH_EDGE, DescriptionPanel, -5, SpringLayoutConstraints::SOUTH_EDGE, ToolTipPanel); MainLayout->putConstraint(SpringLayoutConstraints::EAST_EDGE, DescriptionPanel, -5, SpringLayoutConstraints::EAST_EDGE, ToolTipPanel); MainLayout->putConstraint(SpringLayoutConstraints::WEST_EDGE, DescriptionPanel, 5, SpringLayoutConstraints::WEST_EDGE, ToolTipPanel); //ToolTip Panel Component* DefaultToolTip(LookAndFeelManager::the()->getLookAndFeel()->getDefaultToolTip()); ToolTipPanel->setBorders(DefaultToolTip->getBorder()); ToolTipPanel->setBackgrounds(DefaultToolTip->getBackground()); ToolTipPanel->setForegrounds(DefaultToolTip->getForeground()); ToolTipPanel->setLayout(MainLayout); ToolTipPanel->pushToChildren(TypeLabel); ToolTipPanel->pushToChildren(MainSeparator); ToolTipPanel->pushToChildren(ConsumableLabel); ToolTipPanel->pushToChildren(DescriptionLabel); ToolTipPanel->pushToChildren(DescriptionPanel); Real32 Height(130.0f + DescriptionTextArea->getLineHeight() * (DescriptionTextArea->getText().size()/40)); ToolTipPanel->setPreferredSize(Vec2f(300.0f,Height)); return ComponentTransitPtr(ToolTipPanel); }
int main(int argc, char **argv) { // OSG init osgInit(argc,argv); { // Set up Window WindowEventProducerRecPtr TutorialWindow = createNativeWindow(); TutorialWindow->initWindow(); // Create the SimpleSceneManager helper SimpleSceneManager sceneManager; TutorialWindow->setDisplayCallback(boost::bind(display, &sceneManager)); TutorialWindow->setReshapeCallback(boost::bind(reshape, _1, &sceneManager)); // Tell the Manager what to manage sceneManager.setWindow(TutorialWindow); TutorialWindow->connectKeyTyped(boost::bind(keyPressed, _1)); // Make Torus Node (creates Torus in background of scene) NodeRecPtr TorusGeometryNode = makeTorus(.5, 2, 16, 16); // Make Main Scene Node and add the Torus NodeRecPtr scene = Node::create(); scene->setCore(Group::create()); scene->addChild(TorusGeometryNode); // Create the Graphics GraphicsRecPtr TutorialGraphics = Graphics2D::create(); // Initialize the LookAndFeelManager to enable default settings LookAndFeelManager::the()->getLookAndFeel()->init(); // Create a simple Font to be used with the ExampleTextArea UIFontRecPtr ExampleFont = UIFont::create(); ExampleFont->setSize(16); /****************************************************** Create and edit the TextArea and determine its characteristics. A TextArea is a component that allows you to enter text into the box via keyboard input. You can select text by using your mouse or pressing shift and the left and right arrow keys. The only difference between a TextArea and TextField is that a TextArea can have multiple lines of text within it. -setTextColor(Color4f): Determine color of text within TextArea. -setSelectionBoxColor(Color4f): Determine the color that highlighting around the selected text appears. -setSelectionTextColor(Color4f): Determine the color the selected text appears. -setText("TextToBeDisplayed"): Determine initial text within TextArea. -setFont(FontName): Determine the Font used within TextArea -setSelectionStart(StartCharacterNumber): Determine the character which the selection will initially start after. -setSelectionEnd(EndCharacterNumber): Determine the character which the selection will end before. -setCaretPosition(Location): Determine the location of the Caret within the TextArea. Note: this does not do too much currently because the only way to cause the TextArea to gain focus is to click within it, causing the Caret to move. ******************************************************/ // Create a TextArea component TextAreaRecPtr ExampleTextArea = TextArea::create(); ExampleTextArea->setPreferredSize(Vec2f(300, 200)); ExampleTextArea->setMinSize(Vec2f(300, 200)); ExampleTextArea->setTextColor(Color4f(0.0, 0.0, 0.0, 1.0)); ExampleTextArea->setSelectionBoxColor(Color4f(0.0, 0.0, 1.0, 1.0)); ExampleTextArea->setSelectionTextColor(Color4f(1.0, 1.0, 1.0, 1.0)); // Determine the font and initial text ExampleTextArea->setText("What"); ExampleTextArea->setFont(ExampleFont); // This will select the "a" from above ExampleTextArea->setSelectionStart(2); ExampleTextArea->setSelectionEnd(3); ExampleTextArea->setCaretPosition(2); //ExampleTextArea->setLineWrap(false); // Create a ScrollPanel ScrollPanelRecPtr TextAreaScrollPanel = ScrollPanel::create(); TextAreaScrollPanel->setPreferredSize(Vec2f(200,200)); TextAreaScrollPanel->setHorizontalResizePolicy(ScrollPanel::RESIZE_TO_VIEW); // Add the TextArea to the ScrollPanel so it is displayed TextAreaScrollPanel->setViewComponent(ExampleTextArea); // Create The Main InternalWindow // Create Background to be used with the Main InternalWindow ColorLayerRecPtr MainInternalWindowBackground = ColorLayer::create(); MainInternalWindowBackground->setColor(Color4f(1.0,1.0,1.0,0.5)); LayoutRecPtr MainInternalWindowLayout = FlowLayout::create(); InternalWindowRecPtr MainInternalWindow = InternalWindow::create(); MainInternalWindow->pushToChildren(TextAreaScrollPanel); MainInternalWindow->setLayout(MainInternalWindowLayout); MainInternalWindow->setBackgrounds(MainInternalWindowBackground); MainInternalWindow->setAlignmentInDrawingSurface(Vec2f(0.5f,0.5f)); MainInternalWindow->setScalingInDrawingSurface(Vec2f(0.5f,0.5f)); MainInternalWindow->setDrawTitlebar(false); MainInternalWindow->setResizable(false); // Create the Drawing Surface UIDrawingSurfaceRecPtr TutorialDrawingSurface = UIDrawingSurface::create(); TutorialDrawingSurface->setGraphics(TutorialGraphics); TutorialDrawingSurface->setEventProducer(TutorialWindow); TutorialDrawingSurface->openWindow(MainInternalWindow); // Create the UI Foreground Object UIForegroundRecPtr TutorialUIForeground = UIForeground::create(); TutorialUIForeground->setDrawingSurface(TutorialDrawingSurface); // Tell the Manager what to manage sceneManager.setRoot(scene); // Add the UI Foreground Object to the Scene ViewportRecPtr TutorialViewport = sceneManager.getWindow()->getPort(0); TutorialViewport->addForeground(TutorialUIForeground); // Show the whole Scene sceneManager.showAll(); //Open Window Vec2f WinSize(TutorialWindow->getDesktopSize() * 0.85f); Pnt2f WinPos((TutorialWindow->getDesktopSize() - WinSize) *0.5); TutorialWindow->openWindow(WinPos, WinSize, "22TextArea"); //Enter main Loop TutorialWindow->mainLoop(); } osgExit(); return 0; }