mirror of
https://git.neolegacy.dev/neoStudiosLCE/neoLegacy.git
synced 2026-11-19 12:04:15 +01:00
Co-authored-by: DrPerkyLegit <116128211+DrPerkyLegit@users.noreply.github.com> Co-authored-by: github-actions <github-actions@github.com> Co-authored-by: Anaël <60509176+Bakoubak@users.noreply.github.com> Reviewed-on: https://git.neolegacy.dev/neoStudiosLCE/neoLegacy/pulls/4205
208 lines
6.3 KiB
C++
208 lines
6.3 KiB
C++
#include "stdafx.h"
|
|
#include "UI.h"
|
|
#include "UIScene_SettingsPostProcessingMenu.h"
|
|
|
|
UIScene_SettingsPostProcessingMenu::UIScene_SettingsPostProcessingMenu(int iPad, void* initData, UILayer* parentLayer) : UIScene(iPad, parentLayer)
|
|
{
|
|
// Setup all the Iggy references we need for this scene
|
|
initialiseMovie();
|
|
|
|
m_bNotInGame = (Minecraft::GetInstance()->level == nullptr);
|
|
m_bNeedsMultiListPopulate = true;
|
|
m_bInitialPopulateDone = false;
|
|
m_bPendingSliderUpdate = false;
|
|
m_iPendingSliderId = 0;
|
|
m_iPendingSliderValue = 0;
|
|
|
|
doHorizontalResizeCheck();
|
|
|
|
if (app.GetLocalPlayerCount() > 1)
|
|
{
|
|
#if TO_BE_IMPLEMENTED
|
|
app.AdjustSplitscreenScene(m_hObj, &m_OriginalPosition, m_iPad);
|
|
#endif
|
|
}
|
|
}
|
|
|
|
UIScene_SettingsPostProcessingMenu::~UIScene_SettingsPostProcessingMenu()
|
|
{
|
|
}
|
|
|
|
wstring UIScene_SettingsPostProcessingMenu::getMoviePath()
|
|
{
|
|
if (app.GetLocalPlayerCount() > 1)
|
|
{
|
|
return L"MultilistMenuSplit";
|
|
}
|
|
else
|
|
{
|
|
return L"MultilistMenu";
|
|
}
|
|
}
|
|
|
|
void UIScene_SettingsPostProcessingMenu::tick()
|
|
{
|
|
if (m_bNeedsMultiListPopulate)
|
|
{
|
|
m_bNeedsMultiListPopulate = false;
|
|
m_multiList.setupControl(this, m_rootPath, "MultiList");
|
|
m_controls.push_back(&m_multiList);
|
|
m_multiList.clearList();
|
|
m_multiList.init(eControl_MultiList);
|
|
|
|
m_multiList.AddNewCheckbox(app.GetString(IDS_CHECKBOX_CUSTOM_DYNAMIC_LIGHTING), eControl_DynamicLighting_Toggle, (app.GetGameSettings(m_iPad, eGameSetting_DynamicLighting_Toggle) != 0));
|
|
|
|
WCHAR TempString[256];
|
|
|
|
{
|
|
m_multiList.AddNewCheckbox(app.GetString(IDS_CHECKBOX_CUSTOM_FXAA_TOGGLE), eControl_FXAA_Toggle, (app.GetGameSettings(m_iPad, eGameSetting_FXAA_Toggle) != 0));
|
|
|
|
int fxaaVal = app.GetGameSettings(m_iPad, eGameSetting_FXAA_Strength);
|
|
swprintf(TempString, 256, L"%ls: %d%%", app.GetString(IDS_SLIDER_CUSTOM_FXAA_STRENGTH), fxaaVal);
|
|
m_multiList.AddNewSlider(TempString, eControl_FXAA_Strength, 0, 100, 1, fxaaVal);
|
|
}
|
|
|
|
{
|
|
m_multiList.AddNewCheckbox(app.GetString(IDS_CHECKBOX_CUSTOM_MIPMAP_TOGGLE), eControl_MipMap_Toggle, (app.GetGameSettings(m_iPad, eGameSetting_MipMap_Toggle) != 0));
|
|
|
|
int strength = app.GetGameSettings(m_iPad, eGameSetting_MipMap_Strength);
|
|
swprintf(TempString, 256, L"%ls: %d", app.GetString(IDS_SLIDER_CUSTOM_MIPMAP_STRENGTH), strength);
|
|
m_multiList.AddNewSlider(TempString, eControl_MipMap_Strength, 1, 5, 1, strength);
|
|
}
|
|
|
|
IggyName funcDoVert = registerFastName(L"DoVerticalResizeCheck");
|
|
IggyName funcHideDesc = registerFastName(L"HideDescription");
|
|
IggyDataValue result;
|
|
IggyPlayerCallMethodRS(getMovie(), &result, m_rootPath, funcDoVert, 0, nullptr);
|
|
doHorizontalResizeCheck();
|
|
IggyPlayerCallMethodRS(getMovie(), &result, m_rootPath, funcHideDesc, 0, nullptr);
|
|
m_multiList.HighlightItem(eControl_MultiList + 1);
|
|
}
|
|
|
|
if (m_bPendingSliderUpdate)
|
|
{
|
|
m_bPendingSliderUpdate = false;
|
|
m_multiList.SetSliderValue(m_iPendingSliderId, m_iPendingSliderValue);
|
|
|
|
WCHAR TempString[256];
|
|
switch (m_iPendingSliderId)
|
|
{
|
|
case eControl_FXAA_Strength:
|
|
{
|
|
app.SetGameSettings(m_iPad, eGameSetting_FXAA_Strength, m_iPendingSliderValue);
|
|
swprintf(TempString, 256, L"%ls: %d", app.GetString(IDS_SLIDER_CUSTOM_FXAA_STRENGTH), m_iPendingSliderValue);
|
|
m_multiList.SetSliderLabel(eControl_FXAA_Strength, TempString);
|
|
break;
|
|
}
|
|
case eControl_MipMap_Strength:
|
|
{
|
|
app.SetGameSettings(m_iPad, eGameSetting_MipMap_Strength, m_iPendingSliderValue);
|
|
swprintf(TempString, 256, L"%ls: %d", app.GetString(IDS_SLIDER_CUSTOM_MIPMAP_STRENGTH), m_iPendingSliderValue);
|
|
m_multiList.SetSliderLabel(eControl_MipMap_Strength, TempString);
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
UIScene::tick();
|
|
m_bInitialPopulateDone = true;
|
|
}
|
|
|
|
|
|
void UIScene_SettingsPostProcessingMenu::updateTooltips()
|
|
{
|
|
ui.SetTooltips(m_iPad, IDS_TOOLTIPS_SELECT, IDS_TOOLTIPS_BACK);
|
|
}
|
|
|
|
void UIScene_SettingsPostProcessingMenu::updateComponents()
|
|
{
|
|
bool bNotInGame=(Minecraft::GetInstance()->level==nullptr);
|
|
if(bNotInGame)
|
|
{
|
|
m_parentLayer->showComponent(m_iPad,eUIComponent_Panorama,true);
|
|
m_parentLayer->showComponent(m_iPad,eUIComponent_Logo,true);
|
|
}
|
|
else
|
|
{
|
|
m_parentLayer->showComponent(m_iPad,eUIComponent_Panorama,false);
|
|
|
|
if( app.GetLocalPlayerCount() == 1 ) m_parentLayer->showComponent(m_iPad,eUIComponent_Logo,true);
|
|
else m_parentLayer->showComponent(m_iPad,eUIComponent_Logo,false);
|
|
|
|
}
|
|
}
|
|
|
|
|
|
void UIScene_SettingsPostProcessingMenu::handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool &handled)
|
|
{
|
|
ui.AnimateKeyPress(iPad, key, repeat, pressed, released);
|
|
switch(key)
|
|
{
|
|
case ACTION_MENU_CANCEL:
|
|
if(pressed) {
|
|
applyChangedSettings();
|
|
navigateBack();
|
|
}
|
|
break;
|
|
case ACTION_MENU_OK:
|
|
#ifdef __ORBIS__
|
|
case ACTION_MENU_TOUCHPAD_PRESS:
|
|
#endif
|
|
sendInputToMovie(key, repeat, pressed, released);
|
|
break;
|
|
case ACTION_MENU_UP:
|
|
case ACTION_MENU_DOWN:
|
|
case ACTION_MENU_LEFT:
|
|
case ACTION_MENU_RIGHT:
|
|
sendInputToMovie(key, repeat, pressed, released);
|
|
break;
|
|
}
|
|
}
|
|
|
|
void UIScene_SettingsPostProcessingMenu::handleSliderMove(F64 sliderId, F64 currentValue)
|
|
{
|
|
int sliderIdInt = static_cast<int>(sliderId);
|
|
int value = static_cast<int>(currentValue);
|
|
|
|
m_multiList.handleSliderMove(sliderIdInt, value);
|
|
|
|
switch (sliderIdInt)
|
|
{
|
|
case eControl_FXAA_Strength:
|
|
case eControl_MipMap_Strength:
|
|
m_bPendingSliderUpdate = true;
|
|
m_iPendingSliderId = sliderIdInt;
|
|
m_iPendingSliderValue = value;
|
|
break;
|
|
}
|
|
}
|
|
|
|
void UIScene_SettingsPostProcessingMenu::handleCheckboxToggled(F64 controlId, bool selected)
|
|
{
|
|
if (m_bInitialPopulateDone)
|
|
ui.PlayUISFX(eSFX_Press);
|
|
}
|
|
|
|
void UIScene_SettingsPostProcessingMenu::handlePress(F64 controlId, F64 childId)
|
|
{
|
|
ui.PlayUISFX(eSFX_Press);
|
|
}
|
|
|
|
void UIScene_SettingsPostProcessingMenu::applyChangedSettings()
|
|
{
|
|
app.SetGameSettings(m_iPad, eGameSetting_FXAA_Toggle, m_multiList.GetCheckboxValue(eControl_FXAA_Toggle) ? 1 : 0);
|
|
app.SetGameSettings(m_iPad, eGameSetting_FXAA_Strength, m_multiList.GetSliderValue(eControl_FXAA_Strength));
|
|
|
|
app.SetGameSettings(m_iPad, eGameSetting_MipMap_Toggle, m_multiList.GetCheckboxValue(eControl_MipMap_Toggle) ? 1 : 0);
|
|
app.SetGameSettings(m_iPad, eGameSetting_MipMap_Strength, m_multiList.GetSliderValue(eControl_MipMap_Strength));
|
|
app.SetGameSettings(m_iPad, eGameSetting_DynamicLighting_Toggle, m_multiList.GetCheckboxValue(eControl_DynamicLighting_Toggle) ? 1 : 0);
|
|
}
|
|
|
|
void UIScene_SettingsPostProcessingMenu::handleGainFocus(bool navBack)
|
|
{
|
|
if (navBack)
|
|
{
|
|
m_bNeedsMultiListPopulate = true;
|
|
m_bInitialPopulateDone = false;
|
|
}
|
|
} |