diff options
author | Kae <80987908+Novaenia@users.noreply.github.com> | 2024-03-20 15:29:26 +1100 |
---|---|---|
committer | Kae <80987908+Novaenia@users.noreply.github.com> | 2024-03-20 15:29:26 +1100 |
commit | bf73fbc1ad3ed8b13683481c29cc2ec39e2d3117 (patch) | |
tree | d04dc378333be32566b94fb5f04eb98877a50ad5 /source/core/StarJsonExtra.cpp | |
parent | 6d76a11e256cd96c9cdd7ae5a10c0276e6347277 (diff) |
cursed point lights everywhere (but god it looks good)
Diffstat (limited to 'source/core/StarJsonExtra.cpp')
-rw-r--r-- | source/core/StarJsonExtra.cpp | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/source/core/StarJsonExtra.cpp b/source/core/StarJsonExtra.cpp index 81bc858..2517b7b 100644 --- a/source/core/StarJsonExtra.cpp +++ b/source/core/StarJsonExtra.cpp @@ -214,12 +214,12 @@ Color jsonToColor(Json const& v) { if (v.type() != Json::Type::Array || (v.size() != 3 && v.size() != 4)) throw JsonException("Json not an array of size 3 or 4 in jsonToColor"); Color c = Color::rgba(0, 0, 0, 255); - c.setRedF((float)v.getInt(0) / 255.f); - c.setGreenF((float)v.getInt(1) / 255.f); - c.setBlueF((float)v.getInt(2) / 255.f); + c.setRed(v.getInt(0)); + c.setGreen(v.getInt(1)); + c.setBlue(v.getInt(2)); if (v.size() == 4) - c.setAlphaF((float)v.getInt(3) / 255.f); + c.setAlpha(v.getInt(3)); return c; } else if (v.type() == Json::Type::String) { @@ -231,12 +231,11 @@ Color jsonToColor(Json const& v) { Json jsonFromColor(Color const& color) { JsonArray result; - result.push_back(color.redF() * 255.f); - result.push_back(color.greenF() * 255.f); - result.push_back(color.blueF() * 255.f); - if (color.alphaF() < 255.f) { - result.push_back(color.alphaF() * 255.f); - } + result.push_back(color.red()); + result.push_back(color.green()); + result.push_back(color.blue()); + if (color.alpha() < 255) + result.push_back(color.alpha()); return result; } |