Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 45 additions & 40 deletions Client/core/CSettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -237,23 +237,21 @@ void CSettings::ResetGuiPointers()
m_pBrightness = NULL;
m_pBrightnessValueLabel = NULL;
m_pBorderlessGammaToggle = NULL;
m_pBorderlessGammaLabel = NULL;
m_pBorderlessGamma = NULL;
m_pBorderlessGammaValueLabel = NULL;
m_pBorderlessBrightnessToggle = NULL;
m_pBorderlessBrightnessLabel = NULL;
m_pBorderlessBrightness = NULL;
m_pBorderlessBrightnessValueLabel = NULL;
m_pBorderlessContrastToggle = NULL;
m_pBorderlessContrastLabel = NULL;
m_pBorderlessContrast = NULL;
m_pBorderlessContrastValueLabel = NULL;
m_pBorderlessSaturationToggle = NULL;
m_pBorderlessSaturationLabel = NULL;
m_pBorderlessSaturation = NULL;
m_pBorderlessSaturationValueLabel = NULL;
m_pCheckBoxApplyBorderless = NULL;
m_pCheckBoxApplyFullscreen = NULL;
m_pPostFXDefButton = NULL;

m_pAnisotropicLabel = NULL;
m_pAnisotropic = NULL;
m_pAnisotropicValueLabel = NULL;
Expand Down Expand Up @@ -1435,34 +1433,26 @@ void CSettings::CreateGUI()
const float postFxSliderWidth = ComputeSliderWidth(tabPanelSize.fX, postFxSliderColumnX, 220.0f, postFxValueColumnReserve);
const float postFxValueColumnX = postFxSliderColumnX + postFxSliderWidth + postFxValueColumnPadding;

m_pBorderlessGammaToggle = reinterpret_cast<CGUICheckBox*>(pManager->CreateCheckBox(m_pTabPostFX, ""));
m_pBorderlessGammaToggle = reinterpret_cast<CGUICheckBox*>(pManager->CreateCheckBox(m_pTabPostFX, _("Gamma:")));
m_pBorderlessGammaToggle->SetPosition(CVector2D(postFxCheckboxColumnX, postFxPos.fY));
m_pBorderlessGammaToggle->AutoSize(nullptr, 20.0f);

m_pBorderlessGammaLabel = reinterpret_cast<CGUILabel*>(pManager->CreateLabel(m_pTabPostFX, _("Gamma:")));
m_pBorderlessGammaLabel->SetPosition(CVector2D(postFxLabelColumnX, postFxPos.fY + 2.0f));
m_pBorderlessGammaLabel->AutoSize();

m_pBorderlessGamma = reinterpret_cast<CGUIScrollBar*>(pManager->CreateScrollBar(true, m_pTabPostFX));
m_pBorderlessGamma->SetPosition(CVector2D(postFxSliderColumnX, postFxPos.fY));
m_pBorderlessGamma->SetSize(CVector2D(postFxSliderWidth, 20.0f));
m_pBorderlessGamma->SetProperty("StepSize", "0.01");

m_pBorderlessGammaValueLabel = reinterpret_cast<CGUILabel*>(pManager->CreateLabel(m_pTabPostFX, ""));
m_pBorderlessGammaValueLabel->SetPosition(CVector2D(postFxValueColumnX, postFxPos.fY + 2.0f));
m_pBorderlessGammaValueLabel->AutoSize("2.00");
FinalizeSliderRow(tabPanelSize.fX, m_pBorderlessGamma, m_pBorderlessGammaValueLabel, 220.0f, kSliderLabelSpacing, m_pBorderlessGammaLabel);
m_pBorderlessGammaValueLabel->AutoSize("2.00x");
FinalizeSliderRow(tabPanelSize.fX, m_pBorderlessGamma, m_pBorderlessGammaValueLabel, 220.0f, kSliderLabelSpacing);

postFxPos.fY += postFxRowHeight;

m_pBorderlessBrightnessToggle = reinterpret_cast<CGUICheckBox*>(pManager->CreateCheckBox(m_pTabPostFX, ""));
m_pBorderlessBrightnessToggle = reinterpret_cast<CGUICheckBox*>(pManager->CreateCheckBox(m_pTabPostFX, _("Brightness:")));
m_pBorderlessBrightnessToggle->SetPosition(CVector2D(postFxCheckboxColumnX, postFxPos.fY));
m_pBorderlessBrightnessToggle->AutoSize(nullptr, 20.0f);

m_pBorderlessBrightnessLabel = reinterpret_cast<CGUILabel*>(pManager->CreateLabel(m_pTabPostFX, _("Brightness:")));
m_pBorderlessBrightnessLabel->SetPosition(CVector2D(postFxLabelColumnX, postFxPos.fY + 2.0f));
m_pBorderlessBrightnessLabel->AutoSize();

