diff options
| author | MijaeLio <87155057+MijaeLio@users.noreply.github.com> | 2026-03-06 20:14:06 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-03-06 19:14:06 -0600 |
| commit | 16446265d555d21f564b5989611a05918728d643 (patch) | |
| tree | ad4ed8918f0090cf64bda4ac604d883a23ab1b48 /Minecraft.Client/Common/UI | |
| parent | 216943716b8797fa1b9014f337b8ce7bbe50af4d (diff) | |
Add Render Distance option. (#675)
* FOV option without debug menu
Now located in Graphics section.
Based on the FOV thing from discord idk
* language
* render distance option for graphics menu
* oop
* swf files on media
* revert changes on language selector
* nvm it was actually easy to fix
* forgot this
* Final probably
Fixed visual bug and made the chunk updates depend to your view distance.
Diffstat (limited to 'Minecraft.Client/Common/UI')
3 files changed, 47 insertions, 2 deletions
diff --git a/Minecraft.Client/Common/UI/UIScene_LanguageSelector.cpp b/Minecraft.Client/Common/UI/UIScene_LanguageSelector.cpp index e9dc7eb9..07039135 100644 --- a/Minecraft.Client/Common/UI/UIScene_LanguageSelector.cpp +++ b/Minecraft.Client/Common/UI/UIScene_LanguageSelector.cpp @@ -126,4 +126,4 @@ void UIScene_LanguageSelector::handlePress(F64 controlId, F64 childId) app.CheckGameSettingsChanged(true, m_iPad); } -} +}
\ No newline at end of file diff --git a/Minecraft.Client/Common/UI/UIScene_SettingsGraphicsMenu.cpp b/Minecraft.Client/Common/UI/UIScene_SettingsGraphicsMenu.cpp index eb489f8c..423c8f4b 100644 --- a/Minecraft.Client/Common/UI/UIScene_SettingsGraphicsMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_SettingsGraphicsMenu.cpp @@ -2,6 +2,7 @@ #include "UI.h" #include "UIScene_SettingsGraphicsMenu.h" #include "..\..\Minecraft.h" +#include "..\..\Options.h" #include "..\..\GameRenderer.h" namespace @@ -31,6 +32,24 @@ namespace } } +int UIScene_SettingsGraphicsMenu::LevelToDistance(int level) +{ + static const int table[6] = {2,4,8,16,32,64}; + if(level < 0) level = 0; + if(level > 5) level = 5; + return table[level]; +} + +int UIScene_SettingsGraphicsMenu::DistanceToLevel(int dist) +{ + static const int table[6] = {2,4,8,16,32,64}; + for(int i = 0; i < 6; i++){ + if(table[i] == dist) + return i; + } + return 3; +} + UIScene_SettingsGraphicsMenu::UIScene_SettingsGraphicsMenu(int iPad, void *initData, UILayer *parentLayer) : UIScene(iPad, parentLayer) { // Setup all the Iggy references we need for this scene @@ -45,6 +64,9 @@ UIScene_SettingsGraphicsMenu::UIScene_SettingsGraphicsMenu(int iPad, void *initD WCHAR TempString[256]; + + swprintf((WCHAR*)TempString, 256, L"Render Distance: %d",app.GetGameSettings(m_iPad,eGameSetting_RenderDistance)); + m_sliderRenderDistance.init(TempString,eControl_RenderDistance,0,5,DistanceToLevel(app.GetGameSettings(m_iPad,eGameSetting_RenderDistance))); swprintf( (WCHAR *)TempString, 256, L"%ls: %d%%", app.GetString( IDS_SLIDER_GAMMA ),app.GetGameSettings(m_iPad,eGameSetting_Gamma)); m_sliderGamma.init(TempString,eControl_Gamma,0,100,app.GetGameSettings(m_iPad,eGameSetting_Gamma)); @@ -168,6 +190,21 @@ void UIScene_SettingsGraphicsMenu::handleSliderMove(F64 sliderId, F64 currentVal int value = (int)currentValue; switch((int)sliderId) { + case eControl_RenderDistance: + { + m_sliderRenderDistance.handleSliderMove(value); + + int dist = LevelToDistance(value); + + app.SetGameSettings(m_iPad,eGameSetting_RenderDistance,dist); + + Minecraft* mc = Minecraft::GetInstance(); + mc->options->viewDistance = 3 - value; + swprintf((WCHAR*)TempString,256,L"Render Distance: %d",dist); + m_sliderRenderDistance.setLabel(TempString); + } + break; + case eControl_Gamma: m_sliderGamma.handleSliderMove(value); diff --git a/Minecraft.Client/Common/UI/UIScene_SettingsGraphicsMenu.h b/Minecraft.Client/Common/UI/UIScene_SettingsGraphicsMenu.h index c6e1e394..99022c83 100644 --- a/Minecraft.Client/Common/UI/UIScene_SettingsGraphicsMenu.h +++ b/Minecraft.Client/Common/UI/UIScene_SettingsGraphicsMenu.h @@ -1,6 +1,8 @@ #pragma once #include "UIScene.h" +#include "Common/UI/UIControl_CheckBox.h" +#include "Common/UI/UIControl_Slider.h" class UIScene_SettingsGraphicsMenu : public UIScene { @@ -10,17 +12,19 @@ private: eControl_Clouds, eControl_BedrockFog, eControl_CustomSkinAnim, + eControl_RenderDistance, eControl_Gamma, eControl_FOV, eControl_InterfaceOpacity }; UIControl_CheckBox m_checkboxClouds, m_checkboxBedrockFog, m_checkboxCustomSkinAnim; // Checkboxes - UIControl_Slider m_sliderGamma, m_sliderFOV, m_sliderInterfaceOpacity; // Sliders + UIControl_Slider m_sliderRenderDistance, m_sliderGamma, m_sliderFOV, m_sliderInterfaceOpacity; // Sliders UI_BEGIN_MAP_ELEMENTS_AND_NAMES(UIScene) UI_MAP_ELEMENT( m_checkboxClouds, "Clouds") UI_MAP_ELEMENT( m_checkboxBedrockFog, "BedrockFog") UI_MAP_ELEMENT( m_checkboxCustomSkinAnim, "CustomSkinAnim") + UI_MAP_ELEMENT( m_sliderRenderDistance, "RenderDistance") UI_MAP_ELEMENT( m_sliderGamma, "Gamma") UI_MAP_ELEMENT(m_sliderFOV, "FOV") UI_MAP_ELEMENT( m_sliderInterfaceOpacity, "InterfaceOpacity") @@ -45,4 +49,8 @@ public: virtual void handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool &handled); virtual void handleSliderMove(F64 sliderId, F64 currentValue); + + static int LevelToDistance(int dist); + + static int DistanceToLevel(int dist); };
\ No newline at end of file |
