From 197c56c9aea8e047edfd13f4a16ecfe435c1862d Mon Sep 17 00:00:00 2001 From: jp9000 Date: Tue, 17 Dec 2013 02:08:41 -0700 Subject: [PATCH] add code to select renderer --- obs/obs-app.cpp | 8 ++++++++ obs/platform-windows.cpp | 11 +++++------ obs/settings-basic-video.cpp | 33 +++++++++++++++++++++++++++++++++ 3 files changed, 46 insertions(+), 6 deletions(-) diff --git a/obs/obs-app.cpp b/obs/obs-app.cpp index ca2288c0e..7d419805b 100644 --- a/obs/obs-app.cpp +++ b/obs/obs-app.cpp @@ -69,6 +69,14 @@ bool OBSApp::InitGlobalConfigDefaults() uint32_t cx = monitors[0].cx; uint32_t cy = monitors[0].cy; +#if _WIN32 + config_set_default_string(globalConfig, "Video", "Renderer", + "Direct3D 11"); +#else + config_set_default_string(globalConfig, "Video", "Renderer", + "OpenGL"); +#endif + config_set_default_uint(globalConfig, "Video", "BaseCX", cx); config_set_default_uint(globalConfig, "Video", "BaseCY", cy); diff --git a/obs/platform-windows.cpp b/obs/platform-windows.cpp index e5af5ae42..9e1dfc122 100644 --- a/obs/platform-windows.cpp +++ b/obs/platform-windows.cpp @@ -36,12 +36,11 @@ static BOOL CALLBACK OBSMonitorEnumProc(HMONITOR hMonitor, HDC hdcMonitor, { vector &monitors = *(vector *)param; - MonitorInfo monitor; - monitor.x = rect->left; - monitor.y = rect->top; - monitor.cx = rect->right - rect->left; - monitor.cy = rect->bottom - rect->top; - monitors.push_back(monitor); + monitors.emplace_back( + rect->left, + rect->top, + rect->right - rect->left, + rect->bottom - rect->top); return true; } diff --git a/obs/settings-basic-video.cpp b/obs/settings-basic-video.cpp index 36ce69f35..d59af46e9 100644 --- a/obs/settings-basic-video.cpp +++ b/obs/settings-basic-video.cpp @@ -30,6 +30,7 @@ class BasicVideoData : public BasicSettingsData { ConnectorList connections; int AddRes(uint32_t cx, uint32_t cy); + void LoadOther(); void LoadResolutionData(); void LoadFPSData(); void LoadFPSCommon(); @@ -41,6 +42,7 @@ class BasicVideoData : public BasicSettingsData { void BaseResListChanged(wxCommandEvent &event); void OutputResListChanged(wxCommandEvent &event); + void SaveOther(); void SaveFPSData(); void SaveFPSCommon(); void SaveFPSInteger(); @@ -107,6 +109,24 @@ int BasicVideoData::AddRes(uint32_t cx, uint32_t cy) return window->baseResList->Append(res.str().c_str()); } +void BasicVideoData::LoadOther() +{ + const char *renderer = config_get_string(GetGlobalConfig(), "Video", + "Renderer"); + + window->rendererList->Clear(); + window->rendererList->Append("OpenGL"); +#ifdef _WIN32 + window->rendererList->Append("Direct3D 11"); +#endif + + int sel = window->rendererList->FindString(renderer); + if (sel == wxNOT_FOUND) + sel = 0; + + window->rendererList->SetSelection(sel); +} + void BasicVideoData::LoadResolutionData() { window->baseResList->Clear(); @@ -243,6 +263,7 @@ BasicVideoData::BasicVideoData(OBSBasicSettings *window) { LoadResolutionData(); LoadFPSData(); + LoadOther(); /* load connectors after loading data to prevent them from triggering */ connections.Add(window->baseResList, wxEVT_TEXT, @@ -289,6 +310,17 @@ void BasicVideoData::OutputResListChanged(wxCommandEvent &event) window->videoChangedText->Show(); } +void BasicVideoData::SaveOther() +{ + int sel = window->rendererList->GetSelection(); + if (sel == wxNOT_FOUND) + return; + + wxString renderer = window->rendererList->GetString(sel); + config_set_string(GetGlobalConfig(), "Video", "Renderer", + renderer.c_str()); +} + void BasicVideoData::SaveFPSData() { int id = window->fpsTypeList->GetCurrentPage()->GetId(); @@ -302,6 +334,7 @@ void BasicVideoData::SaveFPSData() } config_set_string(GetGlobalConfig(), "Video", "FPSType", type); + SaveOther(); SaveFPSCommon(); SaveFPSInteger(); SaveFPSFraction(); -- GitLab