m_pBorderlessBrightness = reinterpret_cast<CGUIScrollBar*>(pManager->CreateScrollBar(true, m_pTabPostFX));
m_pBorderlessBrightness->SetPosition(CVector2D(postFxSliderColumnX, postFxPos.fY));
m_pBorderlessBrightness->SetSize(CVector2D(postFxSliderWidth, 20.0f));
Expand All @@ -1471,18 +1461,14 @@ void CSettings::CreateGUI()
m_pBorderlessBrightnessValueLabel = reinterpret_cast<CGUILabel*>(pManager->CreateLabel(m_pTabPostFX, ""));
m_pBorderlessBrightnessValueLabel->SetPosition(CVector2D(postFxValueColumnX, postFxPos.fY + 2.0f));
m_pBorderlessBrightnessValueLabel->AutoSize("2.00x");
FinalizeSliderRow(tabPanelSize.fX, m_pBorderlessBrightness, m_pBorderlessBrightnessValueLabel, 220.0f, kSliderLabelSpacing, m_pBorderlessBrightnessLabel);
FinalizeSliderRow(tabPanelSize.fX, m_pBorderlessBrightness, m_pBorderlessBrightnessValueLabel, 220.0f, kSliderLabelSpacing);

postFxPos.fY += postFxRowHeight;

m_pBorderlessContrastToggle = reinterpret_cast<CGUICheckBox*>(pManager->CreateCheckBox(m_pTabPostFX, ""));
m_pBorderlessContrastToggle = reinterpret_cast<CGUICheckBox*>(pManager->CreateCheckBox(m_pTabPostFX, _("Contrast:")));
m_pBorderlessContrastToggle->SetPosition(CVector2D(postFxCheckboxColumnX, postFxPos.fY));
m_pBorderlessContrastToggle->AutoSize(nullptr, 20.0f);

m_pBorderlessContrastLabel = reinterpret_cast<CGUILabel*>(pManager->CreateLabel(m_pTabPostFX, _("Contrast:")));
m_pBorderlessContrastLabel->SetPosition(CVector2D(postFxLabelColumnX, postFxPos.fY + 2.0f));
m_pBorderlessContrastLabel->AutoSize();

m_pBorderlessContrast = reinterpret_cast<CGUIScrollBar*>(pManager->CreateScrollBar(true, m_pTabPostFX));
m_pBorderlessContrast->SetPosition(CVector2D(postFxSliderColumnX, postFxPos.fY));
m_pBorderlessContrast->SetSize(CVector2D(postFxSliderWidth, 20.0f));
Expand All @@ -1491,18 +1477,14 @@ void CSettings::CreateGUI()
m_pBorderlessContrastValueLabel = reinterpret_cast<CGUILabel*>(pManager->CreateLabel(m_pTabPostFX, ""));
m_pBorderlessContrastValueLabel->SetPosition(CVector2D(postFxValueColumnX, postFxPos.fY + 2.0f));
m_pBorderlessContrastValueLabel->AutoSize("2.00x");
FinalizeSliderRow(tabPanelSize.fX, m_pBorderlessContrast, m_pBorderlessContrastValueLabel, 220.0f, kSliderLabelSpacing, m_pBorderlessContrastLabel);
FinalizeSliderRow(tabPanelSize.fX, m_pBorderlessContrast, m_pBorderlessContrastValueLabel, 220.0f, kSliderLabelSpacing);

postFxPos.fY += postFxRowHeight;

m_pBorderlessSaturationToggle = reinterpret_cast<CGUICheckBox*>(pManager->CreateCheckBox(m_pTabPostFX, ""));
m_pBorderlessSaturationToggle = reinterpret_cast<CGUICheckBox*>(pManager->CreateCheckBox(m_pTabPostFX, _("Saturation:")));
m_pBorderlessSaturationToggle->SetPosition(CVector2D(postFxCheckboxColumnX, postFxPos.fY));
m_pBorderlessSaturationToggle->AutoSize(nullptr, 20.0f);

m_pBorderlessSaturationLabel = reinterpret_cast<CGUILabel*>(pManager->CreateLabel(m_pTabPostFX, _("Saturation:")));
m_pBorderlessSaturationLabel->SetPosition(CVector2D(postFxLabelColumnX, postFxPos.fY + 2.0f));
m_pBorderlessSaturationLabel->AutoSize();

