diff --git a/DDrawCompat/Config/Config.cpp b/DDrawCompat/Config/Config.cpp index 007fbcb..115d9f7 100644 --- a/DDrawCompat/Config/Config.cpp +++ b/DDrawCompat/Config/Config.cpp @@ -32,6 +32,8 @@ #include #include #include +#include +#include #include #include #include @@ -80,6 +82,8 @@ namespace Config Settings::StatsAggregateTime statsAggregateTime; Settings::StatsColumns statsColumns; Settings::StatsHotKey statsHotKey; + Settings::StatsPosX statsPosX; + Settings::StatsPosY statsPosY; Settings::StatsRows statsRows; Settings::StatsUpdateRate statsUpdateRate; Settings::SupportedResolutions supportedResolutions; diff --git a/DDrawCompat/Config/Settings/StatsPosX.h b/DDrawCompat/Config/Settings/StatsPosX.h new file mode 100644 index 0000000..68041f0 --- /dev/null +++ b/DDrawCompat/Config/Settings/StatsPosX.h @@ -0,0 +1,39 @@ +#pragma once + +#pragma once + +#include + +namespace Config +{ + namespace Settings + { + class StatsPosX : public MappedSetting + { + public: + static const int CUSTOM = -1; + + StatsPosX() + : MappedSetting("StatsPosX", "right", { + {"left", 0}, + {"center", 50}, + {"right", 100}, + {"custom", CUSTOM} + }) + { + } + + int get() const + { + return CUSTOM == m_value ? m_param : m_value; + } + + virtual ParamInfo getParamInfo() const override + { + return CUSTOM == m_value ? ParamInfo{ "Position", 0, 100, 100 } : ParamInfo{}; + } + }; + } + + extern Settings::StatsPosX statsPosX; +} diff --git a/DDrawCompat/Config/Settings/StatsPosY.h b/DDrawCompat/Config/Settings/StatsPosY.h new file mode 100644 index 0000000..c69320c --- /dev/null +++ b/DDrawCompat/Config/Settings/StatsPosY.h @@ -0,0 +1,39 @@ +#pragma once + +#pragma once + +#include + +namespace Config +{ + namespace Settings + { + class StatsPosY : public MappedSetting + { + public: + static const int CUSTOM = -1; + + StatsPosY() + : MappedSetting("StatsPosY", "top", { + {"top", 0}, + {"center", 50}, + {"bottom", 100}, + {"custom", CUSTOM} + }) + { + } + + int get() const + { + return CUSTOM == m_value ? m_param : m_value; + } + + virtual ParamInfo getParamInfo() const override + { + return CUSTOM == m_value ? ParamInfo{ "Position", 0, 100, 0 } : ParamInfo{}; + } + }; + } + + extern Settings::StatsPosY statsPosY; +} diff --git a/DDrawCompat/DDrawCompat.vcxproj b/DDrawCompat/DDrawCompat.vcxproj index 2c94fcd..e36cf41 100644 --- a/DDrawCompat/DDrawCompat.vcxproj +++ b/DDrawCompat/DDrawCompat.vcxproj @@ -197,6 +197,8 @@ + + diff --git a/DDrawCompat/DDrawCompat.vcxproj.filters b/DDrawCompat/DDrawCompat.vcxproj.filters index 841fa3b..564efea 100644 --- a/DDrawCompat/DDrawCompat.vcxproj.filters +++ b/DDrawCompat/DDrawCompat.vcxproj.filters @@ -687,6 +687,12 @@ Header Files\Config\Settings + + Header Files\Config\Settings + + + Header Files\Config\Settings + diff --git a/DDrawCompat/Overlay/ConfigWindow.cpp b/DDrawCompat/Overlay/ConfigWindow.cpp index 19c8b7f..06d06c9 100644 --- a/DDrawCompat/Overlay/ConfigWindow.cpp +++ b/DDrawCompat/Overlay/ConfigWindow.cpp @@ -18,6 +18,8 @@ #include #include #include +#include +#include #include #include #include @@ -25,6 +27,7 @@ #include #include #include +#include namespace { @@ -38,7 +41,7 @@ namespace const int ROW_HEIGHT = 25; const int ROWS = 15; - std::array g_settingRows = { { + std::array g_settingRows = { { { &Config::alternatePixelCenter }, { &Config::antialiasing, &D3dDdi::Device::updateAllConfig }, { &Config::bltFilter }, @@ -53,6 +56,8 @@ namespace { &Config::spriteDetection }, { &Config::spriteFilter, &D3dDdi::Device::updateAllConfig }, { &Config::spriteTexCoord, &D3dDdi::Device::updateAllConfig }, + { &Config::statsPosX, []() { Gdi::GuiThread::getStatsWindow()->updatePos(); } }, + { &Config::statsPosY, []() { Gdi::GuiThread::getStatsWindow()->updatePos(); } }, { &Config::textureFilter, &D3dDdi::Device::updateAllConfig }, { &Config::vSync } } }; diff --git a/DDrawCompat/Overlay/StatsWindow.cpp b/DDrawCompat/Overlay/StatsWindow.cpp index e128a82..5d1ed0f 100644 --- a/DDrawCompat/Overlay/StatsWindow.cpp +++ b/DDrawCompat/Overlay/StatsWindow.cpp @@ -3,6 +3,8 @@ #include #include +#include +#include #include #include #include @@ -111,7 +113,9 @@ namespace Overlay RECT StatsWindow::calculateRect(const RECT& monitorRect) const { RECT r = { 0, 0, m_rect.right - m_rect.left, m_rect.bottom - m_rect.top }; - OffsetRect(&r, monitorRect.left + monitorRect.right - r.right, monitorRect.top); + OffsetRect(&r, + monitorRect.left + Config::statsPosX.get() * (monitorRect.right - monitorRect.left - r.right) / 100, + monitorRect.top + Config::statsPosY.get() * (monitorRect.bottom - monitorRect.top - r.bottom) / 100); return r; } diff --git a/DDrawCompat/Overlay/Window.h b/DDrawCompat/Overlay/Window.h index cc0ae43..a04524e 100644 --- a/DDrawCompat/Overlay/Window.h +++ b/DDrawCompat/Overlay/Window.h @@ -24,6 +24,7 @@ namespace Overlay HWND getWindow() const { return m_hwnd; } void setTransparency(int transparency); void update(); + void updatePos(); protected: HWND m_hwnd; @@ -32,8 +33,6 @@ namespace Overlay virtual HWND getTopmost() const; - void updatePos(); - private: virtual void draw(HDC dc) override;