Skip to content

Commit

Permalink
Fix color24 (#353)
Browse files Browse the repository at this point in the history
* fix color24 saving

* clang format
  • Loading branch information
briaguya-ai authored Oct 3, 2023
1 parent 0099c48 commit 317edd7
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/config/ConsoleVariable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -186,12 +186,17 @@ void ConsoleVariable::Save() {
} else if (variable.second->Type == ConsoleVariableType::Color ||
variable.second->Type == ConsoleVariableType::Color24) {
auto keyStr = key.c_str();
Color_RGBA8 clr = variable.second->Color;
conf->SetUInt(StringHelper::Sprintf("%s.R", keyStr), clr.r);
conf->SetUInt(StringHelper::Sprintf("%s.G", keyStr), clr.g);
conf->SetUInt(StringHelper::Sprintf("%s.B", keyStr), clr.b);
conf->SetUInt(StringHelper::Sprintf("%s.R", keyStr), variable.second->Type == ConsoleVariableType::Color
? variable.second->Color.r
: variable.second->Color24.r);
conf->SetUInt(StringHelper::Sprintf("%s.G", keyStr), variable.second->Type == ConsoleVariableType::Color
? variable.second->Color.g
: variable.second->Color24.g);
conf->SetUInt(StringHelper::Sprintf("%s.B", keyStr), variable.second->Type == ConsoleVariableType::Color
? variable.second->Color.b
: variable.second->Color24.b);
if (variable.second->Type == ConsoleVariableType::Color) {
conf->SetUInt(StringHelper::Sprintf("%s.A", keyStr), clr.a);
conf->SetUInt(StringHelper::Sprintf("%s.A", keyStr), variable.second->Color.a);
conf->SetString(StringHelper::Sprintf("%s.Type", keyStr), "RGBA");
} else {
conf->SetString(StringHelper::Sprintf("%s.Type", keyStr), "RGB");
Expand Down

0 comments on commit 317edd7

Please sign in to comment.