diff --git a/source/lua/lua_color.cpp b/source/lua/lua_color.cpp index 1a408b2..c56c430 100644 --- a/source/lua/lua_color.cpp +++ b/source/lua/lua_color.cpp @@ -40,9 +40,9 @@ namespace omath::lua::detail omath_table.new_usertype( "Hsv", sol::constructors(), - "hue", &omath::Hsv::hue, - "saturation", &omath::Hsv::saturation, - "value", &omath::Hsv::value); + "hue", sol::property([](const omath::Hsv& h) { return h.hue; }, [](omath::Hsv& h, float val) { h.hue = val; }), + "saturation", sol::property([](const omath::Hsv& h) { return h.saturation; }, [](omath::Hsv& h, float val) { h.saturation = val; }), + "value", sol::property([](const omath::Hsv& h) { return h.value; }, [](omath::Hsv& h, float val) { h.value = val; })); } } // namespace omath::lua::detail #endif diff --git a/source/lua/lua_engines.cpp b/source/lua/lua_engines.cpp index 8184fb7..eafd8c5 100644 --- a/source/lua/lua_engines.cpp +++ b/source/lua/lua_engines.cpp @@ -207,25 +207,25 @@ namespace omath::lua::detail t.new_usertype( "ViewPort", sol::factories([](float w, float h) { return omath::projection::ViewPort{w, h}; }), - "width", &omath::projection::ViewPort::m_width, - "height", &omath::projection::ViewPort::m_height, + "width", sol::property([](const omath::projection::ViewPort& vp) { return vp.m_width; }, [](omath::projection::ViewPort& vp, float val) { vp.m_width = val; }), + "height", sol::property([](const omath::projection::ViewPort& vp) { return vp.m_height; }, [](omath::projection::ViewPort& vp, float val) { vp.m_height = val; }), "aspect_ratio", &omath::projection::ViewPort::aspect_ratio); t.new_usertype( "ViewAngles90", sol::factories([](PitchAngle90 p, SharedYawRoll y, SharedYawRoll r) { return ViewAngles90{p, y, r}; }), - "pitch", &ViewAngles90::pitch, - "yaw", &ViewAngles90::yaw, - "roll", &ViewAngles90::roll); + "pitch", sol::property([](const ViewAngles90& va) { return va.pitch; }, [](ViewAngles90& va, const PitchAngle90& val) { va.pitch = val; }), + "yaw", sol::property([](const ViewAngles90& va) { return va.yaw; }, [](ViewAngles90& va, const SharedYawRoll& val) { va.yaw = val; }), + "roll", sol::property([](const ViewAngles90& va) { return va.roll; }, [](ViewAngles90& va, const SharedYawRoll& val) { va.roll = val; })); t.new_usertype( "ViewAngles89", sol::factories([](PitchAngle89 p, SharedYawRoll y, SharedYawRoll r) { return ViewAngles89{p, y, r}; }), - "pitch", &ViewAngles89::pitch, - "yaw", &ViewAngles89::yaw, - "roll", &ViewAngles89::roll); + "pitch", sol::property([](const ViewAngles89& va) { return va.pitch; }, [](ViewAngles89& va, const PitchAngle89& val) { va.pitch = val; }), + "yaw", sol::property([](const ViewAngles89& va) { return va.yaw; }, [](ViewAngles89& va, const SharedYawRoll& val) { va.yaw = val; }), + "roll", sol::property([](const ViewAngles89& va) { return va.roll; }, [](ViewAngles89& va, const SharedYawRoll& val) { va.roll = val; })); } void register_engines(sol::table& omath_table) diff --git a/source/lua/lua_vec2.cpp b/source/lua/lua_vec2.cpp index 058090f..546d014 100644 --- a/source/lua/lua_vec2.cpp +++ b/source/lua/lua_vec2.cpp @@ -14,7 +14,8 @@ namespace omath::lua::detail omath_table.new_usertype( "Vec2", sol::constructors(), - "x", &Vec2f::x, "y", &Vec2f::y, + "x", sol::property([](const Vec2f& v) { return v.x; }, [](Vec2f& v, float val) { v.x = val; }), + "y", sol::property([](const Vec2f& v) { return v.y; }, [](Vec2f& v, float val) { v.y = val; }), sol::meta_function::addition, sol::resolve(&Vec2f::operator+), sol::meta_function::subtraction, sol::resolve(&Vec2f::operator-), diff --git a/source/lua/lua_vec3.cpp b/source/lua/lua_vec3.cpp index e6cc37d..11cd2f4 100644 --- a/source/lua/lua_vec3.cpp +++ b/source/lua/lua_vec3.cpp @@ -14,7 +14,9 @@ namespace omath::lua::detail omath_table.new_usertype( "Vec3", sol::constructors(), - "x", &Vec3f::x, "y", &Vec3f::y, "z", &Vec3f::z, + "x", sol::property([](const Vec3f& v) { return v.x; }, [](Vec3f& v, float val) { v.x = val; }), + "y", sol::property([](const Vec3f& v) { return v.y; }, [](Vec3f& v, float val) { v.y = val; }), + "z", sol::property([](const Vec3f& v) { return v.z; }, [](Vec3f& v, float val) { v.z = val; }), sol::meta_function::addition, sol::resolve(&Vec3f::operator+), sol::meta_function::subtraction, sol::resolve(&Vec3f::operator-), diff --git a/source/lua/lua_vec4.cpp b/source/lua/lua_vec4.cpp index 4d26dd8..c86e68e 100644 --- a/source/lua/lua_vec4.cpp +++ b/source/lua/lua_vec4.cpp @@ -14,7 +14,10 @@ namespace omath::lua::detail omath_table.new_usertype( "Vec4", sol::constructors(), - "x", &Vec4f::x, "y", &Vec4f::y, "z", &Vec4f::z, "w", &Vec4f::w, + "x", sol::property([](const Vec4f& v) { return v.x; }, [](Vec4f& v, float val) { v.x = val; }), + "y", sol::property([](const Vec4f& v) { return v.y; }, [](Vec4f& v, float val) { v.y = val; }), + "z", sol::property([](const Vec4f& v) { return v.z; }, [](Vec4f& v, float val) { v.z = val; }), + "w", sol::property([](const Vec4f& v) { return v.w; }, [](Vec4f& v, float val) { v.w = val; }), sol::meta_function::addition, sol::resolve(&Vec4f::operator+), sol::meta_function::subtraction, sol::resolve(&Vec4f::operator-),