diff --git a/src/Menu.cpp b/src/Menu.cpp index b51db2c91..7877483a3 100644 --- a/src/Menu.cpp +++ b/src/Menu.cpp @@ -21,18 +21,6 @@ #include "Streamline.h" #include "Upscaling.h" -NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_WITH_DEFAULT( - ImVec2, - x, - y) - -NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_WITH_DEFAULT( - ImVec4, - x, - y, - z, - w) - NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_WITH_DEFAULT( Menu::ThemeSettings, FontScale, diff --git a/src/Util.cpp b/src/Util.cpp index 342ae8b65..f5b112afb 100644 --- a/src/Util.cpp +++ b/src/Util.cpp @@ -466,4 +466,26 @@ namespace nlohmann std::array temp = j; v = { temp[0], temp[1], temp[2], temp[3] }; } + + void to_json(json& j, const ImVec2& v) + { + j = json{ v.x, v.y }; + } + + void from_json(const json& j, ImVec2& v) + { + std::array temp = j; + v = { temp[0], temp[1] }; + } + + void to_json(json& j, const ImVec4& v) + { + j = json{ v.x, v.y, v.z, v.w }; + } + + void from_json(const json& j, ImVec4& v) + { + std::array temp = j; + v = { temp[0], temp[1], temp[2], temp[3] }; + } } \ No newline at end of file diff --git a/src/Util.h b/src/Util.h index dfa0e8359..79eceadd1 100644 --- a/src/Util.h +++ b/src/Util.h @@ -143,4 +143,9 @@ namespace nlohmann void from_json(const json& j, float3& v); void to_json(json& j, const float4& v); void from_json(const json& j, float4& v); + + void to_json(json& j, const ImVec2& v); + void from_json(const json& j, ImVec2& v); + void to_json(json& j, const ImVec4& v); + void from_json(const json& j, ImVec4& v); }; \ No newline at end of file