m_pBorderlessSaturation = reinterpret_cast<CGUIScrollBar*>(pManager->CreateScrollBar(true, m_pTabPostFX));
m_pBorderlessSaturation->SetPosition(CVector2D(postFxSliderColumnX, postFxPos.fY));
m_pBorderlessSaturation->SetSize(CVector2D(postFxSliderWidth, 20.0f));
Expand All @@ -1511,11 +1493,11 @@ void CSettings::CreateGUI()
m_pBorderlessSaturationValueLabel = reinterpret_cast<CGUILabel*>(pManager->CreateLabel(m_pTabPostFX, ""));
m_pBorderlessSaturationValueLabel->SetPosition(CVector2D(postFxValueColumnX, postFxPos.fY + 2.0f));
m_pBorderlessSaturationValueLabel->AutoSize("2.00x");
FinalizeSliderRow(tabPanelSize.fX, m_pBorderlessSaturation, m_pBorderlessSaturationValueLabel, 220.0f, kSliderLabelSpacing, m_pBorderlessSaturationLabel);
FinalizeSliderRow(tabPanelSize.fX, m_pBorderlessSaturation, m_pBorderlessSaturationValueLabel, 220.0f, kSliderLabelSpacing);

postFxPos.fY += postFxRowHeight + 8.0f;

m_pCheckBoxApplyBorderless = reinterpret_cast<CGUICheckBox*>(pManager->CreateCheckBox(m_pTabPostFX, _("Apply adjustments in windowed mode")));
m_pCheckBoxApplyBorderless = reinterpret_cast<CGUICheckBox*>(pManager->CreateCheckBox(m_pTabPostFX, _("Apply adjustments in windowed/borderless mode")));
m_pCheckBoxApplyBorderless->SetPosition(CVector2D(postFxCheckboxColumnX, postFxPos.fY));
m_pCheckBoxApplyBorderless->AutoSize(nullptr, 20.0f);

Expand All @@ -1525,6 +1507,13 @@ void CSettings::CreateGUI()
m_pCheckBoxApplyFullscreen->SetPosition(CVector2D(postFxCheckboxColumnX, postFxPos.fY));
m_pCheckBoxApplyFullscreen->AutoSize(nullptr, 20.0f);

m_pPostFXDefButton = reinterpret_cast<CGUIButton*>(pManager->CreateButton(m_pTabPostFX, _("Load defaults")));
m_pPostFXDefButton->SetClickHandler(GUI_CALLBACK(&CSettings::OnPostFXDefaultClick, this));
m_pPostFXDefButton->AutoSize(NULL, 20.0f, 8.0f);
m_pPostFXDefButton->GetSize(vecSize);
placeBottomRightButton(m_pPostFXDefButton);
m_pPostFXDefButton->SetZOrderingEnabled(false);

/**
* Interface/chat Tab
**/
Expand Down Expand Up @@ -2539,7 +2528,7 @@ void CSettings::UpdatePostFxTab()
if (m_pBorderlessGamma)
m_pBorderlessGamma->SetScrollPosition(NormalizeSliderValue(gammaValue, kBorderlessGammaMin, kBorderlessGammaMax));
if (m_pBorderlessGammaValueLabel)
m_pBorderlessGammaValueLabel->SetText(SString("%.2f", gammaValue).c_str());
m_pBorderlessGammaValueLabel->SetText(SString("%.2fx", gammaValue).c_str());

if (m_pBorderlessBrightness)
m_pBorderlessBrightness->SetScrollPosition(NormalizeSliderValue(brightnessValue, kBorderlessBrightnessMin, kBorderlessBrightnessMax));
Expand Down Expand Up @@ -2737,31 +2726,28 @@ void CSettings::UpdateBorderlessAdjustmentControls()

if (m_pBorderlessGamma)
m_pBorderlessGamma->SetEnabled(gammaEnabled);
if (m_pBorderlessGammaLabel)
m_pBorderlessGammaLabel->SetEnabled(gammaEnabled);
if (m_pBorderlessGammaValueLabel)
m_pBorderlessGammaValueLabel->SetEnabled(gammaEnabled);

if (m_pBorderlessBrightness)
m_pBorderlessBrightness->SetEnabled(brightnessEnabled);
if (m_pBorderlessBrightnessLabel)
m_pBorderlessBrightnessLabel->SetEnabled(brightnessEnabled);
if (m_pBorderlessBrightnessValueLabel)
m_pBorderlessBrightnessValueLabel->SetEnabled(brightnessEnabled);

if (m_pBorderlessContrast)
m_pBorderlessContrast->SetEnabled(contrastEnabled);
if (m_pBorderlessContrastLabel)
m_pBorderlessContrastLabel->SetEnabled(contrastEnabled);
if (m_pBorderlessContrastValueLabel)
m_pBorderlessContrastValueLabel->SetEnabled(contrastEnabled);

