Веб-сайт самохостера Lotigara

summaryrefslogtreecommitdiff
path: root/source/frontend
diff options
context:
space:
mode:
authorKae <80987908+Novaenia@users.noreply.github.com>2024-12-26 20:53:06 +1100
committerKae <80987908+Novaenia@users.noreply.github.com>2024-12-26 20:53:06 +1100
commit0a1a82b18b86362263c8fa9ce8919c6d3b36d85c (patch)
tree888f0c8ae4ae87bfb8f5c5aaec669e8ebaf68482 /source/frontend
parent3df5cb78da86912c30b6281f4eafeddd4ba56f32 (diff)
Head Rotation
(way too hardcoded, not ideal but it will do in the meantime as many have been asking for it)
Diffstat (limited to 'source/frontend')
-rw-r--r--source/frontend/StarOptionsMenu.cpp15
-rw-r--r--source/frontend/StarOptionsMenu.hpp2
2 files changed, 16 insertions, 1 deletions
diff --git a/source/frontend/StarOptionsMenu.cpp b/source/frontend/StarOptionsMenu.cpp
index 8253f1f..28d44f6 100644
--- a/source/frontend/StarOptionsMenu.cpp
+++ b/source/frontend/StarOptionsMenu.cpp
@@ -10,6 +10,7 @@
#include "StarVoiceSettingsMenu.hpp"
#include "StarBindingsMenu.hpp"
#include "StarGraphicsMenu.hpp"
+#include "StarHumanoid.hpp"
namespace Star {
@@ -47,6 +48,9 @@ OptionsMenu::OptionsMenu(PaneManager* manager, UniverseClientPtr client)
reader.registerCallback("allowAssetsMismatchCheckbox", [=](Widget*) {
updateAllowAssetsMismatch();
});
+ reader.registerCallback("headRotationCheckbox", [=](Widget*) {
+ updateHeadRotation();
+ });
reader.registerCallback("backButton", [=](Widget*) {
dismiss();
});
@@ -77,6 +81,7 @@ OptionsMenu::OptionsMenu(PaneManager* manager, UniverseClientPtr client)
m_clientIPJoinableButton = fetchChild<ButtonWidget>("clientIPJoinableCheckbox");
m_clientP2PJoinableButton = fetchChild<ButtonWidget>("clientP2PJoinableCheckbox");
m_allowAssetsMismatchButton = fetchChild<ButtonWidget>("allowAssetsMismatchCheckbox");
+ m_headRotationButton = fetchChild<ButtonWidget>("headRotationCheckbox");
m_instrumentLabel = fetchChild<LabelWidget>("instrumentValueLabel");
m_sfxLabel = fetchChild<LabelWidget>("sfxValueLabel");
@@ -115,7 +120,8 @@ StringList const OptionsMenu::ConfigKeys = {
"tutorialMessages",
"clientIPJoinable",
"clientP2PJoinable",
- "allowAssetsMismatch"
+ "allowAssetsMismatch",
+ "humanoidHeadRotation"
};
void OptionsMenu::initConfig() {
@@ -166,6 +172,12 @@ void OptionsMenu::updateAllowAssetsMismatch() {
Root::singleton().configuration()->set("allowAssetsMismatch", m_allowAssetsMismatchButton->isChecked());
}
+void OptionsMenu::updateHeadRotation() {
+ m_localChanges.set("humanoidHeadRotation", m_headRotationButton->isChecked());
+ Root::singleton().configuration()->set("humanoidHeadRotation", m_headRotationButton->isChecked());
+ Humanoid::globalHeadRotation() = m_headRotationButton->isChecked();
+}
+
void OptionsMenu::syncGuiToConf() {
m_instrumentSlider->setVal(m_localChanges.get("instrumentVol").toInt(), false);
m_instrumentLabel->setText(toString(m_instrumentSlider->val()));
@@ -180,6 +192,7 @@ void OptionsMenu::syncGuiToConf() {
m_clientIPJoinableButton->setChecked(m_localChanges.get("clientIPJoinable").toBool());
m_clientP2PJoinableButton->setChecked(m_localChanges.get("clientP2PJoinable").toBool());
m_allowAssetsMismatchButton->setChecked(m_localChanges.get("allowAssetsMismatch").toBool());
+ m_headRotationButton->setChecked(m_localChanges.get("humanoidHeadRotation").optBool().value(true));
auto appController = GuiContext::singleton().applicationController();
if (!appController->p2pNetworkingService()) {
diff --git a/source/frontend/StarOptionsMenu.hpp b/source/frontend/StarOptionsMenu.hpp
index 9fde1ac..4a28fd0 100644
--- a/source/frontend/StarOptionsMenu.hpp
+++ b/source/frontend/StarOptionsMenu.hpp
@@ -36,6 +36,7 @@ private:
void updateClientIPJoinable();
void updateClientP2PJoinable();
void updateAllowAssetsMismatch();
+ void updateHeadRotation();
void syncGuiToConf();
@@ -52,6 +53,7 @@ private:
ButtonWidgetPtr m_clientIPJoinableButton;
ButtonWidgetPtr m_clientP2PJoinableButton;
ButtonWidgetPtr m_allowAssetsMismatchButton;
+ ButtonWidgetPtr m_headRotationButton;
LabelWidgetPtr m_instrumentLabel;
LabelWidgetPtr m_sfxLabel;