Compare commits
5
Commits
v3-deps-38
...
v3-deps-40
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
32c21bc388 | ||
|
|
844509e61a | ||
|
|
4ea54c180d | ||
|
|
306402354e | ||
|
|
5c90ba54d3 |
@@ -117,6 +117,59 @@ LOCAL_EXPORT_CPPFLAGS := -D__STDC_LIMIT_MACROS=1 -Wno-invalid-offsetof
|
||||
LOCAL_STATIC_LIBRARIES += cocos_mozglue_static
|
||||
include $(PREBUILT_STATIC_LIBRARY)
|
||||
|
||||
#======================================
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := v8_builtins_generators
|
||||
LOCAL_SRC_FILES := $(TARGET_ARCH_ABI)/libv8_builtins_generators.a
|
||||
include $(PREBUILT_STATIC_LIBRARY)
|
||||
|
||||
#======================================
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := v8_builtins_setup
|
||||
LOCAL_SRC_FILES := $(TARGET_ARCH_ABI)/libv8_builtins_setup.a
|
||||
include $(PREBUILT_STATIC_LIBRARY)
|
||||
|
||||
#======================================
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := v8_libbase
|
||||
LOCAL_SRC_FILES := $(TARGET_ARCH_ABI)/libv8_libbase.a
|
||||
include $(PREBUILT_STATIC_LIBRARY)
|
||||
|
||||
#======================================
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := v8_libplatform
|
||||
LOCAL_SRC_FILES := $(TARGET_ARCH_ABI)/libv8_libplatform.a
|
||||
include $(PREBUILT_STATIC_LIBRARY)
|
||||
|
||||
#======================================
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := v8_libsampler
|
||||
LOCAL_SRC_FILES := $(TARGET_ARCH_ABI)/libv8_libsampler.a
|
||||
include $(PREBUILT_STATIC_LIBRARY)
|
||||
|
||||
#======================================
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := v8_nosnapshot
|
||||
LOCAL_SRC_FILES := $(TARGET_ARCH_ABI)/libv8_nosnapshot.a
|
||||
include $(PREBUILT_STATIC_LIBRARY)
|
||||
|
||||
#======================================
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := v8_inspector
|
||||
LOCAL_SRC_FILES := $(TARGET_ARCH_ABI)/libinspector.a
|
||||
include $(PREBUILT_STATIC_LIBRARY)
|
||||
|
||||
#======================================
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_MODULE := v8_static
|
||||
LOCAL_SRC_FILES := $(TARGET_ARCH_ABI)/libv8_base.a
|
||||
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/$(TARGET_ARCH_ABI)/include/v8
|
||||
|
||||
LOCAL_WHOLE_STATIC_LIBRARIES += v8_base v8_builtins_generators v8_builtins_setup v8_libbase v8_libplatform v8_libsampler v8_nosnapshot v8_inspector
|
||||
|
||||
include $(PREBUILT_STATIC_LIBRARY)
|
||||
|
||||
#======================================
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
|
||||
@@ -65,4 +65,6 @@ For discussion please visit http://box2d.org/forum
|
||||
#include <Box2D/Dynamics/Joints/b2WeldJoint.h>
|
||||
#include <Box2D/Dynamics/Joints/b2WheelJoint.h>
|
||||
|
||||
#include <Box2D/b2ObjectDestroyNotifier.h>
|
||||
|
||||
#endif
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
#include <Box2D/Dynamics/b2Body.h>
|
||||
#include <Box2D/Dynamics/b2Fixture.h>
|
||||
#include <Box2D/Dynamics/b2World.h>
|
||||
#include <Box2D/b2ObjectDestroyNotifier.h>
|
||||
|
||||
b2ContactRegister b2Contact::s_registers[b2Shape::e_typeCount][b2Shape::e_typeCount];
|
||||
bool b2Contact::s_initialized = false;
|
||||
@@ -119,6 +120,7 @@ void b2Contact::Destroy(b2Contact* contact, b2BlockAllocator* allocator)
|
||||
b2Assert(0 <= typeA && typeB < b2Shape::e_typeCount);
|
||||
b2Assert(0 <= typeA && typeB < b2Shape::e_typeCount);
|
||||
|
||||
b2NotifyObjectDestroyed(contact, b2ObjectType::CONTACT, typeid(*contact).name());
|
||||
b2ContactDestroyFcn* destroyFcn = s_registers[typeA][typeB].destroyFcn;
|
||||
destroyFcn(contact, allocator);
|
||||
}
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
#include <Box2D/Dynamics/b2Body.h>
|
||||
#include <Box2D/Dynamics/b2World.h>
|
||||
#include <Box2D/Common/b2BlockAllocator.h>
|
||||
#include <Box2D/b2ObjectDestroyNotifier.h>
|
||||
|
||||
#include <new>
|
||||
|
||||
@@ -127,6 +128,7 @@ b2Joint* b2Joint::Create(const b2JointDef* def, b2BlockAllocator* allocator)
|
||||
|
||||
void b2Joint::Destroy(b2Joint* joint, b2BlockAllocator* allocator)
|
||||
{
|
||||
b2NotifyObjectDestroyed(joint, b2ObjectType::JOIN, typeid(*joint).name());
|
||||
joint->~b2Joint();
|
||||
switch (joint->m_type)
|
||||
{
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include <Box2D/Collision/b2BroadPhase.h>
|
||||
#include <Box2D/Collision/b2Collision.h>
|
||||
#include <Box2D/Common/b2BlockAllocator.h>
|
||||
#include <Box2D/b2ObjectDestroyNotifier.h>
|
||||
|
||||
b2Fixture::b2Fixture()
|
||||
{
|
||||
@@ -82,6 +83,7 @@ void b2Fixture::Destroy(b2BlockAllocator* allocator)
|
||||
case b2Shape::e_circle:
|
||||
{
|
||||
b2CircleShape* s = (b2CircleShape*)m_shape;
|
||||
b2NotifyObjectDestroyed(s, b2ObjectType::CIRCLE_SHAPE, "b2CircleShape");
|
||||
s->~b2CircleShape();
|
||||
allocator->Free(s, sizeof(b2CircleShape));
|
||||
}
|
||||
@@ -90,6 +92,7 @@ void b2Fixture::Destroy(b2BlockAllocator* allocator)
|
||||
case b2Shape::e_edge:
|
||||
{
|
||||
b2EdgeShape* s = (b2EdgeShape*)m_shape;
|
||||
b2NotifyObjectDestroyed(s, b2ObjectType::EDGE_SHAPE, "b2EdgeShape");
|
||||
s->~b2EdgeShape();
|
||||
allocator->Free(s, sizeof(b2EdgeShape));
|
||||
}
|
||||
@@ -98,6 +101,7 @@ void b2Fixture::Destroy(b2BlockAllocator* allocator)
|
||||
case b2Shape::e_polygon:
|
||||
{
|
||||
b2PolygonShape* s = (b2PolygonShape*)m_shape;
|
||||
b2NotifyObjectDestroyed(s, b2ObjectType::POLYGON_SHAPE, "b2PolygonShape");
|
||||
s->~b2PolygonShape();
|
||||
allocator->Free(s, sizeof(b2PolygonShape));
|
||||
}
|
||||
@@ -106,6 +110,7 @@ void b2Fixture::Destroy(b2BlockAllocator* allocator)
|
||||
case b2Shape::e_chain:
|
||||
{
|
||||
b2ChainShape* s = (b2ChainShape*)m_shape;
|
||||
b2NotifyObjectDestroyed(s, b2ObjectType::CHAIN_SHAPE, "b2ChainShape");
|
||||
s->~b2ChainShape();
|
||||
allocator->Free(s, sizeof(b2ChainShape));
|
||||
}
|
||||
@@ -117,6 +122,8 @@ void b2Fixture::Destroy(b2BlockAllocator* allocator)
|
||||
}
|
||||
|
||||
m_shape = NULL;
|
||||
|
||||
b2NotifyObjectDestroyed(this, b2ObjectType::FIXTURE, "b2Fixture");
|
||||
}
|
||||
|
||||
void b2Fixture::CreateProxies(b2BroadPhase* broadPhase, const b2Transform& xf)
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
#include <Box2D/Collision/b2TimeOfImpact.h>
|
||||
#include <Box2D/Common/b2Draw.h>
|
||||
#include <Box2D/Common/b2Timer.h>
|
||||
#include <Box2D/b2ObjectDestroyNotifier.h>
|
||||
#include <new>
|
||||
|
||||
b2World::b2World(const b2Vec2& gravity)
|
||||
@@ -205,6 +206,7 @@ void b2World::DestroyBody(b2Body* b)
|
||||
}
|
||||
|
||||
--m_bodyCount;
|
||||
b2NotifyObjectDestroyed(b, b2ObjectType::BODY, "b2Body");
|
||||
b->~b2Body();
|
||||
m_blockAllocator.Free(b, sizeof(b2Body));
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
#include "b2ObjectDestroyNotifier.h"
|
||||
|
||||
static b2ObjectDestroyNotifer __objectDestroyNotifier = nullptr;
|
||||
|
||||
void b2SetObjectDestroyNotifier(b2ObjectDestroyNotifer notifier)
|
||||
{
|
||||
__objectDestroyNotifier = notifier;
|
||||
}
|
||||
|
||||
void b2NotifyObjectDestroyed(void* obj, b2ObjectType type, const char* typeName)
|
||||
{
|
||||
if (__objectDestroyNotifier != nullptr)
|
||||
{
|
||||
__objectDestroyNotifier(obj, type, typeName);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
#pragma once
|
||||
|
||||
enum class b2ObjectType
|
||||
{
|
||||
CONTACT,
|
||||
CIRCLE_SHAPE,
|
||||
EDGE_SHAPE,
|
||||
POLYGON_SHAPE,
|
||||
CHAIN_SHAPE,
|
||||
FIXTURE,
|
||||
JOIN,
|
||||
BODY
|
||||
};
|
||||
|
||||
typedef void (*b2ObjectDestroyNotifer)(void*, b2ObjectType, const char*);
|
||||
|
||||
void b2SetObjectDestroyNotifier(b2ObjectDestroyNotifer notifier);
|
||||
void b2NotifyObjectDestroyed(void* obj, b2ObjectType type, const char* typeName);
|
||||
Reference in New Issue
Block a user