Skip to content

Commit

Permalink
Added Box2D callbacks for Lua
Browse files Browse the repository at this point in the history
  • Loading branch information
eduardodoria committed Sep 11, 2023
1 parent f6c3f03 commit edbdb7d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions engine/core/script/binding/CoreClassesLua.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include "Contact2D.h"
#include "Manifold2D.h"
#include "ContactImpulse2D.h"
#include "AudioSystem.h"

using namespace Supernova;

Expand Down Expand Up @@ -329,6 +330,7 @@ void LuaBinding::registerCoreClasses(lua_State *L){
.addFunction("moveChildUp", &Scene::moveChildUp)
.addFunction("moveChildDown", &Scene::moveChildDown)
.addFunction("moveChildToLast", &Scene::moveChildToLast)
.addFunction("getAudioSystem", [] (Scene* self, lua_State* L) -> AudioSystem* { return self->getSystem<AudioSystem>().get(); })
.endClass();

luabridge::getGlobalNamespace(L)
Expand Down
4 changes: 4 additions & 0 deletions engine/core/script/binding/ECSClassesLua.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,10 @@ void LuaBinding::registerECSClasses(lua_State *L){
.beginClass<PhysicsSystem>("PhysicsSystem")
.addProperty("pointsToMeterScale", &PhysicsSystem::getPointsToMeterScale, &PhysicsSystem::setPointsToMeterScale)
.addProperty("beginContact2D", [] (PhysicsSystem* self, lua_State* L) { return &self->beginContact2D; }, [] (PhysicsSystem* self, lua_State* L) { self->beginContact2D = L; })
.addProperty("endContact2D", [] (PhysicsSystem* self, lua_State* L) { return &self->endContact2D; }, [] (PhysicsSystem* self, lua_State* L) { self->endContact2D = L; })
.addProperty("preSolve2D", [] (PhysicsSystem* self, lua_State* L) { return &self->preSolve2D; }, [] (PhysicsSystem* self, lua_State* L) { self->preSolve2D = L; })
.addProperty("postSolve2D", [] (PhysicsSystem* self, lua_State* L) { return &self->postSolve2D; }, [] (PhysicsSystem* self, lua_State* L) { self->postSolve2D = L; })
.addProperty("shouldCollide2D", [] (PhysicsSystem* self, lua_State* L) { return &self->shouldCollide2D; }, [] (PhysicsSystem* self, lua_State* L) { self->shouldCollide2D = L; })
.endClass();

luabridge::getGlobalNamespace(L)
Expand Down

0 comments on commit edbdb7d

Please sign in to comment.