diff options
| author | Igor Govorov <[email protected]> | 2018-04-11 18:28:51 +0300 |
|---|---|---|
| committer | Igor Govorov <[email protected]> | 2018-04-11 18:28:51 +0300 |
| commit | c4f5a0aff93e05b3c01de0dbdc7c05e5d9530eda (patch) | |
| tree | 165e3aa9f3a2fff99f70eae90e4a519e0de41a1b /samples/DX_APIUsage | |
| parent | Add Developer Content Portal documentation (diff) | |
| download | gfesdk-c4f5a0aff93e05b3c01de0dbdc7c05e5d9530eda.tar.xz gfesdk-c4f5a0aff93e05b3c01de0dbdc7c05e5d9530eda.zip | |
Push GeForceExperience SDK 1.1.2011.1.201
Diffstat (limited to 'samples/DX_APIUsage')
| -rw-r--r-- | samples/DX_APIUsage/DX_APIUsage.vcxproj | 8 | ||||
| -rw-r--r-- | samples/DX_APIUsage/DX_APIUsage.vcxproj.filters | 18 | ||||
| -rw-r--r-- | samples/DX_APIUsage/GfeSDKWrapper.c (renamed from samples/DX_APIUsage/GfeSDKHighlights.c) | 4 | ||||
| -rw-r--r-- | samples/DX_APIUsage/GfeSDKWrapper.cpp (renamed from samples/DX_APIUsage/GfeSDKHighlights.cpp) | 44 | ||||
| -rw-r--r-- | samples/DX_APIUsage/GfeSDKWrapper.h (renamed from samples/DX_APIUsage/GfeSDKHighlights.h) | 7 | ||||
| -rw-r--r-- | samples/DX_APIUsage/GfeSDKWrapper.hpp (renamed from samples/DX_APIUsage/GfeSDKHighlights.hpp) | 6 | ||||
| -rw-r--r-- | samples/DX_APIUsage/Main.cpp | 159 |
7 files changed, 190 insertions, 56 deletions
diff --git a/samples/DX_APIUsage/DX_APIUsage.vcxproj b/samples/DX_APIUsage/DX_APIUsage.vcxproj index cc01078..c14a4de 100644 --- a/samples/DX_APIUsage/DX_APIUsage.vcxproj +++ b/samples/DX_APIUsage/DX_APIUsage.vcxproj @@ -49,7 +49,7 @@ <ClCompile Include="DXUT\Optional\SDKmisc.cpp" /> <ClCompile Include="DXUT\Optional\SDKsound.cpp" /> <ClCompile Include="DXUT\Optional\SDKwavefile.cpp" /> - <ClCompile Include="GfeSDKHighlights.c"> + <ClCompile Include="GfeSDKWrapper.c"> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release_C|Win32'">false</ExcludedFromBuild> @@ -59,7 +59,7 @@ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> </ClCompile> - <ClCompile Include="GfeSDKHighlights.cpp"> + <ClCompile Include="GfeSDKWrapper.cpp"> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release_C|Win32'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release_C|x64'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug_C|Win32'">true</ExcludedFromBuild> @@ -88,8 +88,8 @@ <ClInclude Include="DXUT\Optional\SDKmisc.h" /> <ClInclude Include="DXUT\Optional\SDKsound.h" /> <ClInclude Include="DXUT\Optional\SDKwavefile.h" /> - <ClInclude Include="GfeSDKHighlights.h" /> - <ClInclude Include="GfeSDKHighlights.hpp" /> + <ClInclude Include="GfeSDKWrapper.h" /> + <ClInclude Include="GfeSDKWrapper.hpp" /> <ClInclude Include="jsoncpp\json\json-forwards.h" /> <ClInclude Include="jsoncpp\json\json.h" /> </ItemGroup> diff --git a/samples/DX_APIUsage/DX_APIUsage.vcxproj.filters b/samples/DX_APIUsage/DX_APIUsage.vcxproj.filters index 852441a..41a4832 100644 --- a/samples/DX_APIUsage/DX_APIUsage.vcxproj.filters +++ b/samples/DX_APIUsage/DX_APIUsage.vcxproj.filters @@ -44,14 +44,14 @@ <Filter>DXUT\Optional</Filter> </ClCompile> <ClCompile Include="Main.cpp" /> - <ClCompile Include="GfeSDKHighlights.cpp"> - <Filter>Highlights</Filter> + <ClCompile Include="GfeSDKWrapper.cpp"> + <Filter>GfeSDKWrapper</Filter> </ClCompile> <ClCompile Include="jsoncpp\jsoncpp.cpp"> <Filter>jsoncpp</Filter> </ClCompile> - <ClCompile Include="GfeSDKHighlights.c"> - <Filter>Highlights</Filter> + <ClCompile Include="GfeSDKWrapper.c"> + <Filter>GfeSDKWrapper</Filter> </ClCompile> </ItemGroup> <ItemGroup> @@ -64,7 +64,7 @@ <Filter Include="DXUT\Optional"> <UniqueIdentifier>{e6c31087-9bca-4c1f-9cf1-578a4d193ded}</UniqueIdentifier> </Filter> - <Filter Include="Highlights"> + <Filter Include="GfeSDKWrapper"> <UniqueIdentifier>{326dccc8-f9e7-498f-aba9-a6c7698130c3}</UniqueIdentifier> </Filter> <Filter Include="Resources"> @@ -129,8 +129,8 @@ <ClInclude Include="DXUT\Optional\SDKwavefile.h"> <Filter>DXUT\Optional</Filter> </ClInclude> - <ClInclude Include="GfeSDKHighlights.h"> - <Filter>Highlights</Filter> + <ClInclude Include="GfeSDKWrapper.h"> + <Filter>GfeSDKWrapper</Filter> </ClInclude> <ClInclude Include="jsoncpp\json\json.h"> <Filter>jsoncpp</Filter> @@ -138,8 +138,8 @@ <ClInclude Include="jsoncpp\json\json-forwards.h"> <Filter>jsoncpp</Filter> </ClInclude> - <ClInclude Include="GfeSDKHighlights.hpp"> - <Filter>Highlights</Filter> + <ClInclude Include="GfeSDKWrapper.hpp"> + <Filter>GfeSDKWrapper</Filter> </ClInclude> </ItemGroup> <ItemGroup> diff --git a/samples/DX_APIUsage/GfeSDKHighlights.c b/samples/DX_APIUsage/GfeSDKWrapper.c index 9ffc36d..809d64b 100644 --- a/samples/DX_APIUsage/GfeSDKHighlights.c +++ b/samples/DX_APIUsage/GfeSDKWrapper.c @@ -13,7 +13,7 @@ #include <Windows.h> -#include "GfeSDKHighlights.h" +#include "GfeSDKWrapper.h" #include <gfesdk/sdk_types.h> #include <gfesdk/isdk.h> @@ -345,7 +345,7 @@ wchar_t const* GetLastQueryResult() return g_lastQueryResult; } -void InitHighlightsWrapper(HighlightsWrapper* hl) +void InitGfeSdkWrapper(GfeSdkWrapper* hl) { hl->Init = &Init; hl->DeInit = &DeInit; diff --git a/samples/DX_APIUsage/GfeSDKHighlights.cpp b/samples/DX_APIUsage/GfeSDKWrapper.cpp index 0839c6a..33a4a63 100644 --- a/samples/DX_APIUsage/GfeSDKHighlights.cpp +++ b/samples/DX_APIUsage/GfeSDKWrapper.cpp @@ -13,7 +13,7 @@ #include <Windows.h> -#include "GfeSDKHighlights.hpp" +#include "GfeSDKWrapper.hpp" #include <json/json.h> @@ -42,12 +42,12 @@ static std::wstring permissionToStringW(GfeSDK::NVGSDK_Permission p) } } -HighlightsWrapper::HighlightsWrapper() : +GfeSdkWrapper::GfeSdkWrapper() : m_currentPermission(permissionToStringW(GfeSDK::NVGSDK_PERMISSION_MUST_ASK)) { } -void HighlightsWrapper::Init(char const* gameName, char const* defaultLocale, GfeSDK::NVGSDK_Highlight* highlights, size_t numHighlights) +void GfeSdkWrapper::Init(char const* gameName, char const* defaultLocale, GfeSDK::NVGSDK_Highlight* highlights, size_t numHighlights) { using namespace std::placeholders; @@ -60,7 +60,7 @@ void HighlightsWrapper::Init(char const* gameName, char const* defaultLocale, Gf GfeSDK::NVGSDK_SCOPE_HIGHLIGHTS_VIDEO, GfeSDK::NVGSDK_SCOPE_HIGHLIGHTS_SCREENSHOT }; - createParams.notificationCallback = std::bind(&HighlightsWrapper::OnNotification, this, _1, _2); + createParams.notificationCallback = std::bind(&GfeSdkWrapper::OnNotification, this, _1, _2); GfeSDK::CreateResponse response; GfeSDK::Core* gfesdkCore = GfeSDK::Core::Create(createParams, response); @@ -142,7 +142,7 @@ void HighlightsWrapper::Init(char const* gameName, char const* defaultLocale, Gf //! [Permissions CPP] } -void HighlightsWrapper::DeInit() +void GfeSdkWrapper::DeInit() { // Releasing from smart pointer just to document how to delete handle GfeSDK::Core* gfesdkCore = m_gfesdk.release(); @@ -152,7 +152,7 @@ void HighlightsWrapper::DeInit() //! [Release CPP] } -void HighlightsWrapper::OnTick(void) +void GfeSdkWrapper::OnTick(void) { if (!m_gfesdk) return; @@ -162,7 +162,7 @@ void HighlightsWrapper::OnTick(void) m_gfesdk->Poll(); } -void HighlightsWrapper::OnNotification(GfeSDK::NVGSDK_NotificationType type, GfeSDK::NotificationBase const& notification) +void GfeSdkWrapper::OnNotification(GfeSDK::NVGSDK_NotificationType type, GfeSDK::NotificationBase const& notification) { switch (type) { @@ -196,7 +196,7 @@ void HighlightsWrapper::OnNotification(GfeSDK::NVGSDK_NotificationType type, Gfe } } -void HighlightsWrapper::OnOpenGroup(std::string const& id) +void GfeSdkWrapper::OnOpenGroup(std::string const& id) { if (!m_highlights) return; @@ -210,7 +210,7 @@ void HighlightsWrapper::OnOpenGroup(std::string const& id) //! [OpenGroup CPP] } -void HighlightsWrapper::OnCloseGroup(std::string const& id, bool destroy) +void GfeSdkWrapper::OnCloseGroup(std::string const& id, bool destroy) { if (!m_highlights) return; @@ -232,7 +232,7 @@ void HighlightsWrapper::OnCloseGroup(std::string const& id, bool destroy) #endif } -void HighlightsWrapper::OnSaveScreenshot(std::string const& highlightId, std::string const& groupId) +void GfeSdkWrapper::OnSaveScreenshot(std::string const& highlightId, std::string const& groupId) { GfeSDK::ScreenshotHighlightParams params; params.groupId = groupId; @@ -242,7 +242,7 @@ void HighlightsWrapper::OnSaveScreenshot(std::string const& highlightId, std::st }); } -void HighlightsWrapper::OnSaveVideo(std::string const& highlightId, std::string const& groupId, int startDelta, int endDelta) +void GfeSdkWrapper::OnSaveVideo(std::string const& highlightId, std::string const& groupId, int startDelta, int endDelta) { //! [SaveVideo CPP] GfeSDK::VideoHighlightParams params; @@ -256,7 +256,7 @@ void HighlightsWrapper::OnSaveVideo(std::string const& highlightId, std::string //! [SaveVideo CPP] } -void HighlightsWrapper::OnGetNumHighlights(std::string const& groupId, GfeSDK::NVGSDK_HighlightSignificance sigFilter, GfeSDK::NVGSDK_HighlightType tagFilter) +void GfeSdkWrapper::OnGetNumHighlights(std::string const& groupId, GfeSDK::NVGSDK_HighlightSignificance sigFilter, GfeSDK::NVGSDK_HighlightType tagFilter) { GfeSDK::GroupView v; v.groupId = groupId; @@ -272,7 +272,7 @@ void HighlightsWrapper::OnGetNumHighlights(std::string const& groupId, GfeSDK::N }); } -void HighlightsWrapper::OnOpenSummary(char const* groupIds[], size_t numGroups, GfeSDK::NVGSDK_HighlightSignificance sigFilter, GfeSDK::NVGSDK_HighlightType tagFilter) +void GfeSdkWrapper::OnOpenSummary(char const* groupIds[], size_t numGroups, GfeSDK::NVGSDK_HighlightSignificance sigFilter, GfeSDK::NVGSDK_HighlightType tagFilter) { //! [OpenSummary CPP] GfeSDK::SummaryParams params; @@ -293,14 +293,14 @@ void HighlightsWrapper::OnOpenSummary(char const* groupIds[], size_t numGroups, //! [OpenSummary CPP] } -void HighlightsWrapper::OnRequestLanguage(void) +void GfeSdkWrapper::OnRequestLanguage(void) { //! [Asynchonous Call] // We are passing two arguments to this function, the function lambda, and a user context. In this case, we're passing // the 'this' pointer as the user context. This gets passed through unmodified for use in the callback function. m_gfesdk->GetUILanguageAsync([this](GfeSDK::NVGSDK_RetCode rc, GfeSDK::GetUILanguageResponse const* response, void* context) { // Passed this pointer through as context - HighlightsWrapper* thiz = reinterpret_cast<HighlightsWrapper*>(context); + GfeSdkWrapper* thiz = reinterpret_cast<GfeSdkWrapper*>(context); UpdateLastResultString(rc); if (GfeSDK::NVGSDK_SUCCEEDED(rc)) @@ -311,7 +311,7 @@ void HighlightsWrapper::OnRequestLanguage(void) //! [Asynchonous Call] } -void HighlightsWrapper::OnRequestUserSettings(void) +void GfeSdkWrapper::OnRequestUserSettings(void) { m_highlights->GetUserSettingsAsync([this](GfeSDK::NVGSDK_RetCode rc, GfeSDK::GetUserSettingsResponse const* response, void*) { UpdateLastResultString(rc); @@ -326,27 +326,27 @@ void HighlightsWrapper::OnRequestUserSettings(void) }); } -wchar_t const* HighlightsWrapper::GetCurrentPermissionStr(void) +wchar_t const* GfeSdkWrapper::GetCurrentPermissionStr(void) { return m_currentPermission.c_str(); } -wchar_t const* HighlightsWrapper::GetLastOverlayEvent(void) +wchar_t const* GfeSdkWrapper::GetLastOverlayEvent(void) { return m_lastOverlayEvent.c_str(); } -wchar_t const* HighlightsWrapper::GetLastResult(void) +wchar_t const* GfeSdkWrapper::GetLastResult(void) { return m_lastResult.c_str(); } -wchar_t const* HighlightsWrapper::GetLastQueryResult(void) +wchar_t const* GfeSdkWrapper::GetLastQueryResult(void) { return m_lastQueryResult.c_str(); } -void HighlightsWrapper::ConfigureHighlights(char const* defaultLocale, GfeSDK::NVGSDK_Highlight* highlights, size_t numHighlights) +void GfeSdkWrapper::ConfigureHighlights(char const* defaultLocale, GfeSDK::NVGSDK_Highlight* highlights, size_t numHighlights) { //! [ConfigureHighlights CPP] // Create handle to highlights module @@ -377,7 +377,7 @@ void HighlightsWrapper::ConfigureHighlights(char const* defaultLocale, GfeSDK::N //! [ConfigureHighlights CPP] } -void HighlightsWrapper::UpdateLastResultString(GfeSDK::NVGSDK_RetCode rc) +void GfeSdkWrapper::UpdateLastResultString(GfeSDK::NVGSDK_RetCode rc) { m_lastResult = m_converter.from_bytes(GfeSDK::RetCodeToString(rc)); } diff --git a/samples/DX_APIUsage/GfeSDKHighlights.h b/samples/DX_APIUsage/GfeSDKWrapper.h index e9233ff..b6f5dfd 100644 --- a/samples/DX_APIUsage/GfeSDKHighlights.h +++ b/samples/DX_APIUsage/GfeSDKWrapper.h @@ -16,7 +16,8 @@ extern "C" { #include <gfesdk/isdk.h> #include <gfesdk/highlights/ihighlights.h> -typedef struct _HighlightsWrapper + +typedef struct _GfeSdkWrapper { void(*Init)(char const* gameName, char const* defaultLocale, NVGSDK_Highlight* highlights, size_t numHighlights); void(*DeInit)(); @@ -34,9 +35,9 @@ typedef struct _HighlightsWrapper wchar_t const* (*GetLastOverlayEvent)(); wchar_t const* (*GetLastResult)(); wchar_t const* (*GetLastQueryResult)(); -} HighlightsWrapper; +} GfeSdkWrapper; -void InitHighlightsWrapper(HighlightsWrapper* hl); +void InitGfeSdkWrapper(GfeSdkWrapper* hl); #ifdef __cplusplus } diff --git a/samples/DX_APIUsage/GfeSDKHighlights.hpp b/samples/DX_APIUsage/GfeSDKWrapper.hpp index 98b9991..c9c50f2 100644 --- a/samples/DX_APIUsage/GfeSDKHighlights.hpp +++ b/samples/DX_APIUsage/GfeSDKWrapper.hpp @@ -21,10 +21,10 @@ namespace Json class Value; } -class HighlightsWrapper +class GfeSdkWrapper { public: - HighlightsWrapper(); + GfeSdkWrapper(); void Init(char const* gameName, char const* defaultLocale, GfeSDK::NVGSDK_Highlight* highlights, size_t numHighlights); void DeInit(); @@ -58,4 +58,4 @@ private: std::wstring m_lastQueryResult; }; -inline void InitHighlightsWrapper(HighlightsWrapper* hl) {} +inline void InitGfeSdkWrapper(GfeSdkWrapper* hl) {} diff --git a/samples/DX_APIUsage/Main.cpp b/samples/DX_APIUsage/Main.cpp index 386b4db..803d799 100644 --- a/samples/DX_APIUsage/Main.cpp +++ b/samples/DX_APIUsage/Main.cpp @@ -18,14 +18,15 @@ #include <fstream> #include <codecvt> #include <locale> +#include <array> #include <json/json.h> #include <Shlwapi.h> #ifdef GFESDKDEMO_BUILD_C -#include "GfeSDKHighlights.h" +#include "GfeSDKWrapper.h" #else -#include "GfeSDKHighlights.hpp" +#include "GfeSDKWrapper.hpp" using namespace GfeSDK; #endif @@ -119,7 +120,7 @@ struct HighlightsData std::vector<NVGSDK_Highlight> highlights; }; -HighlightsWrapper g_highlights; +GfeSdkWrapper g_highlights; NVGSDK_HighlightSignificance g_sigFilter = NVGSDK_HIGHLIGHT_SIGNIFICANCE_NONE; NVGSDK_HighlightType g_tagFilter = NVGSDK_HIGHLIGHT_TYPE_NONE; std::wstring_convert<std::codecvt_utf8<wchar_t>> g_converter; @@ -127,6 +128,127 @@ HighlightsData g_highlightsConfig; char const* GROUP1_ID = "GROUP1"; char const* GROUP2_ID = "GROUP2"; + +class SettingsManager +{ +public: + + enum class BackgroundColor + { + Default, + Red, + Blue, + }; + + SettingsManager(const std::wstring& configPath) + : m_color(BackgroundColor::Default), + m_configPath(configPath) + { + LoadConfig(); + } + + std::array<float, 4> GetBackgroundColorArray() const + { + switch(m_color) + { + case BackgroundColor::Red: + return { 0.25f, 0.10f, 0.10f, 0.55f }; + case BackgroundColor::Blue: + return { 0.10f, 0.10f, 0.25f, 0.55f }; + case BackgroundColor::Default: + default: + return { 0.0f, 0.25f, 0.25f, 0.55f }; + } + } + + std::string GetBackgroundColorString() const + { + switch(m_color) + { + case BackgroundColor::Red: + return "Red"; + case BackgroundColor::Blue: + return "Blue"; + case BackgroundColor::Default: + default: + return "Default"; + } + } + + void ToggleBackgroundColor() + { + switch(m_color) + { + case BackgroundColor::Default: + m_color = BackgroundColor::Red; + break; + case BackgroundColor::Red: + m_color = BackgroundColor::Blue; + break; + case BackgroundColor::Blue: + m_color = BackgroundColor::Default; + break; + default: + m_color = BackgroundColor::Default; + } + + SaveConfig(); + } + + void SaveConfig() + { + Json::Value root; + root["Background"] = GetBackgroundColorString(); + + std::ofstream f(m_configPath); + if(!f.good()) + { + TRACE("Cannot open config file for saving!"); + return; + } + + f << root; + } + + void LoadConfig() + { + std::ifstream f(m_configPath); + if(!f.good()) + { + return; + } + + Json::Value root; + + std::string errs; + Json::CharReaderBuilder builder; + if(!Json::parseFromStream(builder, f, &root, &errs)) + { + TRACE("FAILED to read json file\n"); + return; + } + + m_color = BackgroundColorFromString(root["Background"].asString()); + } + +private: + + static BackgroundColor BackgroundColorFromString(const std::string& c) + { + if(c == "Red") return BackgroundColor::Red; + if(c == "Blue") return BackgroundColor::Blue; + if(c == "Default") return BackgroundColor::Default; + + return BackgroundColor::Default; + } + + const std::wstring m_configPath; + BackgroundColor m_color; +}; + +std::unique_ptr<SettingsManager> g_settingsManager; + + AppState g_state = AppState::Init; //-------------------------------------------------------------------------------------- @@ -202,6 +324,11 @@ void ToggleTagBit(NVGSDK_HighlightType bit) g_tagFilter = static_cast<NVGSDK_HighlightType>(g_tagFilter ^ bit); } +void HandleOpsNotification() +{ + g_settingsManager->LoadConfig(); +} + //-------------------------------------------------------------------------------------- // Initialize the app //-------------------------------------------------------------------------------------- @@ -220,23 +347,26 @@ void InitApp() g_HUD.SetCallback(OnGUIEvent); - InitHighlightsWrapper(&g_highlights); + InitGfeSdkWrapper(&g_highlights); // Find the path to the executable - char path[MAX_PATH]; - GetModuleFileNameA(NULL, path, MAX_PATH); - PathRemoveFileSpecA(path); - std::string pathStr(path); + wchar_t path[MAX_PATH] = { 0 }; + GetModuleFileNameW(NULL, path, MAX_PATH); + PathRemoveFileSpecW(path); + const std::wstring pathStr(path); + g_settingsManager.reset(new SettingsManager(pathStr + L"/settings.json")); + + // Load highlights config Json::Value jsonHighlightsConfig; { - std::ifstream inFile(pathStr + "/highlights_config.json"); + std::ifstream inFile(pathStr + L"/highlights_config.json"); if (!inFile.good()) { - inFile = std::ifstream(pathStr + "/../highlights_config.json"); + inFile = std::ifstream(pathStr + L"/../highlights_config.json"); if (!inFile.good()) { - inFile = std::ifstream(pathStr + "/../../highlights_config.json"); + inFile = std::ifstream(pathStr + L"/../../highlights_config.json"); } } @@ -281,6 +411,7 @@ void InitApp() int iY = 10; int const PAD = 26; g_HUD.AddButtonCallback([]() {DXUTToggleFullScreen(); }, L"Toggle full screen", 0, iY, 170, 23); + g_HUD.AddButtonCallback([]() { g_settingsManager->ToggleBackgroundColor(); }, L"Toggle background color", 0, iY += PAD, 170, 23); g_HUD.AddButtonCallback([]() {g_highlights.OnRequestLanguage(); }, L"Get Overlay Language", 0, iY += PAD, 170, 23); g_HUD.AddButtonCallback([]() {g_highlights.OnRequestUserSettings(); }, L"Get User Settings", 0, iY += PAD, 170, 23); @@ -407,6 +538,9 @@ void RenderText() g_pTxtHelper->DrawTextLine( DXUTGetFrameStats( DXUTIsVsyncEnabled() ) ); g_pTxtHelper->DrawTextLine( DXUTGetDeviceStats() ); + // Settings + g_pTxtHelper->DrawFormattedTextLine(L"Background color: %S", g_settingsManager->GetBackgroundColorString().c_str()); + // Draw help if( g_bShowHelp ) { @@ -724,9 +858,8 @@ void CALLBACK OnD3D11FrameRender( ID3D11Device* pd3dDevice, ID3D11DeviceContext* case AppState::Main: { // Clear the render target and depth stencil - float ClearColor[4] = { 0.0f, 0.25f, 0.25f, 0.55f }; ID3D11RenderTargetView* pRTV = DXUTGetD3D11RenderTargetView(); - pd3dImmediateContext->ClearRenderTargetView(pRTV, ClearColor); + pd3dImmediateContext->ClearRenderTargetView(pRTV, g_settingsManager->GetBackgroundColorArray().data()); ID3D11DepthStencilView* pDSV = DXUTGetD3D11DepthStencilView(); pd3dImmediateContext->ClearDepthStencilView(pDSV, D3D11_CLEAR_DEPTH, 1.0, 0); |