added input system

This commit is contained in:
2026-01-17 18:01:48 +01:00
parent 6d90c91209
commit cf5602417b
21 changed files with 120171 additions and 0 deletions

View File

@@ -0,0 +1,79 @@
#include "JsonExports.hpp"
nlohmann::json TSE::ExportColor(Color &color)
{
using json = nlohmann::json;
json exp;
exp["r"] = color.r;
exp["g"] = color.g;
exp["b"] = color.b;
exp["a"] = color.a;
return exp;
}
nlohmann::json TSE::ExportVector2(Vector2 &vec2)
{
using json = nlohmann::json;
json exp;
exp["x"] = vec2.x;
exp["y"] = vec2.y;
return exp;
}
nlohmann::json TSE::ExportVector3(Vector3 &vec3)
{
using json = nlohmann::json;
json exp;
exp["x"] = vec3.x;
exp["y"] = vec3.y;
exp["z"] = vec3.z;
return exp;
}
nlohmann::json TSE::ExportVector4(Vector4 &vec4)
{
using json = nlohmann::json;
json exp;
exp["x"] = vec4.x;
exp["y"] = vec4.y;
exp["z"] = vec4.z;
exp["w"] = vec4.w;
return exp;
}
TSE::Color TSE::ImportColor(nlohmann::json json)
{
Color imp;
imp.r = json["r"];
imp.g = json["g"];
imp.b = json["b"];
imp.a = json["a"];
return imp;
}
TSE::Vector2 TSE::ImportVector2(nlohmann::json json)
{
Vector2 imp;
imp.x = json["x"];
imp.y = json["y"];
return imp;
}
TSE::Vector3 TSE::ImportVector3(nlohmann::json json)
{
Vector3 imp;
imp.x = json["x"];
imp.y = json["y"];
imp.z = json["z"];
return imp;
}
TSE::Vector4 TSE::ImportVector4(nlohmann::json json)
{
Vector4 imp;
imp.x = json["x"];
imp.y = json["y"];
imp.z = json["z"];
imp.w = json["w"];
return imp;
}

View File

@@ -0,0 +1,20 @@
#pragma once
#include "json.hpp"
#include "Color.hpp"
#include "Vector2.hpp"
#include "Vector3.hpp"
#include "Vector4.hpp"
namespace TSE
{
nlohmann::json ExportColor(Color& color);
nlohmann::json ExportVector2(Vector2& vec2);
nlohmann::json ExportVector3(Vector3& vec3);
nlohmann::json ExportVector4(Vector4& vec4);
Color ImportColor(nlohmann::json json);
Vector2 ImportVector2(nlohmann::json json);
Vector3 ImportVector3(nlohmann::json json);
Vector4 ImportVector4(nlohmann::json json);
} // namespace TSE