1
0
mirror of https://github.com/narzoul/DDrawCompat synced 2024-12-30 08:55:36 +01:00

Added StatsPosX and StatsPosY settings

This commit is contained in:
narzoul 2023-07-02 22:03:28 +02:00
parent 320828c4a3
commit eb79dd2ebb
8 changed files with 102 additions and 4 deletions

View File

@ -32,6 +32,8 @@
#include <Config/Settings/StatsAggregateTime.h>
#include <Config/Settings/StatsColumns.h>
#include <Config/Settings/StatsHotKey.h>
#include <Config/Settings/StatsPosX.h>
#include <Config/Settings/StatsPosY.h>
#include <Config/Settings/StatsRows.h>
#include <Config/Settings/StatsUpdateRate.h>
#include <Config/Settings/SupportedResolutions.h>
@ -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;

View File

@ -0,0 +1,39 @@
#pragma once
#pragma once
#include <Config/MappedSetting.h>
namespace Config
{
namespace Settings
{
class StatsPosX : public MappedSetting<int>
{
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;
}

View File

@ -0,0 +1,39 @@
#pragma once
#pragma once
#include <Config/MappedSetting.h>
namespace Config
{
namespace Settings
{
class StatsPosY : public MappedSetting<int>
{
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;
}

View File

@ -197,6 +197,8 @@
<ClInclude Include="Config\Settings\StatsAggregateTime.h" />
<ClInclude Include="Config\Settings\StatsColumns.h" />
<ClInclude Include="Config\Settings\StatsHotKey.h" />
<ClInclude Include="Config\Settings\StatsPosX.h" />
<ClInclude Include="Config\Settings\StatsPosY.h" />
<ClInclude Include="Config\Settings\StatsRows.h" />
<ClInclude Include="Config\Settings\StatsUpdateRate.h" />
<ClInclude Include="Config\Settings\SupportedDepthFormats.h" />

View File

@ -687,6 +687,12 @@
<ClInclude Include="Config\Settings\StatsAggregateTime.h">
<Filter>Header Files\Config\Settings</Filter>
</ClInclude>
<ClInclude Include="Config\Settings\StatsPosX.h">
<Filter>Header Files\Config\Settings</Filter>
</ClInclude>
<ClInclude Include="Config\Settings\StatsPosY.h">
<Filter>Header Files\Config\Settings</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="Gdi\Gdi.cpp">

View File

@ -18,6 +18,8 @@
#include <Config/Settings/SpriteDetection.h>
#include <Config/Settings/SpriteFilter.h>
#include <Config/Settings/SpriteTexCoord.h>
#include <Config/Settings/StatsPosX.h>
#include <Config/Settings/StatsPosY.h>
#include <Config/Settings/TextureFilter.h>
#include <Config/Settings/VSync.h>
#include <D3dDdi/Device.h>
@ -25,6 +27,7 @@
#include <Input/Input.h>
#include <Overlay/ConfigWindow.h>
#include <Overlay/SettingControl.h>
#include <Overlay/StatsWindow.h>
namespace
{
@ -38,7 +41,7 @@ namespace
const int ROW_HEIGHT = 25;
const int ROWS = 15;
std::array<SettingRow, 16> g_settingRows = { {
std::array<SettingRow, 18> 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 }
} };

View File

@ -3,6 +3,8 @@
#include <Common/Time.h>
#include <Config/Settings/StatsHotKey.h>
#include <Config/Settings/StatsPosX.h>
#include <Config/Settings/StatsPosY.h>
#include <Config/Settings/StatsRows.h>
#include <Gdi/GuiThread.h>
#include <Input/Input.h>
@ -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;
}

View File

@ -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;