Initial image implementation

This commit is contained in:
2025-12-15 16:22:01 +02:00
parent af9ebe5fe8
commit c626578557
6 changed files with 168 additions and 5 deletions

View File

@@ -167,7 +167,7 @@ void json_extract(const json& j, const string& key, string& out)
}
}
void json_extract(const nlohmann::json& j, const string& key, int& out)
void json_extract(const json& j, const string& key, int& out)
{
if (j.contains(key) && j[key].is_number_integer())
{
@@ -175,7 +175,7 @@ void json_extract(const nlohmann::json& j, const string& key, int& out)
}
}
void json_extract(const nlohmann::json& j, const string& key, bool& out)
void json_extract(const json& j, const string& key, bool& out)
{
if (j.contains(key) && j[key].is_boolean())
{
@@ -238,10 +238,24 @@ void json_extract(const json& j, const string& key, SDL_Color& out)
}
}
void json_extract(const nlohmann::json& j, const string& key, Uint8& out)
void json_extract(const json& j, const string& key, Uint8& out)
{
if (j.contains(key) && j[key].is_number_unsigned())
{
out = j[key];
}
}
void json_extract(const json& j, const string& key, ImageResize& out)
{
if (j.contains(key))
{
try
{
out = j[key].get<ImageResize>();
}
catch(const std::exception& e)
{
}
}
}