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


C++ Application::GetRenderer方法代码示例

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


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

示例1: mySocket

static ::LRESULT CALLBACK WindowProc(::HWND hWnd, ::UINT Msg, ::WPARAM wParam, ::LPARAM lParam)
{
    Application *lpApplication = Application::GetInstance();
    switch (Msg)
    {
    case WM_CREATE:
        {
            Renderer *renderer = new Renderer(hWnd);
            renderer->Initialize();
            lpApplication->SetRenderer(renderer);

            int li32SocketVersion = MAKEWORD(1, 1);
            Networking::Socket::Initialize(li32SocketVersion);
        }
        break;

    case WM_DESTROY:
        {
            Networking::Socket::Release();

            Renderer *lpRenderer = lpApplication->GetRenderer();
            if (lpRenderer != 0)
            {
                lpRenderer->Release();
                delete lpRenderer;
                lpApplication->SetRenderer(0);
            }
        }
        break;

    case WM_CLOSE:
        {
            Renderer *lpRenderer = lpApplication->GetRenderer();
            if (0 != lpRenderer)
            {
                lpRenderer->Exit();
            }

            REPORTERROR("Sending quit message");
            ::PostQuitMessage(0);
        }
        return 0;

    case WM_DROPFILES:
        {
            ::HDROP hDrop = reinterpret_cast< ::HDROP>(wParam);
            ::UINT luFilesDropped = ::DragQueryFile(hDrop, 0xFFFFFFFF, 0, 0);
            REPORTERROR1("There were %d files dropped", luFilesDropped);

            if (1 == luFilesDropped)
            {
                ::UINT luBufferSize = ::DragQueryFile(hDrop, 0, 0, 0);
                luBufferSize += 1;
                char *lpBuffer = new char[luBufferSize];

                ::UINT luResult = ::DragQueryFile(hDrop, 0, lpBuffer, luBufferSize);
                if (0 == luResult)
                {
                    ::DWORD luErrorCode = ::GetLastError();
                    REPORTWIN32ERROR("DragQueryFile failed", luErrorCode);
                }

                struct addrinfo hints;
                ::ZeroMemory(&hints, sizeof(hints));

                hints.ai_family = AF_UNSPEC;
                hints.ai_socktype = SOCK_STREAM;
                hints.ai_protocol = IPPROTO_TCP;

#if 1
                Networking::Socket mySocket(AF_INET, SOCK_STREAM, IPPROTO_TCP);

                struct hostent *host = ::gethostbyname("localhost");

                ::SOCKADDR_IN SockAddr;
                SockAddr.sin_port = ::htons(8888);
                SockAddr.sin_family = AF_INET;
                SockAddr.sin_addr.s_addr = *((unsigned long *)host->h_addr);

                bool lbResult = mySocket.Connect(&SockAddr, sizeof(SockAddr));
#else
                // Resolve the server address and port
                struct addrinfo *result;
                int iResult = ::getaddrinfo("127.0.0.1", DEFAULT_PORT, &hints, &result);
                if ( iResult != 0 )
                {
                    REPORTWIN32MODULEERROR(::GetModuleHandle("WS2_32.dll"), "Failed to getaddrinfo, error %d, '%s'", iResult);
                }

                //::hostent *lpLocalHost = ::gethostbyname("localhost");

                Networking::Socket mySocket(result->ai_family, result->ai_socktype, result->ai_protocol);
                bool lbResult = mySocket.Connect(result->ai_addr, result->ai_addrlen);

                ::freeaddrinfo(result);
#endif

                if (lbResult)
                {
                    lbResult = mySocket.Send(lpBuffer, luBufferSize);
//.........这里部分代码省略.........
开发者ID:markfinal,项目名称:bam-graphicssdk,代码行数:101,代码来源:application.cpp


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