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


C++ UIDrawingSurfaceRecPtr::setCursorAsImage方法代码示例

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


在下文中一共展示了UIDrawingSurfaceRecPtr::setCursorAsImage方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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
        SimpleSceneManagerRefPtr sceneManager = SimpleSceneManager::create();
        TutorialWindow->setDisplayCallback(boost::bind(display, sceneManager));
        TutorialWindow->setReshapeCallback(boost::bind(reshape, _1, sceneManager));

        TutorialWindow->connectMousePressed(boost::bind(mousePressed, _1, sceneManager));
        TutorialWindow->connectMouseReleased(boost::bind(mouseReleased, _1, sceneManager));
        TutorialWindow->connectMouseDragged(boost::bind(mouseDragged, _1, sceneManager));
        TutorialWindow->connectMouseWheelMoved(boost::bind(mouseWheelMoved, _1, sceneManager));
        TutorialWindow->connectKeyPressed(boost::bind(keyPressed, _1));

        // Tell the Manager what to manage
        sceneManager->setWindow(TutorialWindow);

        // Make Torus Node (creates Torus in background of scene)
        NodeRecPtr TorusGeometryNode = makeTorus(90, 270, 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();

        /******************************************************

          The Drawing Surface is created the
          same as with previous Tutorials
          (however the MainInternalWindow is created
          in a function below).

         ******************************************************/

        UIDrawingSurfaceRecPtr TutorialDrawingSurface = UIDrawingSurface::create();
        TutorialDrawingSurface->setGraphics(TutorialGraphics);
        TutorialDrawingSurface->setEventProducer(TutorialWindow);
        TutorialDrawingSurface->setCursorAsImage(WindowEventProducer::CURSOR_POINTER,
                                                 BoostPath("./Data/cursor.png"),
                                                 Vec2f(-1.0f,-1.0f),
                                                 Vec2f(-12.0f,-20.0f));

        InternalWindowRecPtr MainUIWindow = createMainInternalWindow();
        TutorialDrawingSurface->openWindow(MainUIWindow);

        /******************************************************

          Create the 3D UIRectangle.  This allows
          the DrawingSurface to be rotated relative
          to the screen, allowing a 3D aspect to
          the DrawingSurface.  The Surface
          can still be interacted with, so Buttons,
          Menus, etc. all will still function
          normally.

          -setPoint(Pnt3f): Determine the location
          of the UIRectangle in 3D space.  Keep
          in mind that (0,0,0) is located 
          directly in the center of the sceen.
          (For our purposes it is the center 
          of the tori.) The point is located
          on the lower left corner of the 
          rectangle.
          -setWidth(float): Determine the Width
          of the UIRectangle.  This may 
          physically appear different depending
          on where the UIRectangle is placed
          as above (due to it being located
          further away, etc).
          -setHeight(float): Determine the Height
          of the UIRectangle.  This may 
          physically appear different depending
          on where the UIRectangle is placed
          as above (due to it being located
          further away, etc).
          -setDrawingSurface(DrawingSurface):
          Determine what DrawingSurface is
          drawn on the UIRectangle.  This 
          will typically be the main
          DrawingSurface, however, multiple
          DrawingSurfaces can be used with
          multiple UIRectangles.


         ******************************************************/   

        //Make A 3D Rectangle to draw the UI on
//.........这里部分代码省略.........
开发者ID:Himbeertoni,项目名称:OpenSGToolbox,代码行数:101,代码来源:20UIRectangle.cpp


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