Skip to content

Commit

Permalink
Main menu: Merge HUD/GUI quick-setting and sub-menu selection
Browse files Browse the repository at this point in the history
  • Loading branch information
jimrandomh committed Apr 30, 2015
1 parent cb701e0 commit 77f6e7a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 7 deletions.
23 changes: 17 additions & 6 deletions DxProxy/DxProxy/InGameMenus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,7 @@ std::string DepthModeToString(D3DProxyDevice::GUI_3D_Depth_Modes mode)
}
}


/**
* Main Menu method.
***/
Expand All @@ -382,33 +383,38 @@ void D3DProxyDevice::VPMENU_MainMenu()

if (includeShaderAnalyzer)
{
menu->AddNavigation("Activate Vireio Shader Analyzer\n",
menu->AddNavigation("Shader Analyzer\n",
[=]() { VPMENU_ShaderSubMenu(); });
}

menu->AddNavigation("World-Scale Calibration\n", [=]() { VPMENU_WorldScale(); });
menu->AddNavigation("Convergence Adjustment\n", [=]() { VPMENU_Convergence(); });
menu->AddNavigation("HUD Calibration\n", [=]() { VPMENU_HUD(); });
menu->AddNavigation("GUI Calibration\n", [=]() { VPMENU_GUI(); });
//menu->AddNavigation("HUD Calibration\n", [=]() { VPMENU_HUD(); });
//menu->AddNavigation("GUI Calibration\n", [=]() { VPMENU_GUI(); });

menu->AddEnumPicker("HUD Quick Setting : %s", (int*)&hud3DDepthMode,
menu->AddEnumPicker("HUD Settings : %s", (int*)&hud3DDepthMode,
HUD_3D_Depth_Modes::HUD_ENUM_RANGE, [](int val) {
return DepthModeToString((HUD_3D_Depth_Modes)val);
}, [=](int newValue) {
ChangeHUD3DDepthMode((HUD_3D_Depth_Modes)newValue);
}, [=]() {
VPMENU_NavigateTo([=](){ VPMENU_HUD(); });
});
menu->AddEnumPicker("GUI Quick Setting : %s", (int*)&gui3DDepthMode,
menu->AddEnumPicker("GUI Settings : %s", (int*)&gui3DDepthMode,
GUI_3D_Depth_Modes::GUI_ENUM_RANGE, [](int val) {
return DepthModeToString((GUI_3D_Depth_Modes)val);
}, [=](int newValue) {
ChangeGUI3DDepthMode((GUI_3D_Depth_Modes)newValue);
}, [=]() {
VPMENU_NavigateTo([=](){ VPMENU_GUI(); });
});
menu->AddNavigation("Overall Settings\n", [=]() { VPMENU_Settings(); });
menu->AddNavigation("VRBoost Values\n", [=]() { VPMENU_VRBoostValues(); });
menu->AddNavigation("Position Tracking Configuration\n", [=]() { VPMENU_PosTracking(); });
menu->AddNavigation("General Hotkeys\n", [=]() { VPMENU_Hotkeys(); });
menu->AddNavigation("3D Adjustment Hotkeys\n", [=]() { VPMENU_AdjustmentHotkeys(); });
menu->AddNavigation("Comfort Mode Configuration\n", [=]() { VPMENU_ComfortMode(); });

menu->AddButton("Restore Configuration\n", [=]() {
// first, backup all strings
std::string game_exe = config.game_exe;
Expand Down Expand Up @@ -1715,7 +1721,7 @@ void MenuBuilder::AddAdjustment(const char *formatString, float *value, float de
});
}

void MenuBuilder::AddEnumPicker(const char *formatString, int *currentValue, int maxValue, std::function<std::string(int)> getDescription, std::function<void(int)> onChange)
void MenuBuilder::AddEnumPicker(const char *formatString, int *currentValue, int maxValue, std::function<std::string(int)> getDescription, std::function<void(int)> onChange, std::function<void()> onActivate)
{
std::string description = retprintf(formatString, getDescription(*currentValue).c_str());

Expand All @@ -1738,6 +1744,11 @@ void MenuBuilder::AddEnumPicker(const char *formatString, int *currentValue, int
}
device->HotkeyCooldown(COOLDOWN_SHORT);
}
if (device->VPMENU_Input_Selected() && device->HotkeysActive())
{
onActivate();
device->HotkeyCooldown(COOLDOWN_SHORT);
}
});

D3DRECT rect;
Expand Down
2 changes: 1 addition & 1 deletion DxProxy/DxProxy/InGameMenus.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class MenuBuilder
void AddGameKeypress(std::string text, byte *binding);
void AddKeybind(std::string text, InputBindingRef *binding);
void AddAdjustment(const char *formatString, float *value, float defaultValue, float rate, std::function<void()> onChange=[](){});
void AddEnumPicker(const char *formatString, int *currentValue, int maxValue, std::function<std::string(int)> getDescription, std::function<void(int)> onChange);
void AddEnumPicker(const char *formatString, int *currentValue, int maxValue, std::function<std::string(int)> getDescription, std::function<void(int)> onChange, std::function<void()> onActivate=[](){});
void AddBackButtons();
void OnClose(std::function<void()> onClose);

Expand Down

0 comments on commit 77f6e7a

Please sign in to comment.