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


C++ WindowEventProducerRefPtr::connectWindowEntered方法代码示例

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


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

示例1: main

// Initialize WIN32 & OpenSG and set up the scene
int main(int argc, char **argv)
{
    // OSG init
    osgInit(argc,argv);

    {
        // create the scene
        NodeRecPtr scene = makeTorus(.5, 2, 16, 16);

        //Create a Window object
        WindowEventProducerRefPtr TheWindow = createNativeWindow();

        //Apply window settings
        TheWindow->setUseCallbackForDraw(true);
        TheWindow->setUseCallbackForReshape(true);
        //TheWindow->setFullscreen(true);
        
        
        
        //Initialize Window
        TheWindow->initWindow();

        commitChanges();
        
        // create the SimpleSceneManager helper
        SimpleSceneManager sceneManager;
        TheWindow->setDisplayCallback(boost::bind(display, &sceneManager));
        TheWindow->setReshapeCallback(boost::bind(reshape, _1, &sceneManager));

        // tell the manager what to manage
        sceneManager.setWindow(TheWindow);
        sceneManager.setRoot  (scene);

        //Attach to the Mouse Events
        TheWindow->connectMouseClicked(boost::bind(mouseClicked, _1));
        TheWindow->connectMousePressed(boost::bind(mousePressed, _1, &sceneManager));
        TheWindow->connectMouseReleased(boost::bind(mouseReleased, _1, &sceneManager));
        TheWindow->connectMouseMoved(boost::bind(mouseMoved, _1, &sceneManager));
        TheWindow->connectMouseDragged(boost::bind(mouseDragged, _1, &sceneManager));
        TheWindow->connectMouseEntered(boost::bind(mouseEntered, _1));
        TheWindow->connectMouseExited(boost::bind(mouseExited, _1));
        
        TheWindow->connectMouseWheelMoved(boost::bind(mouseWheelMoved, _1, &sceneManager));

        //Attach to the Key Events
        TheWindow->connectKeyPressed(boost::bind(keyPressed, _1));
        TheWindow->connectKeyReleased(boost::bind(keyReleased, _1));
        TheWindow->connectKeyTyped(boost::bind(keyTyped, _1));

        //Attach to the Window Events
        TheWindow->connectWindowOpened(boost::bind(windowOpened, _1));
        TheWindow->connectWindowClosing(boost::bind(windowClosing, _1));
        TheWindow->connectWindowClosed(boost::bind(windowClosed, _1));
        TheWindow->connectWindowIconified(boost::bind(windowIconified, _1));
        TheWindow->connectWindowDeiconified(boost::bind(windowDeiconified, _1));
        TheWindow->connectWindowActivated(boost::bind(windowActivated, _1));
        TheWindow->connectWindowDeactivated(boost::bind(windowDeactivated, _1));
        TheWindow->connectWindowEntered(boost::bind(windowEntered, _1));
        TheWindow->connectWindowExited(boost::bind(windowExited, _1));

        //Create the Documentation Foreground and add it to the viewport
        SimpleScreenDoc TheSimpleScreenDoc(&sceneManager, TheWindow);

        // show the whole scene
        sceneManager.showAll();

        // show statistics
        sceneManager.setStatistics(true);


        //Open Window
        Vec2f WinSize(TheWindow->getDesktopSize() * 0.85f);
        Pnt2f WinPos((TheWindow->getDesktopSize() - WinSize) *0.5);
        TheWindow->openWindow(WinPos,
                            WinSize,
                            "01 Native Window");

        //Enter main loop
        TheWindow->mainLoop();
    }

    osgExit();
    return 0;
}
开发者ID:Himbeertoni,项目名称:OpenSGToolbox,代码行数:85,代码来源:01NativeWindow.cpp


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