// 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(); }
// Add an item to the selection list //----------------------------------------------------------------------------- CPUTResult CPUTDropdown::AddSelectionItem(const cString Item, bool bIsSelected) { // Don't allow adding 'empty' elements // causes a spacing issue if(0==Item.size()) { return CPUT_ERROR_INVALID_PARAMETER; } // create a static item to hold the text CPUTText *pNewItem = new CPUTText(mpFont); pNewItem->SetText(Item, 0.35f); // set the text slightly higher than the 0.5 normal mode mpListOfSelectableItems.push_back(pNewItem); // Should this be the currently selected item? if(bIsSelected) { mSelectedItemIndex = (int) mpListOfSelectableItems.size()-1; } // was this the first item added to an empty list? if( 1==mpListOfSelectableItems.size() ) { mSelectedItemIndex=0; } // mark that a resize of dropdown selection box is needed mbSizeDirty = true; Recalculate(); // position or size may move - force a recalculation of this control's location // if it is managed by the auto-arrange function if(this->IsAutoArranged()) { CPUTGuiControllerDX11::GetController()->Resize(); } return CPUT_SUCCESS; }