Working on translations in portrait mode
This commit is contained in:
1 parent
cdaebc3c0c
commit
a40a582b5a
39 files changed
+2902
-51
No files matched your search
+32
-9
@@ -379,44 +379,67 @@ namespace ZL {
|
||||
const float soundFrac = audioPlayer_.getSoundVolume() / 128.0f;
|
||||
uiManager.setSliderValue("musicVolumeSlider", musicFrac);
|
||||
uiManager.setSliderValue("soundVolumeSlider", soundFrac);
|
||||
|
||||
static std::string musicVolumePrefix = "Громкость музыки: ";
|
||||
static std::string soundVolumePrefix = "Громкость звука: ";
|
||||
|
||||
static std::string musicToggleOn = "Музыка: ВКЛ";
|
||||
static std::string musicToggleOff = "Музыка: ВЫКЛ";
|
||||
static std::string soundToggleOn = "Звук: ВКЛ";
|
||||
static std::string soundToggleOff = "Звук: ВЫКЛ";
|
||||
static std::string fullScreenToggleOn = "Полноэкранный режим: ВКЛ";
|
||||
static std::string fullScreenToggleOff = "Полноэкранный режим: ВЫКЛ";
|
||||
|
||||
if (g_currentLanguage == Language::English)
|
||||
{
|
||||
musicVolumePrefix = "Music volume: ";
|
||||
soundVolumePrefix = "Sound volume: ";
|
||||
musicToggleOn = "Music: ON";
|
||||
musicToggleOff = "Music: OFF";
|
||||
soundToggleOn = "Sound: ON";
|
||||
soundToggleOff = "Sound: OFF";
|
||||
fullScreenToggleOn = "Full Screen: ON";
|
||||
fullScreenToggleOff = "Full Screen: OFF";
|
||||
}
|
||||
|
||||
uiManager.setText("musicVolumeText",
|
||||
"Music volume: " + std::to_string(audioPlayer_.getMusicVolume()));
|
||||
musicVolumePrefix + std::to_string(audioPlayer_.getMusicVolume()));
|
||||
uiManager.setText("soundVolumeText",
|
||||
"Sound volume: " + std::to_string(audioPlayer_.getSoundVolume()));
|
||||
soundVolumePrefix + std::to_string(audioPlayer_.getSoundVolume()));
|
||||
|
||||
uiManager.setSliderCallback("musicVolumeSlider",
|
||||
[this](const std::string&, float value) {
|
||||
const int vol = static_cast<int>(value * 128.0f + 0.5f);
|
||||
audioPlayer_.setMusicVolume(vol);
|
||||
uiManager.setText("musicVolumeText",
|
||||
"Music volume: " + std::to_string(vol));
|
||||
musicVolumePrefix + std::to_string(vol));
|
||||
});
|
||||
uiManager.setSliderCallback("soundVolumeSlider",
|
||||
[this](const std::string&, float value) {
|
||||
const int vol = static_cast<int>(value * 128.0f + 0.5f);
|
||||
audioPlayer_.setSoundVolume(vol);
|
||||
uiManager.setText("soundVolumeText",
|
||||
"Sound volume: " + std::to_string(vol));
|
||||
soundVolumePrefix + std::to_string(vol));
|
||||
});
|
||||
|
||||
// Music on/off toggle — helper to sync button text and color from current state
|
||||
auto refreshMusicToggle = [this]() {
|
||||
const bool on = audioPlayer_.isMusicEnabled();
|
||||
uiManager.setTextButtonText("musicToggleButton", on ? "Music: ON" : "Music: OFF");
|
||||
uiManager.setTextButtonText("musicToggleButton", on ? musicToggleOn : musicToggleOff);
|
||||
uiManager.setTextButtonColor("musicToggleButton", on
|
||||
? std::array<float, 4>{ 0.2f, 0.9f, 0.2f, 1.0f }
|
||||
: std::array<float, 4>{ 0.9f, 0.2f, 0.2f, 1.0f });
|
||||
};
|
||||
auto refreshSoundToggle = [this]() {
|
||||
const bool on = audioPlayer_.isSoundEnabled();
|
||||
uiManager.setTextButtonText("soundToggleButton", on ? "Sound: ON" : "Sound: OFF");
|
||||
uiManager.setTextButtonText("soundToggleButton", on ? soundToggleOn : soundToggleOff);
|
||||
uiManager.setTextButtonColor("soundToggleButton", on
|
||||
? std::array<float, 4>{ 0.2f, 0.9f, 0.2f, 1.0f }
|
||||
: std::array<float, 4>{ 0.9f, 0.2f, 0.2f, 1.0f });
|
||||
};
|
||||
auto refreshFullscreenToggle = [this]() {
|
||||
const bool on = Environment::isFullscreen;
|
||||
uiManager.setTextButtonText("fullScreenToggleButton", on ? "Full Screen: ON" : "Full Screen: OFF");
|
||||
uiManager.setTextButtonText("fullScreenToggleButton", on ? fullScreenToggleOn : fullScreenToggleOff);
|
||||
uiManager.setTextButtonColor("fullScreenToggleButton", on
|
||||
? std::array<float, 4>{ 0.2f, 0.9f, 0.2f, 1.0f }
|
||||
: std::array<float, 4>{ 0.9f, 0.2f, 0.2f, 1.0f });
|
||||
@@ -429,7 +452,7 @@ namespace ZL {
|
||||
uiManager.setTextButtonCallback("musicToggleButton", [this](const std::string&) {
|
||||
audioPlayer_.setMusicEnabled(!audioPlayer_.isMusicEnabled());
|
||||
const bool on = audioPlayer_.isMusicEnabled();
|
||||
uiManager.setTextButtonText("musicToggleButton", on ? "Music: ON" : "Music: OFF");
|
||||
uiManager.setTextButtonText("musicToggleButton", on ? musicToggleOn : musicToggleOff);
|
||||
uiManager.setTextButtonColor("musicToggleButton", on
|
||||
? std::array<float, 4>{ 0.2f, 0.9f, 0.2f, 1.0f }
|
||||
: std::array<float, 4>{ 0.9f, 0.2f, 0.2f, 1.0f });
|
||||
@@ -437,7 +460,7 @@ namespace ZL {
|
||||
uiManager.setTextButtonCallback("soundToggleButton", [this](const std::string&) {
|
||||
audioPlayer_.setSoundEnabled(!audioPlayer_.isSoundEnabled());
|
||||
const bool on = audioPlayer_.isSoundEnabled();
|
||||
uiManager.setTextButtonText("soundToggleButton", on ? "Sound: ON" : "Sound: OFF");
|
||||
uiManager.setTextButtonText("soundToggleButton", on ? soundToggleOn : soundToggleOff);
|
||||
uiManager.setTextButtonColor("soundToggleButton", on
|
||||
? std::array<float, 4>{ 0.2f, 0.9f, 0.2f, 1.0f }
|
||||
: std::array<float, 4>{ 0.9f, 0.2f, 0.2f, 1.0f });
|
||||
|
||||
Reference in new issue
Block a user