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.
This commit is contained in:
@@ -126,4 +126,4 @@ void UIScene_LanguageSelector::handlePress(F64 controlId, F64 childId)
|
||||
|
||||
app.CheckGameSettingsChanged(true, m_iPad);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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);
|
||||
};
|
||||
Reference in New Issue
Block a user