本文整理汇总了C++中ColorLayerRecPtr类的典型用法代码示例。如果您正苦于以下问题:C++ ColorLayerRecPtr类的具体用法?C++ ColorLayerRecPtr怎么用?C++ ColorLayerRecPtr使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ColorLayerRecPtr类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
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));
NodeRecPtr Root(NULL);
if(argc == 2)
{
Root = SceneFileHandler::the()->read(argv[1]);
}
if(Root == NULL)
{
// Make Torus Node (creates Torus in background of Root)
NodeRecPtr TorusGeometryNode = makeTorus(.5, 2, 16, 16);
NodeRecPtr TorusNode = Node::create();
TorusNode->setCore(Transform::create());
TorusNode->addChild(TorusGeometryNode);
NodeRecPtr SphereGeometryNode = makeSphere(2,1.0f);
NodeRecPtr BoxGeometryNode = makeBox(1.0,1.0,1.0,1,1,1);
// Make Main Scene Node and add the Torus
Root = Node::create();
Root->setCore(Group::create());
Root->addChild(TorusNode);
Root->addChild(SphereGeometryNode);
Root->addChild(BoxGeometryNode);
}
// Create the Graphics
GraphicsRecPtr TutorialGraphics = Graphics2D::create();
// Initialize the LookAndFeelManager to enable default settings
LookAndFeelManager::the()->getLookAndFeel()->init();
// 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();
//Import InternalWindow(s) from XML file
std::vector<InternalWindowRecPtr> StoreWindows;
FCFileType::FCPtrStore NewContainers;
NewContainers = FCFileHandler::the()->read(BoostPath("./Data/55ComponentTree.xml"));
//Store each window found in the XML in the vector
FCFileType::FCPtrStore::iterator Itor;
for(Itor = NewContainers.begin(); Itor != NewContainers.end(); ++Itor)
{
if( (*Itor)->getType() == (InternalWindow::getClassType()))
{
StoreWindows.push_back(dynamic_pointer_cast<InternalWindow>(*Itor));
}
}
//Tree Model
FieldContainerTreeModelRecPtr TheTreeModel = FieldContainerTreeModel::create();
TheTreeModel->setRoot(StoreWindows.front());
//TheTreeModel->setShowPtrFields(false);
//TheTreeModel->setShowDataFields(false);
//TheTreeModel->setShowParentPtrFields(false);
//TheTreeModel->setShowChildPtrFields(false);
TheTreeModel->setShowAttachments(false);
//TheTreeModel->setShowCallbackFunctors(false);
//Tree Component Generator
FieldContainerFieldPathComponentGeneratorRecPtr TheTreeComponentGenerator = FieldContainerFieldPathComponentGenerator::create();
//Create the Tree
TreeRecPtr TheTree = Tree::create();
TheTree->setPreferredSize(Vec2f(100, 500));
TheTree->setRootVisible(true);
TheTree->setModel(TheTreeModel);
TheTree->setCellGenerator(TheTreeComponentGenerator);
setName(TheTree, std::string("TheTree"));
// Create a ScrollPanel for easier viewing of the List (see 27ScrollPanel)
ScrollPanelRecPtr ExampleScrollPanel = ScrollPanel::create();
ExampleScrollPanel->setPreferredSize(Vec2f(350,500));
//ExampleScrollPanel->setHorizontalResizePolicy(ScrollPanel::RESIZE_TO_VIEW);
//.........这里部分代码省略.........
示例2: main
//.........这里部分代码省略.........
-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);
//Create the Documentation Foreground and add it to the viewport
SimpleScreenDoc TheSimpleScreenDoc(sceneManager, TutorialWindow);
// 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;
}
示例3: main
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();
/******************************************************
Creates some Button components
and edit their Text.
******************************************************/
ButtonRecPtr ExampleButton1 = Button::create();
ButtonRecPtr ExampleButton2 = Button::create();
ButtonRecPtr ExampleButton3 = Button::create();
ButtonRecPtr ExampleButton4 = Button::create();
ButtonRecPtr ExampleButton5 = Button::create();
ButtonRecPtr ExampleButton6 = Button::create();
ExampleButton1->setText("This");
ExampleButton2->setText("is a");
ExampleButton3->setText("sample");
ExampleButton4->setText("two");
ExampleButton5->setText("Panel");
ExampleButton6->setText("layout");
/******************************************************
Create some Flow and BoxLayouts to be
used with the Main Frame and two
Panels.
******************************************************/
FlowLayoutRecPtr MainInternalWindowLayout = FlowLayout::create();
FlowLayoutRecPtr ExamplePanel1Layout = FlowLayout::create();
FlowLayoutRecPtr ExamplePanel2Layout = FlowLayout::create();
ExamplePanel1Layout->setOrientation(FlowLayout::VERTICAL_ORIENTATION);
/******************************************************
Create two Backgrounds to be used with
Panels and MainInternalWindow.
******************************************************/
ColorLayerRecPtr MainInternalWindowBackground = ColorLayer::create();
ColorLayerRecPtr ExamplePanelBackground = ColorLayer::create();
MainInternalWindowBackground->setColor(Color4f(1.0,1.0,1.0,0.5));
ExamplePanelBackground->setColor(Color4f(0.0,0.0,0.0,1.0));
/******************************************************
Create a Border to be used with
the two Panels.
******************************************************/
LineBorderRecPtr ExamplePanelBorder = LineBorder::create();
ExamplePanelBorder->setColor(Color4f(0.9, 0.9, 0.9, 1.0));
ExamplePanelBorder->setWidth(3);
//.........这里部分代码省略.........
示例4: main
//.........这里部分代码省略.........
ExampleSubMenu->addItem(SubMenuItem1);
ExampleSubMenu->addItem(SubMenuItem2);
ExampleSubMenu->addItem(SubMenuItem3);
/******************************************************
Create the PopupMenu itself.
Items are added in the order in which
they will be displayed (top to bottom)
via addItem(ItemToBeAdded)
The PopupMenu is attached to a
Button below using
setPopupMenu(PopupMenuName).
Note: PopupMenus can be added to any
Component.
******************************************************/
PopupMenuRecPtr ExamplePopupMenu = PopupMenu::create();
ExamplePopupMenu->setMinSize(Vec2f(100.0f, 20.0f));
ExamplePopupMenu->setMaxSize(Vec2f(100.0f, 80.0f));
ExamplePopupMenu->addItem(MenuItem1);
ExamplePopupMenu->addItem(MenuItem2);
ExamplePopupMenu->addItem(MenuItem3);
ExamplePopupMenu->addSeparator();
ExamplePopupMenu->addItem(ExampleSubMenu);
ExamplePopupMenu->addItem(MenuItem4);
// Create a Button and Font
UIFontRecPtr PopupMenuButtonFont = UIFont::create();
PopupMenuButtonFont->setSize(16);
ButtonRecPtr PopupMenuButton = Button::create();
PopupMenuButton->setText("RightClickMe!");
// Add the PopupMenu to PopupMenuButton so that when right clicked,
// the PopupMenu will appear
PopupMenuButton->setPopupMenu(ExamplePopupMenu);
PopupMenuButton->setPreferredSize(Vec2f(200,100));
PopupMenuButton->setFont(PopupMenuButtonFont);
// 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(PopupMenuButton);
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);
//Create the Documentation Foreground and add it to the viewport
SimpleScreenDoc TheSimpleScreenDoc(sceneManager, TutorialWindow);
// 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,
"01RubberBandCamera");
//Enter main Loop
TutorialWindow->mainLoop();
}
osgExit();
return 0;
}
示例5: main
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(keyTyped, _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();
ColorChooserRecPtr TheColorChooser = ColorChooser::create();
TheColorChooser->setColor(Color4f(1.0f,0.0f,0.0f,1.0f));
// Create Background to be used with the MainInternalWindow
ColorLayerRecPtr MainInternalWindowBackground = ColorLayer::create();
MainInternalWindowBackground->setColor(Color4f(1.0,1.0,1.0,0.5));
// Create The Internal Window
InternalWindowRecPtr MainInternalWindow = InternalWindow::create();
LayoutRecPtr MainInternalWindowLayout = FlowLayout::create();
// Assign the Button to the MainInternalWindow so it will be displayed
// when the view is rendered.
MainInternalWindow->pushToChildren(TheColorChooser);
MainInternalWindow->setLayout(MainInternalWindowLayout);
MainInternalWindow->setBackgrounds(MainInternalWindowBackground);
MainInternalWindow->setPosition(Pnt2f(50,50));
MainInternalWindow->setPreferredSize(Vec2f(400,400));
MainInternalWindow->setTitle(std::string("Internal Window"));
// 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);
sceneManager.setRoot(scene);
// Add the UI Foreground Object to the Scene
ViewportRecPtr TutorialViewport = sceneManager.getWindow()->getPort(0);
TutorialViewport->addForeground(TutorialUIForeground);
//Create the Documentation Foreground and add it to the viewport
SimpleScreenDoc TheSimpleScreenDoc(&sceneManager, TutorialWindow);
// 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,
"39ColorChooser");
//Enter main Loop
TutorialWindow->mainLoop();
}
osgExit();
return 0;
}
示例6: createMainInternalWindow
//.........这里部分代码省略.........
ExampleTabButton2->setText("Tab2");
ExampleTabButton3->setText("To Rotate");
ExampleTabButton4->setText("Tab4");
ExampleTabButton5->setText("To Zoom");
ExampleTabButton6->setText("To Move");
ExampleTabContentA->setText("Add another Tab");
ExampleTabContentB->setText("Add a Tab in Tab1!");
ExampleTabContentC->setText("Enable CapsLock, then rotate scene using left Mouse button!");
ExampleTabContentD->setText("Enable CapsLock, then zoom in and out with right Mouse button and dragging");
ExampleTabContentE->setText("Enable CapsLock, then move using center Mouse button");
/******************************************************
Create a Panel to add to the TabPanel
******************************************************/
// Create and edit the Panel Buttons
ButtonRecPtr ExampleTabPanelButton1 = Button::create();
ButtonRecPtr ExampleTabPanelButton2 = Button::create();
ButtonRecPtr ExampleTabPanelButton3 = Button::create();
ButtonRecPtr ExampleTabPanelButton4 = Button::create();
ButtonRecPtr ExampleTabPanelButton5 = Button::create();
ButtonRecPtr ExampleTabPanelButton6 = Button::create();
ExampleTabPanelButton1->setText("This is a");
ExampleTabPanelButton2->setText("sample");
ExampleTabPanelButton3->setText("UIRectangle");
ExampleTabPanelButton4->setText("containing");
ExampleTabPanelButton5->setText("interactive");
ExampleTabPanelButton6->setText("components");
// Create and edit Panel Layout
BoxLayoutRecPtr TabPanelLayout = BoxLayout::create();
TabPanelLayout->setOrientation(BoxLayout::VERTICAL_ORIENTATION);
// Create and edit Panel
PanelRecPtr ExampleTabPanelPanel = Panel::create();
ExampleTabPanelPanel->setPreferredSize(Vec2f(180, 500));
ExampleTabPanelPanel->pushToChildren(ExampleTabPanelButton1);
ExampleTabPanelPanel->pushToChildren(ExampleTabPanelButton2);
ExampleTabPanelPanel->pushToChildren(ExampleTabPanelButton3);
ExampleTabPanelPanel->pushToChildren(ExampleTabPanelButton4);
ExampleTabPanelPanel->pushToChildren(ExampleTabPanelButton5);
ExampleTabPanelPanel->pushToChildren(ExampleTabPanelButton6);
ExampleTabPanelPanel->setLayout(TabPanelLayout);
TabPanelRecPtr ExampleTabPanel = TabPanel::create();
ExampleTabPanel->setPreferredSize(Vec2f(350,350));
ExampleTabPanel->addTab(ExampleTabButton1, ExampleTabContentA);
ExampleTabPanel->addTab(ExampleTabButton2, ExampleTabContentB);
ExampleTabPanel->addTab(ExampleTabButton3, ExampleTabContentC);
ExampleTabPanel->addTab(ExampleTabButton4, ExampleTabPanelPanel);
ExampleTabPanel->addTab(ExampleTabButton5, ExampleTabContentD);
ExampleTabPanel->addTab(ExampleTabButton6, ExampleTabContentE);
ExampleTabPanel->setTabAlignment(0.5f);
ExampleTabPanel->setTabPlacement(TabPanel::PLACEMENT_SOUTH);
ExampleTabPanel->setSelectedIndex(3);
// 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));
CardLayoutRecPtr MainInternalWindowLayout = CardLayout::create();
InternalWindowRecPtr MainInternalWindow = InternalWindow::create();
MainInternalWindow->pushToChildren(ExampleTabPanel);
MainInternalWindow->setLayout(MainInternalWindowLayout);
MainInternalWindow->setBackgrounds(MainInternalWindowBackground);
MainInternalWindow->setAlignmentInDrawingSurface(Vec2f(0.5f,0.5f));
MainInternalWindow->setScalingInDrawingSurface(Vec2f(1.0f,1.0f));
MainInternalWindow->setDrawTitlebar(false);
MainInternalWindow->setResizable(false);
ExampleTabContentB->connectActionPerformed(boost::bind(handleRemoveTabAction, _1,
ExampleTabPanel.get(),
ExampleTabContentA.get(),
ExampleTabContentB.get()));
ExampleTabContentA->connectActionPerformed(boost::bind(handleAddTabAction, _1,
ExampleTabPanel.get(),
ExampleTabContentA.get(),
ExampleTabContentB.get()));
return InternalWindowTransitPtr(MainInternalWindow);
}