Beispiel #1
0
// Pop up a message box with specified title/text
//-----------------------------------------------------------------------------
void CPUT_DX11::DrawLoadingFrame()
{
    // fill first frame with clear values so render order later is ok
    const float srgbClearColor[] = { 0.0993f, 0.0993f, 0.0993f, 1.0f };
    mpContext->ClearRenderTargetView( mpBackBufferRTV, srgbClearColor );
    mpContext->ClearDepthStencilView(mpDepthStencilView, D3D11_CLEAR_DEPTH | D3D11_CLEAR_STENCIL, 0.0f, 0);

    // get center
    int x,y,width,height;
    CPUTOSServices::GetOSServices()->GetClientDimensions(&x, &y, &width, &height);

    // draw "loading..." text
    CPUTGuiControllerDX11 *pGUIController = CPUTGuiControllerDX11::GetController();
    CPUTText *pText = NULL;
    pGUIController->CreateText(_L("Just a moment, now loading..."), 999, 0, &pText);
    pGUIController->EnableAutoLayout(false);
    int textWidth, textHeight;
    pText->GetDimensions(textWidth, textHeight);
    pText->SetPosition(width/2-textWidth/2, height/2);

    pGUIController->Draw(mpContext);
    pGUIController->DeleteAllControls();
    pGUIController->EnableAutoLayout(true);
    
    // present loading screen
    mpSwapChain->Present( mSyncInterval, 0 );
}
// Pop up a message box with specified title/text
//-----------------------------------------------------------------------------
void CPUT_OGL::DrawLoadingFrame()
{
    DEBUG_PRINT(_L("DrawLoadingFrame()"));
    // fill first frame with clear values so render order later is ok
    const float srgbClearColor[] = { 0.0993f, 0.0993f, 0.0993f, 1.0f };
    glClearColor(0, 0, 0, 1);
    glClear(GL_COLOR_BUFFER_BIT);


    CPUTGuiControllerOGL *pGUIController = CPUTGuiControllerOGL::GetController();
    CPUTText *pText = NULL;
    pGUIController->CreateText(_L("Just a moment, now loading..."), 999, 0, &pText);

    pGUIController->EnableAutoLayout(false);
    int textWidth, textHeight;
    pText->GetDimensions(textWidth, textHeight);
    int width,height;
    mpWindow->GetClientDimensions(&width, &height);
    pText->SetPosition(width/2-textWidth/2, height/2);

    pGUIController->Draw();
    pGUIController->DeleteAllControls();
    pGUIController->EnableAutoLayout(true);
    
    // present loading screen
    Present();
    
}