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


C++ WindowApplication::OnIdle方法代码示例

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


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

示例1: ProcessTimer

//----------------------------------------------------------------------------
static pascal void ProcessTimer (EventLoopTimerRef, void*)
{
	WindowApplication* theApp =
	    (WindowApplication*)Application::TheApplication;

	theApp->OnIdle();
}
开发者ID:bazhenovc,项目名称:WildMagic,代码行数:8,代码来源:Wm5AglApplication.cpp

示例2: IdleCallback

//----------------------------------------------------------------------------
static void IdleCallback ()
{
    WindowApplication* theApp =
        (WindowApplication*)Application::TheApplication;

    if (theApp)
    {
        theApp->OnIdle();
    }
}
开发者ID:2asoft,项目名称:GeometricTools,代码行数:11,代码来源:Wm5GlutApplication.cpp

示例3: Main


//.........这里部分代码省略.........
    const char* iconName = theApp->GetWindowTitle();
    Pixmap iconPixmap = None;
    XSetStandardProperties(display, window, theApp->GetWindowTitle(),
        iconName, iconPixmap, arguments, numArguments, &hints);

    // Intercept the close-window event when the user selects the
    // window close button.  The event is a "client message".
    Atom wmDelete = XInternAtom(display, "WM_DELETE_WINDOW", False);
    XSetWMProtocols(display, window, &wmDelete, 1);

    // Finish the construction of the renderer.
    GlxRendererData* data = (GlxRendererData*)mRenderer->mData;
    if (!data->FinishConstruction(window, mRenderer))
    {
        return -5;
    }

    if (theApp->OnInitialize())
    {
        // The default OnPreidle() clears the buffers. Allow the application
        // to fill them before the window is shown and before the event loop
        // starts.
        theApp->OnPreidle();

        // Display the window.
        XMapWindow(display, window);

        // Start the message pump.
        bool applicationRunning = true;
        while (applicationRunning)
        {
            if (!XPending(display))
            {
                theApp->OnIdle();
                continue;
            }

            XEvent evt;
            XNextEvent(display, &evt);
            int index;
            bool state;

            if (evt.type == ButtonPress || evt.type == ButtonRelease)
            {
                theApp->OnMouseClick(evt.xbutton.button, evt.xbutton.type,
                    evt.xbutton.x, evt.xbutton.y, evt.xbutton.state);

                if (evt.type == ButtonPress)
                {
                    index = GLXAPP_BUTTONDOWN + evt.xbutton.button;
                    state = true;
                    SetExtraData(index, sizeof(bool), &state);
                }
                else
                {
                    index = GLXAPP_BUTTONDOWN + evt.xbutton.button;
                    state = false;
                    SetExtraData(index, sizeof(bool), &state);
                }

                continue;
            }

            if (evt.type == MotionNotify)
            {
                int button = 0;
开发者ID:2asoft,项目名称:GeometricTools,代码行数:67,代码来源:Wm5GlxApplication.cpp

示例4: Main


//.........这里部分代码省略.........
        attributes[pos++] = 1;
        attributes[pos++] = WGL_DRAW_TO_WINDOW_ARB;
        attributes[pos++] = 1;
        attributes[pos++] = WGL_ACCELERATION_ARB;
        attributes[pos++] = WGL_FULL_ACCELERATION_ARB;
        attributes[pos++] = WGL_PIXEL_TYPE_ARB;
        attributes[pos++] = WGL_TYPE_RGBA_ARB;
        attributes[pos++] = WGL_RED_BITS_ARB;
        attributes[pos++] = 8;
        attributes[pos++] = WGL_GREEN_BITS_ARB;
        attributes[pos++] = 8;
        attributes[pos++] = WGL_BLUE_BITS_ARB;
        attributes[pos++] = 8;
        attributes[pos++] = WGL_ALPHA_BITS_ARB;
        attributes[pos++] = 8;
        attributes[pos++] = WGL_DEPTH_BITS_ARB;
        attributes[pos++] = 24;
        attributes[pos++] = WGL_STENCIL_BITS_ARB;
        attributes[pos++] = 8;
        attributes[pos++] = WGL_DOUBLE_BUFFER_ARB;
        attributes[pos++] = 1;
        attributes[pos++] = WGL_SAMPLE_BUFFERS_ARB;
        attributes[pos++] = 1;
        attributes[pos++] = WGL_SAMPLES_ARB;
        attributes[pos++] = numMultisamples;
        attributes[pos++] = 0; // list is zero-terminated

        unsigned int numFormats = 0;
        BOOL successful = wglChoosePixelFormatARB(input.mRendererDC,
            attributes, 0, 1, &input.mPixelFormat, &numFormats);
        if (successful && numFormats > 0)
        {
            // The card supports multisampling with the requested number of
            // samples.  Recreate the window and renderer.
            delete0(mRenderer);

            gsIgnoreWindowDestroy = true;
            DestroyWindow(handle);

            handle = CreateWindow(sWindowClass, theApp->GetWindowTitle(),
                WS_OVERLAPPEDWINDOW, theApp->GetXPosition(),
                theApp->GetYPosition(), rect.right - rect.left + 1,
                rect.bottom - rect.top + 1, 0, 0, 0, 0);

            theApp->SetWindowID(PtrToInt(handle));

            input.mWindowHandle = handle;
            mRenderer = new0 Renderer(input, theApp->GetWidth(),
                theApp->GetHeight(), mColorFormat, mDepthStencilFormat,
                mNumMultisamples);
        }
    }
#endif

    if (theApp->OnInitialize())
    {
        // The default OnPreidle() clears the buffers.  Allow the application
        // to fill them before the window is shown and before the event loop
        // starts.
        theApp->OnPreidle();

        // Display the window.
        ShowWindow(handle, SW_SHOW);
        UpdateWindow(handle);

        // Start the message pump.
        bool applicationRunning = true;
        while (applicationRunning)
        {
            MSG msg;
            if (PeekMessage(&msg, 0, 0, 0, PM_REMOVE))
            {
                if (msg.message == WM_QUIT)
                {
                    applicationRunning = false;
                    continue;
                }

                HACCEL accel = 0;
                if (!TranslateAccelerator(handle, accel, &msg))
                {
                    TranslateMessage(&msg);
                    DispatchMessage(&msg);
                }
            }
            else
            {
                theApp->OnIdle();
            }
        }
    }
    theApp->OnTerminate();
    delete0(mRenderer);

#ifdef WM5_USE_DX9
    input.mDriver->Release();
#endif

    return 0;
}
开发者ID:rasslingcats,项目名称:calico,代码行数:101,代码来源:Wm5WinApplication.cpp


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