the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
at main 170 lines 5.5 kB view raw
1#include "stdafx.h" 2#include "UI.h" 3#include "UIScene_SettingsGraphicsMenu.h" 4#include "..\..\Minecraft.h" 5#include "..\..\GameRenderer.h" 6 7UIScene_SettingsGraphicsMenu::UIScene_SettingsGraphicsMenu(int iPad, void *initData, UILayer *parentLayer) : UIScene(iPad, parentLayer) 8{ 9 // Setup all the Iggy references we need for this scene 10 initialiseMovie(); 11 Minecraft* pMinecraft = Minecraft::GetInstance(); 12 13 m_bNotInGame=(Minecraft::GetInstance()->level==NULL); 14 15 m_checkboxClouds.init(app.GetString(IDS_CHECKBOX_RENDER_CLOUDS),eControl_Clouds,(app.GetGameSettings(m_iPad,eGameSetting_Clouds)!=0)); 16 m_checkboxBedrockFog.init(app.GetString(IDS_CHECKBOX_RENDER_BEDROCKFOG),eControl_BedrockFog,(app.GetGameSettings(m_iPad,eGameSetting_BedrockFog)!=0)); 17 m_checkboxCustomSkinAnim.init(app.GetString(IDS_CHECKBOX_CUSTOM_SKIN_ANIM),eControl_CustomSkinAnim,(app.GetGameSettings(m_iPad,eGameSetting_CustomSkinAnim)!=0)); 18 19 20 WCHAR TempString[256]; 21 22 swprintf( (WCHAR *)TempString, 256, L"%ls: %d%%", app.GetString( IDS_SLIDER_GAMMA ),app.GetGameSettings(m_iPad,eGameSetting_Gamma)); 23 m_sliderGamma.init(TempString,eControl_Gamma,0,100,app.GetGameSettings(m_iPad,eGameSetting_Gamma)); 24 25 swprintf((WCHAR*)TempString, 256, L"FOV: %d%%", (int)pMinecraft->gameRenderer->GetFovVal()); 26 m_sliderFOV.init(TempString, eControl_FOV, 70, 110, (int)pMinecraft->gameRenderer->GetFovVal()); 27 28 swprintf( (WCHAR *)TempString, 256, L"%ls: %d%%", app.GetString( IDS_SLIDER_INTERFACEOPACITY ),app.GetGameSettings(m_iPad,eGameSetting_InterfaceOpacity)); 29 m_sliderInterfaceOpacity.init(TempString,eControl_InterfaceOpacity,0,100,app.GetGameSettings(m_iPad,eGameSetting_InterfaceOpacity)); 30 31 doHorizontalResizeCheck(); 32 33 bool bInGame=(Minecraft::GetInstance()->level!=NULL); 34 bool bIsPrimaryPad=(ProfileManager.GetPrimaryPad()==m_iPad); 35 // if we're not in the game, we need to use basescene 0 36 if(bInGame) 37 { 38 // If the game has started, then you need to be the host to change the in-game gamertags 39 if(bIsPrimaryPad) 40 { 41 // we are the primary player on this machine, but not the game host 42 // are we the game host? If not, we need to remove the bedrockfog setting 43 if(!g_NetworkManager.IsHost()) 44 { 45 // hide the in-game bedrock fog setting 46 removeControl(&m_checkboxBedrockFog, true); 47 } 48 } 49 else 50 { 51 // We shouldn't have the bedrock fog option, or the m_CustomSkinAnim option 52 removeControl(&m_checkboxBedrockFog, true); 53 removeControl(&m_checkboxCustomSkinAnim, true); 54 } 55 } 56 57 if(app.GetLocalPlayerCount()>1) 58 { 59#if TO_BE_IMPLEMENTED 60 app.AdjustSplitscreenScene(m_hObj,&m_OriginalPosition,m_iPad); 61#endif 62 } 63} 64 65UIScene_SettingsGraphicsMenu::~UIScene_SettingsGraphicsMenu() 66{ 67} 68 69wstring UIScene_SettingsGraphicsMenu::getMoviePath() 70{ 71 if(app.GetLocalPlayerCount() > 1) 72 { 73 return L"SettingsGraphicsMenuSplit"; 74 } 75 else 76 { 77 return L"SettingsGraphicsMenu"; 78 } 79} 80 81void UIScene_SettingsGraphicsMenu::updateTooltips() 82{ 83 ui.SetTooltips( m_iPad, IDS_TOOLTIPS_SELECT,IDS_TOOLTIPS_BACK); 84} 85 86void UIScene_SettingsGraphicsMenu::updateComponents() 87{ 88 bool bNotInGame=(Minecraft::GetInstance()->level==NULL); 89 if(bNotInGame) 90 { 91 m_parentLayer->showComponent(m_iPad,eUIComponent_Panorama,true); 92 m_parentLayer->showComponent(m_iPad,eUIComponent_Logo,true); 93 } 94 else 95 { 96 m_parentLayer->showComponent(m_iPad,eUIComponent_Panorama,false); 97 98 if( app.GetLocalPlayerCount() == 1 ) m_parentLayer->showComponent(m_iPad,eUIComponent_Logo,true); 99 else m_parentLayer->showComponent(m_iPad,eUIComponent_Logo,false); 100 101 } 102} 103 104void UIScene_SettingsGraphicsMenu::handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool &handled) 105{ 106 ui.AnimateKeyPress(iPad, key, repeat, pressed, released); 107 switch(key) 108 { 109 case ACTION_MENU_CANCEL: 110 if(pressed) 111 { 112 // check the checkboxes 113 app.SetGameSettings(m_iPad,eGameSetting_Clouds,m_checkboxClouds.IsChecked()?1:0); 114 app.SetGameSettings(m_iPad,eGameSetting_BedrockFog,m_checkboxBedrockFog.IsChecked()?1:0); 115 app.SetGameSettings(m_iPad,eGameSetting_CustomSkinAnim,m_checkboxCustomSkinAnim.IsChecked()?1:0); 116 117 navigateBack(); 118 handled = true; 119 } 120 break; 121 case ACTION_MENU_OK: 122#ifdef __ORBIS__ 123 case ACTION_MENU_TOUCHPAD_PRESS: 124#endif 125 sendInputToMovie(key, repeat, pressed, released); 126 break; 127 case ACTION_MENU_UP: 128 case ACTION_MENU_DOWN: 129 case ACTION_MENU_LEFT: 130 case ACTION_MENU_RIGHT: 131 sendInputToMovie(key, repeat, pressed, released); 132 break; 133 } 134} 135 136void UIScene_SettingsGraphicsMenu::handleSliderMove(F64 sliderId, F64 currentValue) 137{ 138 WCHAR TempString[256]; 139 int value = (int)currentValue; 140 switch((int)sliderId) 141 { 142 case eControl_Gamma: 143 m_sliderGamma.handleSliderMove(value); 144 145 app.SetGameSettings(m_iPad,eGameSetting_Gamma,value); 146 swprintf( (WCHAR *)TempString, 256, L"%ls: %d%%", app.GetString( IDS_SLIDER_GAMMA ),value); 147 m_sliderGamma.setLabel(TempString); 148 149 break; 150 151 case eControl_FOV: 152 { 153 Minecraft* pMinecraft = Minecraft::GetInstance(); 154 pMinecraft->gameRenderer->SetFovVal((float)currentValue); 155 WCHAR TempString[256]; 156 swprintf((WCHAR*)TempString, 256, L"FOV: %d%%", (int)currentValue); 157 m_sliderFOV.setLabel(TempString); 158 } 159 break; 160 161 case eControl_InterfaceOpacity: 162 m_sliderInterfaceOpacity.handleSliderMove(value); 163 164 app.SetGameSettings(m_iPad,eGameSetting_InterfaceOpacity,value); 165 swprintf( (WCHAR *)TempString, 256, L"%ls: %d%%", app.GetString( IDS_SLIDER_INTERFACEOPACITY ),value); 166 m_sliderInterfaceOpacity.setLabel(TempString); 167 168 break; 169 } 170}