void GLXConfigurator::SetConfigOption(const std::string &optionName, const std::string &valueName) { if(!mRenderer) // No renderer set -- how can this be called? return; mRenderer->setConfigOption(optionName, valueName); SetRenderer(mRenderer); }
Burger::DisplayDIB::DisplayDIB(Burger::GameApp *pGameApp) : Display(pGameApp,DIB), m_pWindowDC(NULL), m_pBitMapDC(NULL) { SetRenderer(NULL); }
// Called when the menu loses focus void CMenuDisplay::OnFocus(DBOOL bFocus) { HCONSOLEVAR hVar; int curMO, oldMO; DBOOL bSet; // Set the render mode if we are losing focus if (!bFocus && m_pRendererCtrl && m_pResolutionCtrl) { hVar = m_pClientDE->GetConsoleVar("MipmapOffset"); oldMO = (int)m_pClientDE->GetVarValueFloat (hVar); UpdateData(); // Save the global detail setting SaveDetailSetting(); bSet = SetRenderer(m_pRendererCtrl->GetSelIndex(), m_pResolutionCtrl->GetSelIndex()); // If we didn't switch resolutions and the mipmap offset changed, rebind textures. if(!bSet) { hVar = m_pClientDE->GetConsoleVar("MipmapOffset"); curMO = (int)m_pClientDE->GetVarValueFloat (hVar); if(curMO != oldMO) { m_pClientDE->RunConsoleString("RebindTextures"); } } } else { // The current render mode RMode currentMode; m_pClientDE->GetRenderMode(¤tMode); // Set the renderer controls so that they match the currently selected renderer unsigned int n; for (n=0; n < m_rendererArray.GetSize(); n++) { unsigned int i; for (i=0; i < m_rendererArray[n].m_resolutionArray.GetSize(); i++) { RMode mode=GetRendererModeStruct(n, i); if (IsRendererEqual(¤tMode, &mode)) { // Set the renderer index m_pRendererCtrl->SetSelIndex(n); // Setup the resolution control SetupResolutionCtrl(); // Set the resolution index m_pResolutionCtrl->SetSelIndex(i); } } } } }
void StyledCheckBox::Init() { SetRenderer(std::shared_ptr<DefaultCheckBoxRenderer>(new DefaultCheckBoxRenderer())); SetMinSize(wxSize(DEFAULT_MIN_WIDTH, 14)); SetOpaque(false); pimpl->checked = false; }
Burger::DisplayOpenGL::DisplayOpenGL(Burger::GameApp *pGameApp) : Display(pGameApp,OPENGL), m_pCompressedFormats(NULL), m_fOpenGLVersion(0.0f), m_fShadingLanguageVersion(0.0f), m_uCompressedFormatCount(0) { SetRenderer(NULL); }
StyledTextBox::StyledTextBox(wxWindow* parent, wxString text, wxStandardID id) : StyledWindow(parent, text ,id) { pimpl = std::make_shared<StyledTextBoxImpl>(); SetWindowStyle(GetWindowStyle() | wxWANTS_CHARS); SetRenderer(std::make_shared<StyledTextBoxRenderer>()); SetInsets(Insets(3, 3, 3, 3)); SetMinSize(wxSize(0, 22)); }
bool wxSheetCellAttr::Copy(const wxSheetCellAttr& other) { wxCHECK_MSG(other.Ok(), false, wxT("Attr to copy from is not created")); if (!Create()) return false; M_CELLATTRDATA->m_foreColour = ((wxSheetCellAttrRefData*)other.GetRefData())->m_foreColour; M_CELLATTRDATA->m_backColour = ((wxSheetCellAttrRefData*)other.GetRefData())->m_backColour; M_CELLATTRDATA->m_font = ((wxSheetCellAttrRefData*)other.GetRefData())->m_font; M_CELLATTRDATA->m_attrTypes = ((wxSheetCellAttrRefData*)other.GetRefData())->m_attrTypes; if (other.HasEditor()) SetEditor(((wxSheetCellAttrRefData*)other.m_refData)->m_editor->Clone()); if (other.HasRenderer()) SetRenderer(((wxSheetCellAttrRefData*)other.m_refData)->m_renderer->Clone()); SetDefaultAttr(other.GetDefaultAttr()); return true; }
bool wxSheetCellAttr::MergeWith(const wxSheetCellAttr &other) { wxCHECK_MSG(Ok() && other.Ok(), false, wxT("this or Attr to MergeWith from is not created")); if ( !HasForegoundColour() && other.HasForegoundColour() ) SetForegroundColour(other.GetForegroundColour()); if ( !HasBackgroundColour() && other.HasBackgroundColour() ) SetBackgroundColour(other.GetBackgroundColour()); if ( !HasFont() && other.HasFont() ) SetFont(other.GetFont()); if ( !HasAlignment() && other.HasAlignment() ) SetAlignment(other.GetAlignment()); if ( !HasOrientation() && other.HasOrientation() ) SetOrientation(other.GetOrientation()); if ( !HasLevel() && other.HasLevel() ) SetLevel(other.GetLevel()); if ( !HasReadWriteMode() && other.HasReadWriteMode() ) SetReadOnly(other.GetReadOnly()); if ( !HasOverflowMode() && other.HasOverflowMode() ) SetOverflow(other.GetOverflow()); if ( !HasOverflowMarkerMode() && other.HasOverflowMarkerMode() ) SetOverflowMarker(other.GetOverflowMarker()); if ( !HasShowEditorMode() && other.HasShowEditorMode() ) SetShowEditor(other.GetShowEditor()); // Directly access m_renderer/m_editor as GetRender/Editor may return different one // Maybe add support for merge of Render and Editor? if ( !HasRenderer() && other.HasRenderer() ) SetRenderer(((wxSheetCellAttrRefData*)other.m_refData)->m_renderer->Clone()); if ( !HasEditor() && other.HasEditor() ) SetEditor(((wxSheetCellAttrRefData*)other.m_refData)->m_editor->Clone()); if ( !HasDefaultAttr() && other.HasDefaultAttr() ) SetDefaultAttr(other.GetDefaultAttr()); return true; }
bool GLXConfigurator::CreateWindow() { const char *bla[] = {"Rendering Settings", "-bg", "honeydew3", "-fg", "black","-bd","darkseagreen4"}; int argc = sizeof(bla)/sizeof(*bla); toplevel = XtVaOpenApplication(&appContext, "OGRE", NULL, 0, &argc, const_cast<char**>(bla), NULL,sessionShellWidgetClass, XtNwidth, mWidth, XtNheight, mHeight, XtNminWidth, mWidth, XtNmaxWidth, mWidth, XtNminHeight, mHeight, XtNmaxHeight, mHeight, XtNallowShellResize, False, XtNborderWidth, 0, XtNoverrideRedirect, False, NULL, NULL); /* Find out display and screen used */ mDisplay = XtDisplay(toplevel); int screen = DefaultScreen(mDisplay); Window rootWindow = RootWindow(mDisplay,screen); /* Move to center of display */ int w = DisplayWidth(mDisplay, screen); int h = DisplayHeight(mDisplay, screen); XtVaSetValues(toplevel, XtNx, w/2-mWidth/2, XtNy, h/2-mHeight/2, 0, NULL); /* Backdrop stuff */ mBackDrop = CreateBackdrop(rootWindow, DefaultDepth(mDisplay,screen)); /* Create toplevel */ box = XtVaCreateManagedWidget("box",formWidgetClass,toplevel, XtNbackgroundPixmap, mBackDrop, 0,NULL); /* Create renderer selection */ int cury = ystart + 0*rowh; Widget lb1 = XtVaCreateManagedWidget("topLabel", labelWidgetClass, box, XtNlabel, "Select Renderer", XtNborderWidth, 0, XtNwidth, col1w, // Fixed width XtNheight, 18, XtNleft, XawChainLeft, XtNtop, XawChainTop, XtNright, XawChainLeft, XtNbottom, XawChainTop, XtNhorizDistance, col1x, XtNvertDistance, cury, XtNjustify, XtJustifyLeft, NULL); const char *curRenderName = " Select One "; // Name of current renderer, or hint to select one if(mRenderer) curRenderName = mRenderer->getName().c_str(); Widget mb1 = XtVaCreateManagedWidget("Menu", menuButtonWidgetClass, box, XtNlabel,curRenderName, XtNresize, false, XtNresizable, false, XtNwidth, col2w, // Fixed width XtNheight, 18, XtNleft, XawChainLeft, XtNtop, XawChainTop, XtNright, XawChainLeft, XtNbottom, XawChainTop, XtNhorizDistance, col2x, XtNvertDistance, cury, NULL); Widget menu = XtVaCreatePopupShell("menu", simpleMenuWidgetClass, mb1, 0, NULL); const RenderSystemList& renderers = Root::getSingleton().getAvailableRenderers(); for (RenderSystemList::const_iterator pRend = renderers.begin(); pRend != renderers.end(); pRend++) { // Create callback data mRendererCallbackData.push_back(RendererCallbackData(this, *pRend, mb1)); Widget entry = XtVaCreateManagedWidget("menuentry", smeBSBObjectClass, menu, XtNlabel, (*pRend)->getName().c_str(), 0, NULL); XtAddCallback(entry, XtNcallback, (XtCallbackProc)&GLXConfigurator::renderSystemHandler, &mRendererCallbackData.back()); } Widget bottomPanel = XtVaCreateManagedWidget("bottomPanel", formWidgetClass, box, XtNsensitive, True, XtNborderWidth, 0, XtNwidth, 150, // Fixed width XtNleft, XawChainLeft, XtNtop, XawChainTop, XtNright, XawChainLeft, XtNbottom, XawChainTop, XtNhorizDistance, mWidth - 160, XtNvertDistance, mHeight - 40, NULL); Widget helloButton = XtVaCreateManagedWidget("cancelButton", commandWidgetClass, bottomPanel, XtNlabel," Cancel ", NULL); XtAddCallback(helloButton, XtNcallback, (XtCallbackProc)&GLXConfigurator::cancelHandler, this); Widget exitButton = XtVaCreateManagedWidget("acceptButton", commandWidgetClass, bottomPanel, XtNlabel," Accept ", XtNfromHoriz,helloButton, NULL); XtAddCallback(exitButton, XtNcallback, (XtCallbackProc)&GLXConfigurator::acceptHandler, this); XtRealizeWidget(toplevel); if(mRenderer) /* There was already a renderer selected; display its options */ SetRenderer(mRenderer); return true; }
void vParticle::CreateRectRenderer( const char *pszMaterial, float scalex, float scaley ) { vParticleRenderer_Rect *r = new vParticleRenderer_Rect( pszMaterial, scalex, scaley ); SetRenderer( r ); }
void vParticle::CreateQuadRenderer( const char *pszMaterial ) { vParticleRenderer_Quad *r = new vParticleRenderer_Quad( pszMaterial ); SetRenderer( r ); }
bool OnCommand(HWND hwnd, WORD commandID) { HRESULT hr = S_OK; switch (commandID) { case IDM_EXIT: DestroyWindow(hwnd); break; case ID_EDIT_COPY: OnCopy(hwnd); break; case ID_EDIT_PASTE: OnPaste(hwnd); break; case ID_EDIT_FONT: hr = OnChooseFont(hwnd); break; case ID_EDIT_INCREASETEXTSIZE: hr = IncreaseFontSize(hwnd); break; case ID_EDIT_DECREASETEXTSIZE: hr = DecreaseFontSize(hwnd); break; case ID_VIEW_ROTATELEFT: if ((g_degrees -= 3) < 0) g_degrees += 360; SetTransform(hwnd); InvalidateRect(hwnd, NULL, TRUE); break; case ID_VIEW_ROTATERIGHT: if ((g_degrees += 3) >= 360) g_degrees -= 360; SetTransform(hwnd); InvalidateRect(hwnd, NULL, TRUE); break; case ID_VIEW_NUDGELEFT: g_animationStartCount = GetTickCount(); g_animationDuration = 0.1f; g_animationStartX = g_animationCurrentX; g_animationEndX = g_animationCurrentX - 10.0f; InvalidateRect(hwnd, NULL, TRUE); break; case ID_VIEW_NUDGERIGHT: g_animationStartCount = GetTickCount(); g_animationDuration = 0.1f; g_animationStartX = g_animationCurrentX; g_animationEndX = g_animationCurrentX + 10.0f; InvalidateRect(hwnd, NULL, TRUE); break; case ID_VIEW_SHOWMAGNIFIER: g_magnifier.visible = !g_magnifier.visible; if (g_renderer != NULL) { g_renderer->SetMagnifier(g_magnifier); InvalidateRect(hwnd, NULL, TRUE); } break; case ID_MAGNIFIERTYPE_VECTOR: SetMagnifierType(hwnd, MagnifierInfo::Vector); break; case ID_MAGNIFIERTYPE_PIXELS: SetMagnifierType(hwnd, MagnifierInfo::Pixel); break; case ID_MAGNIFIERTYPE_SUBPIXELS: SetMagnifierType(hwnd, MagnifierInfo::Subpixel); break; case ID_MAGNIFIERSCALE_3X: SetMagnifierScale(hwnd, 3); break; case ID_MAGNIFIERSCALE_6X: SetMagnifierScale(hwnd, 6); break; case ID_OPTIONS_NATURALMODE: SetMeasuringMode(hwnd, DWRITE_MEASURING_MODE_NATURAL); break; case ID_OPTIONS_GDICLASSICMODE: SetMeasuringMode(hwnd, DWRITE_MEASURING_MODE_GDI_CLASSIC); break; case ID_OPTIONS_GDINATURALMODE: SetMeasuringMode(hwnd, DWRITE_MEASURING_MODE_GDI_NATURAL); break; case ID_OPTIONS_USEDIRECT2D: SetRenderer(hwnd, RendererD2D); break; case ID_OPTIONS_USEDIRECTWRITE: SetRenderer(hwnd, RendererDWrite); break; default: return false; } if (FAILED(hr)) PostQuitMessage(hr); return true; }
// Called when the folder gains or focus void CFolderDisplay::OnFocus(LTBOOL bFocus) { CGameSettings *pSettings = g_pInterfaceMgr->GetSettings(); if (bFocus) { m_bEscape = LTFALSE; m_bHardwareCursor = (GetConsoleInt("HardwareCursor",0) > 0 && GetConsoleInt("DisableHardwareCursor",0) == 0); m_pHardwareCursor->Enable(GetConsoleInt("DisableHardwareCursor",0) == 0); // The current render mode RMode currentMode; g_pLTClient->GetRenderMode(¤tMode); // Set the renderer controls so that they match the currently selected renderer unsigned int n; for (n=0; n < m_rendererArray.GetSize(); n++) { unsigned int i; for (i=0; i < m_rendererArray[n].m_resolutionArray.GetSize(); i++) { RMode mode=GetRendererModeStruct(n, i); if (IsRendererEqual(¤tMode, &mode)) { // Set the renderer index m_pRendererCtrl->SetSelIndex(n); // Setup the resolution control SetupResolutionCtrl(); // Set the resolution index m_pResolutionCtrl->SetSelIndex(i); } } } m_bTexture32 = pSettings->GetBoolVar("32BitTextures"); UpdateData(LTFALSE); SetSelection(1); } else { UpdateData(); if (m_bEscape) { LTBOOL bTexture32 = pSettings->GetBoolVar("32BitTextures"); WriteConsoleInt("HardwareCursor",(int)m_bHardwareCursor); pSettings->SetBoolVar("32BitTextures",m_bTexture32); LTBOOL bRebind = (bTexture32 != m_bTexture32); // Set the render mode if we are losing focus if (m_pRendererCtrl && m_pResolutionCtrl) { int oldMO = (int)pSettings->GetFloatVar("MipmapOffset"); LTBOOL bSet = SetRenderer(m_pRendererCtrl->GetSelIndex(), m_pResolutionCtrl->GetSelIndex()); // If we didn't switch resolutions and the mipmap offset changed, rebind textures. if(!bSet) { int curMO = (int)pSettings->GetFloatVar("MipmapOffset"); if(curMO != oldMO) { bRebind = LTTRUE; } } } if (bRebind) { g_pLTClient->Start3D(); g_pLTClient->StartOptimized2D(); g_pInterfaceResMgr->DrawMessage(GetSmallFont(),IDS_REBINDING_TEXTURES); g_pLTClient->EndOptimized2D(); g_pLTClient->End3D(); g_pLTClient->FlipScreen(0); g_pLTClient->RunConsoleString("RebindTextures"); } } if (GetConsoleInt("BitDepth",16) == 16) WriteConsoleInt("DrawPortals",0); else if ((GetConsoleInt("BitDepth",16) == 32) && (GetConsoleInt("PerformanceLevel",1) == 2)) WriteConsoleInt("DrawPortals",1); g_pLTClient->WriteConfigFile("autoexec.cfg"); } CBaseFolder::OnFocus(bFocus); }
Window::Window(const Rect& r, unique_ptr<Renderer> p_renderer) : Panel(r) { if(p_renderer) SetRenderer(std::move(p_renderer)); }