mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2025-08-22 06:13:45 -07:00
Added Language selection menu + function
This commit is contained in:
parent
94ba542e66
commit
8400389b59
1 changed files with 32 additions and 0 deletions
|
@ -56,6 +56,7 @@ namespace SohImGui {
|
|||
Console* console = new Console;
|
||||
bool p_open = false;
|
||||
bool needs_save = false;
|
||||
int SelectedLanguage = CVar_GetS32("gLanguages", 0); //Default Language to 0=English 1=German 2=French
|
||||
float kokiri_col[3] = { 0.118f, 0.41f, 0.106f };
|
||||
float goron_col[3] = { 0.392f, 0.078f, 0.0f };
|
||||
float zora_col[3] = { 0.0f, 0.235f, 0.392f };
|
||||
|
@ -334,6 +335,24 @@ namespace SohImGui {
|
|||
}
|
||||
}
|
||||
|
||||
void EnhancementRadioButton(std::string text, std::string cvarName, int id) {
|
||||
/*Usage :
|
||||
EnhancementRadioButton("My Visible Name","gMyCVarName", MyID);
|
||||
First arg is the visible name of the Radio button
|
||||
Second is the cvar name where MyID will be saved.
|
||||
Note: the CVar name should be the same to each Buddies.
|
||||
Example :
|
||||
EnhancementRadioButton("English", "gLanguages", 0);
|
||||
EnhancementRadioButton("German", "gLanguages", 1);
|
||||
EnhancementRadioButton("French", "gLanguages", 2);
|
||||
*/
|
||||
int val = CVar_GetS32(cvarName.c_str(), 0);
|
||||
if (ImGui::RadioButton(text.c_str(), id==val)) {
|
||||
CVar_SetS32(cvarName.c_str(), (int)id);
|
||||
needs_save = true;
|
||||
}
|
||||
}
|
||||
|
||||
void DrawMainMenuAndCalculateGameSize() {
|
||||
console->Update();
|
||||
ImGuiBackendNewFrame();
|
||||
|
@ -722,6 +741,19 @@ namespace SohImGui {
|
|||
ImGui::EndMenu();
|
||||
}
|
||||
|
||||
if (CVar_GetS32("gLanguages", 0) == 0) {
|
||||
SelectedLanguage = 0;
|
||||
} else if (CVar_GetS32("gLanguages", 0) == 1) {
|
||||
SelectedLanguage = 1;
|
||||
} else if (CVar_GetS32("gLanguages", 0) == 2) {
|
||||
SelectedLanguage = 2;
|
||||
}
|
||||
if (ImGui::BeginMenu("Languages")) {
|
||||
EnhancementRadioButton("English", "gLanguages", 0);
|
||||
EnhancementRadioButton("German", "gLanguages", 1);
|
||||
EnhancementRadioButton("French", "gLanguages", 2);
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
|
||||
if (ImGui::BeginMenu("Developer Tools")) {
|
||||
HOOK(ImGui::MenuItem("Stats", nullptr, &Game::Settings.debug.soh));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue