22 auto& lua = core::ServiceLocator<sol::state>::ref();
25 lua.new_enum<b2BodyType>(
"b2BodyType",
27 {
"b2_dynamicBody", b2BodyType::b2_dynamicBody},
28 {
"b2_kinematicBody", b2BodyType::b2_kinematicBody},
29 {
"b2_staticBody", b2BodyType::b2_staticBody}
33 lua.new_usertype<b2Vec2>(
46 &b2Vec2::LengthSquared,
53 sol::call_constructor,
54 sol::constructors<b2Vec2(), b2Vec2(float, float)>(),
55 sol::meta_function::addition,
56 sol::overload([](b2Vec2& left,
const b2Vec2& right) {
61 sol::meta_function::subtraction,
62 sol::overload([](b2Vec2& left,
const b2Vec2& right) {
67 sol::meta_function::multiplication,
69 [](
const float& left, b2Vec2& right) {
74 [](b2Vec2& left,
const float& right) {
82 lua.new_usertype<b2Vec3>(
94 sol::call_constructor,
95 sol::constructors<b2Vec3(), b2Vec3(float, float, float)>(),
96 sol::meta_function::addition,
97 sol::overload([](b2Vec3& left,
const b2Vec3& right) {
102 sol::meta_function::subtraction,
103 sol::overload([](b2Vec3& left,
const b2Vec3& right) {
108 sol::meta_function::multiplication,
110 [](
const float& left, b2Vec3& right) {
115 [](b2Vec3& left,
const float& right) {
123 auto b2world_type = lua.new_usertype<b2World>(
"b2World", sol::no_constructor);
124 b2world_type[
"ClearForces"] = &b2World::ClearForces;
125 b2world_type[
"SetAllowSleeping"] = &b2World::SetAllowSleeping;
126 b2world_type[
"GetAllowSleeping"] = &b2World::GetAllowSleeping;
127 b2world_type[
"SetWarmStarting"] = &b2World::SetWarmStarting;
128 b2world_type[
"GetWarmStarting"] = &b2World::GetWarmStarting;
129 b2world_type[
"SetSubStepping"] = &b2World::SetSubStepping;
130 b2world_type[
"GetSubStepping"] = &b2World::GetSubStepping;
131 b2world_type[
"GetProxyCount"] = &b2World::GetProxyCount;
132 b2world_type[
"GetBodyCount"] = &b2World::GetBodyCount;
133 b2world_type[
"GetJointCount"] = &b2World::GetJointCount;
134 b2world_type[
"GetContactCount"] = &b2World::GetContactCount;
135 b2world_type[
"GetTreeHeight"] = &b2World::GetTreeHeight;
136 b2world_type[
"GetTreeBalance"] = &b2World::GetTreeBalance;
137 b2world_type[
"GetTreeQuality"] = &b2World::GetTreeQuality;
138 b2world_type[
"SetGravity"] = &b2World::SetGravity;
139 b2world_type[
"GetGravity"] = &b2World::GetGravity;
140 b2world_type[
"IsLocked"] = &b2World::IsLocked;
141 b2world_type[
"SetAutoClearForces"] = &b2World::SetAutoClearForces;
142 b2world_type[
"GetAutoClearForces"] = &b2World::GetAutoClearForces;
143 b2world_type[
"ShiftOrigin"] = &b2World::ShiftOrigin;
144 b2world_type[
"Dump"] = &b2World::Dump;