feat(ui): set orientation in CSimpleSlider::LoadXML

This commit is contained in:
fallenoak 2025-11-29 22:51:48 -06:00
parent d576b8058d
commit 196f90e1d5
No known key found for this signature in database
GPG Key ID: 7628F8E61AEA070D
2 changed files with 28 additions and 0 deletions

View File

@ -79,6 +79,23 @@ void CSimpleSlider::LoadXML(XMLNode* node, CStatus* status) {
}
// TODO
auto orientationStr = node->GetAttributeByName("orientation");
if (orientationStr && *orientationStr) {
SLIDER_ORIENTATION orientation;
if (StringToOrientation(orientationStr, orientation)) {
this->SetOrientation(orientation);
} else {
status->Add(
STATUS_WARNING,
"Frame %s: Unknown orientation %s in element %s",
this->GetDisplayName(),
orientationStr,
node->GetName()
);
}
}
}
void CSimpleSlider::OnLayerUpdate(float elapsedSec) {
@ -151,6 +168,16 @@ void CSimpleSlider::SetMinMaxValues(float min, float max) {
}
}
void CSimpleSlider::SetOrientation(SLIDER_ORIENTATION orientation) {
this->m_orientation = orientation;
if (this->m_thumbTexture) {
this->m_thumbTexture->ClearAllPoints();
}
this->m_changed = 1;
}
void CSimpleSlider::SetThumbTexture(CSimpleTexture* texture, int32_t drawLayer) {
if (this->m_thumbTexture == texture) {
return;

View File

@ -48,6 +48,7 @@ class CSimpleSlider : public CSimpleFrame {
void RunOnMinMaxChangedScript();
void RunOnValueChangedScript();
void SetMinMaxValues(float min, float max);
void SetOrientation(SLIDER_ORIENTATION orientation);
void SetThumbTexture(CSimpleTexture* texture, int32_t drawLayer);
void SetValue(float value);
float Sub96BC10(float value);