if (m_pBorderlessSaturation)
m_pBorderlessSaturation->SetEnabled(saturationEnabled);
if (m_pBorderlessSaturationLabel)
m_pBorderlessSaturationLabel->SetEnabled(saturationEnabled);
if (m_pBorderlessSaturationValueLabel)
m_pBorderlessSaturationValueLabel->SetEnabled(saturationEnabled);

m_pBorderlessGammaToggle->SetEnabled(applyAdjustments);
m_pBorderlessBrightnessToggle->SetEnabled(applyAdjustments);
m_pBorderlessContrastToggle->SetEnabled(applyAdjustments);
m_pBorderlessSaturationToggle->SetEnabled(applyAdjustments);
}

void CSettings::ResetGTAVolume()
Expand Down Expand Up @@ -5283,7 +5269,7 @@ bool CSettings::OnBrightnessChanged(CGUIElement* pElement)
bool CSettings::OnBorderlessGammaChanged(CGUIElement* pElement)
{
const float gammaValue = DenormalizeSliderValue(m_pBorderlessGamma->GetScrollPosition(), kBorderlessGammaMin, kBorderlessGammaMax);
m_pBorderlessGammaValueLabel->SetText(SString("%.2f", gammaValue).c_str());
m_pBorderlessGammaValueLabel->SetText(SString("%.2fx", gammaValue).c_str());
CVARS_SET("borderless_gamma_power", gammaValue);
RefreshBorderlessDisplayCalibration();
return true;
Expand Down Expand Up @@ -5372,6 +5358,25 @@ bool CSettings::OnBorderlessApplyFullscreenClicked(CGUIElement* pElement)
return true;
}

bool CSettings::OnPostFXDefaultClick(CGUIElement* pElement)
{
CVARS_SET("borderless_gamma_power", 1.0f);
CVARS_SET("borderless_brightness_scale", 1.0f);
CVARS_SET("borderless_contrast_scale", 1.0f);
CVARS_SET("borderless_saturation_scale", 1.0f);

CVARS_SET("borderless_gamma_enabled", false);
CVARS_SET("borderless_brightness_enabled", false);
CVARS_SET("borderless_contrast_enabled", false);
CVARS_SET("borderless_saturation_enabled", false);

CVARS_SET("borderless_apply_windowed", false);
CVARS_SET("borderless_apply_fullscreen", false);

UpdatePostFxTab();
return true;
}

bool CSettings::OnAnisotropicChanged(CGUIElement* pElement)
{
int iAnisotropic = std::min<int>(m_iMaxAnisotropic, (m_pAnisotropic->GetScrollPosition()) * (m_iMaxAnisotropic + 1));
Expand Down
6 changes: 2 additions & 4 deletions Client/core/CSettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -186,23 +186,20 @@ class CSettings
CGUIScrollBar* m_pBrightness;
CGUILabel* m_pBrightnessValueLabel;
CGUICheckBox* m_pBorderlessGammaToggle;
CGUILabel* m_pBorderlessGammaLabel;
CGUIScrollBar* m_pBorderlessGamma;
CGUILabel* m_pBorderlessGammaValueLabel;
CGUICheckBox* m_pBorderlessBrightnessToggle;
CGUILabel* m_pBorderlessBrightnessLabel;
CGUIScrollBar* m_pBorderlessBrightness;
CGUILabel* m_pBorderlessBrightnessValueLabel;
CGUICheckBox* m_pBorderlessContrastToggle;
CGUILabel* m_pBorderlessContrastLabel;
CGUIScrollBar* m_pBorderlessContrast;
CGUILabel* m_pBorderlessContrastValueLabel;
CGUICheckBox* m_pBorderlessSaturationToggle;
CGUILabel* m_pBorderlessSaturationLabel;
CGUIScrollBar* m_pBorderlessSaturation;
CGUILabel* m_pBorderlessSaturationValueLabel;
CGUICheckBox* m_pCheckBoxApplyBorderless;
CGUICheckBox* m_pCheckBoxApplyFullscreen;
CGUIButton* m_pPostFXDefButton;
CGUILabel* m_pAnisotropicLabel;
CGUIScrollBar* m_pAnisotropic;
CGUILabel* m_pAnisotropicValueLabel;
Expand Down Expand Up @@ -401,6 +398,7 @@ class CSettings
bool OnBorderlessSaturationToggleClicked(CGUIElement* pElement);
bool OnBorderlessApplyBorderlessClicked(CGUIElement* pElement);
bool OnBorderlessApplyFullscreenClicked(CGUIElement* pElement);
bool OnPostFXDefaultClick(CGUIElement* pElement);
bool OnAnisotropicChanged(CGUIElement* pElement);
bool OnMapAlphaChanged(CGUIElement* pElement);
bool OnMasterVolumeChanged(CGUIElement* pElement);
Expand Down
Loading