diff --git a/projects/kiwano/kiwano.vcxproj b/projects/kiwano/kiwano.vcxproj
index ee563d2b..a8e1dbe0 100644
--- a/projects/kiwano/kiwano.vcxproj
+++ b/projects/kiwano/kiwano.vcxproj
@@ -18,6 +18,7 @@
+
@@ -52,7 +53,7 @@
-
+
diff --git a/projects/kiwano/kiwano.vcxproj.filters b/projects/kiwano/kiwano.vcxproj.filters
index 95c61c79..fd77980d 100644
--- a/projects/kiwano/kiwano.vcxproj.filters
+++ b/projects/kiwano/kiwano.vcxproj.filters
@@ -348,10 +348,13 @@
2d\action
-
+
+ base
+
+
core
-
+
base
diff --git a/src/kiwano-audio/Sound.cpp b/src/kiwano-audio/Sound.cpp
index c8da50d7..f04421c4 100644
--- a/src/kiwano-audio/Sound.cpp
+++ b/src/kiwano-audio/Sound.cpp
@@ -27,26 +27,16 @@ namespace kiwano
{
namespace audio
{
-SoundPtr Sound::Create(const String& file_path)
+Sound::Sound(const String& file_path)
+ : Sound()
{
- SoundPtr ptr = new (autogc) Sound;
- if (ptr)
- {
- if (!ptr->Load(file_path))
- return nullptr;
- }
- return ptr;
+ Load(file_path);
}
-SoundPtr Sound::Create(const Resource& res)
+Sound::Sound(const Resource& res)
+ : Sound()
{
- SoundPtr ptr = new (autogc) Sound;
- if (ptr)
- {
- if (!ptr->Load(res))
- return nullptr;
- }
- return ptr;
+ Load(res);
}
Sound::Sound()
diff --git a/src/kiwano-audio/Sound.h b/src/kiwano-audio/Sound.h
index 299d9083..ebd2ce84 100644
--- a/src/kiwano-audio/Sound.h
+++ b/src/kiwano-audio/Sound.h
@@ -50,12 +50,12 @@ public:
/// \~chinese
/// @brief 创建音频对象
/// @param res 本地音频文件路径
- static SoundPtr Create(const String& file_path);
+ Sound(const String& file_path);
/// \~chinese
/// @brief 创建音频对象
/// @param res 音频资源
- static SoundPtr Create(const Resource& res);
+ Sound(const Resource& res);
Sound();
diff --git a/src/kiwano-audio/SoundPlayer.cpp b/src/kiwano-audio/SoundPlayer.cpp
index 31efc911..bfe7a562 100644
--- a/src/kiwano-audio/SoundPlayer.cpp
+++ b/src/kiwano-audio/SoundPlayer.cpp
@@ -25,12 +25,6 @@ namespace kiwano
namespace audio
{
-SoundPlayerPtr SoundPlayer::Create()
-{
- SoundPlayerPtr ptr = new (autogc) SoundPlayer;
- return ptr;
-}
-
SoundPlayer::SoundPlayer()
: volume_(1.f)
{
@@ -47,7 +41,7 @@ size_t SoundPlayer::Load(const String& file_path)
if (sound_cache_.end() != sound_cache_.find(hash))
return hash;
- SoundPtr sound = new (autogc) Sound;
+ SoundPtr sound = MakePtr();
if (sound)
{
if (sound->Load(file_path))
@@ -66,7 +60,7 @@ size_t SoundPlayer::Load(const Resource& res)
if (sound_cache_.end() != sound_cache_.find(hash_code))
return hash_code;
- SoundPtr sound = new (autogc) Sound;
+ SoundPtr sound = MakePtr();
if (sound)
{
diff --git a/src/kiwano-audio/SoundPlayer.h b/src/kiwano-audio/SoundPlayer.h
index 789c66b5..d9ae2719 100644
--- a/src/kiwano-audio/SoundPlayer.h
+++ b/src/kiwano-audio/SoundPlayer.h
@@ -40,10 +40,6 @@ KGE_DECLARE_SMART_PTR(SoundPlayer);
class KGE_API SoundPlayer : public ObjectBase
{
public:
- /// \~chinese
- /// @brief 创建音频播放器
- static SoundPlayerPtr Create();
-
SoundPlayer();
~SoundPlayer();
diff --git a/src/kiwano-imgui/ImGuiLayer.cpp b/src/kiwano-imgui/ImGuiLayer.cpp
index 68b2d161..128f28d2 100644
--- a/src/kiwano-imgui/ImGuiLayer.cpp
+++ b/src/kiwano-imgui/ImGuiLayer.cpp
@@ -25,27 +25,17 @@ namespace kiwano
namespace imgui
{
-ImGuiLayerPtr ImGuiLayer::Create()
-{
- ImGuiLayerPtr ptr = new (autogc) ImGuiLayer;
- return ptr;
-}
-
-ImGuiLayerPtr ImGuiLayer::Create(const String& name, const ImGuiPipeline& item)
-{
- ImGuiLayerPtr ptr = new (autogc) ImGuiLayer;
- if (ptr)
- {
- ptr->AddItem(name, item);
- }
- return ptr;
-}
-
ImGuiLayer::ImGuiLayer()
{
SetSwallowEvents(true);
}
+ImGuiLayer::ImGuiLayer(const String& name, const ImGuiPipeline& item)
+ : ImGuiLayer()
+{
+ AddItem(name, item);
+}
+
ImGuiLayer::~ImGuiLayer() {}
void ImGuiLayer::OnRender(RenderContext& ctx)
diff --git a/src/kiwano-imgui/ImGuiLayer.h b/src/kiwano-imgui/ImGuiLayer.h
index 67417f42..1d52d5ae 100644
--- a/src/kiwano-imgui/ImGuiLayer.h
+++ b/src/kiwano-imgui/ImGuiLayer.h
@@ -38,17 +38,13 @@ using ImGuiPipeline = Function;
class ImGuiLayer : public LayerActor
{
public:
- /// \~chinese
- /// @brief 创建ImGui图层
- static ImGuiLayerPtr Create();
+ ImGuiLayer();
/// \~chinese
/// @brief 创建ImGui图层
/// @param name 元素名称
/// @param item 管道
- static ImGuiLayerPtr Create(const String& name, const ImGuiPipeline& item);
-
- ImGuiLayer();
+ ImGuiLayer(const String& name, const ImGuiPipeline& item);
virtual ~ImGuiLayer();
diff --git a/src/kiwano-network/HttpModule.cpp b/src/kiwano-network/HttpModule.cpp
index ab1d9f88..83f16e69 100644
--- a/src/kiwano-network/HttpModule.cpp
+++ b/src/kiwano-network/HttpModule.cpp
@@ -253,7 +253,7 @@ void HttpModule::NetworkThread()
return;
}
- HttpResponsePtr response = new (autogc) HttpResponse(request);
+ HttpResponsePtr response = MakePtr(request);
Perform(request, response);
response_mutex_.lock();
diff --git a/src/kiwano-network/HttpRequest.cpp b/src/kiwano-network/HttpRequest.cpp
index 18ef0abf..923a72d7 100644
--- a/src/kiwano-network/HttpRequest.cpp
+++ b/src/kiwano-network/HttpRequest.cpp
@@ -26,42 +26,23 @@ namespace kiwano
namespace network
{
-HttpRequestPtr HttpRequest::Create(const String& url, HttpType type, const ResponseCallback& callback)
+HttpRequest::HttpRequest(const String& url, HttpType type, const ResponseCallback& callback)
+ : type_(type)
+ , url_(url)
+ , response_cb_(callback)
{
- HttpRequestPtr ptr = new (autogc) HttpRequest;
- if (ptr)
- {
- ptr->SetUrl(url);
- ptr->SetType(type);
- ptr->SetResponseCallback(callback);
- }
- return ptr;
}
-HttpRequestPtr HttpRequest::Create(const String& url, HttpType type, const String& data, const ResponseCallback& callback)
+HttpRequest::HttpRequest(const String& url, HttpType type, const String& data, const ResponseCallback& callback)
+ : HttpRequest(url, type, callback)
{
- HttpRequestPtr ptr = new (autogc) HttpRequest;
- if (ptr)
- {
- ptr->SetUrl(url);
- ptr->SetType(type);
- ptr->SetData(data);
- ptr->SetResponseCallback(callback);
- }
- return ptr;
+ SetData(data);
}
-HttpRequestPtr HttpRequest::Create(const String& url, HttpType type, const Json& json, const ResponseCallback& callback)
+HttpRequest::HttpRequest(const String& url, HttpType type, const Json& json, const ResponseCallback& callback)
+ : HttpRequest(url, type, callback)
{
- HttpRequestPtr ptr = new (autogc) HttpRequest;
- if (ptr)
- {
- ptr->SetUrl(url);
- ptr->SetType(type);
- ptr->SetJsonData(json);
- ptr->SetResponseCallback(callback);
- }
- return ptr;
+ SetJsonData(json);
}
void HttpRequest::SetJsonData(const Json& json)
diff --git a/src/kiwano-network/HttpRequest.h b/src/kiwano-network/HttpRequest.h
index 1760c3ea..51203b7a 100644
--- a/src/kiwano-network/HttpRequest.h
+++ b/src/kiwano-network/HttpRequest.h
@@ -63,7 +63,7 @@ public:
/// @param url 请求地址
/// @param type 请求类型
/// @param callback 响应回调函数
- static HttpRequestPtr Create(const String& url, HttpType type, const ResponseCallback& callback);
+ HttpRequest(const String& url, HttpType type, const ResponseCallback& callback);
/// \~chinese
/// @brief 创建HTTP请求
@@ -71,7 +71,7 @@ public:
/// @param type 请求类型
/// @param data 请求数据
/// @param callback 响应回调函数
- static HttpRequestPtr Create(const String& url, HttpType type, const String& data, const ResponseCallback& callback);
+ HttpRequest(const String& url, HttpType type, const String& data, const ResponseCallback& callback);
/// \~chinese
/// @brief 创建HTTP请求
@@ -79,12 +79,10 @@ public:
/// @param type 请求类型
/// @param json 请求的JSON数据
/// @param callback 响应回调函数
- static HttpRequestPtr Create(const String& url, HttpType type, const Json& json, const ResponseCallback& callback);
+ HttpRequest(const String& url, HttpType type, const Json& json, const ResponseCallback& callback);
HttpRequest();
- HttpRequest(HttpType type);
-
/// \~chinese
/// @brief 设置请求地址
void SetUrl(const String& url);
@@ -152,11 +150,6 @@ inline HttpRequest::HttpRequest()
{
}
-inline HttpRequest::HttpRequest(HttpType type)
- : type_(type)
-{
-}
-
inline void HttpRequest::SetUrl(const String& url)
{
url_ = url;
diff --git a/src/kiwano-physics/Fixture.cpp b/src/kiwano-physics/Fixture.cpp
index d6e14cbd..ca217610 100644
--- a/src/kiwano-physics/Fixture.cpp
+++ b/src/kiwano-physics/Fixture.cpp
@@ -29,7 +29,7 @@ namespace physics
FixturePtr Fixture::CreateCircle(const Param& param, float radius, const Point& offset)
{
- FixturePtr ptr = new (autogc) Fixture;
+ FixturePtr ptr = MakePtr();
if (ptr)
{
auto shape = std::make_unique();
@@ -44,7 +44,7 @@ FixturePtr Fixture::CreateCircle(const Param& param, float radius, const Point&
FixturePtr Fixture::CreateRect(const Param& param, const Size& size, const Point& offset, float rotation)
{
- FixturePtr ptr = new (autogc) Fixture;
+ FixturePtr ptr = MakePtr();
if (ptr)
{
b2Vec2 b2size = global::LocalToWorld(size);
@@ -61,7 +61,7 @@ FixturePtr Fixture::CreateRect(const Param& param, const Size& size, const Point
FixturePtr Fixture::CreatePolygon(const Param& param, const Vector& vertexs)
{
- FixturePtr ptr = new (autogc) Fixture;
+ FixturePtr ptr = MakePtr();
if (ptr)
{
Vector b2vertexs;
@@ -82,7 +82,7 @@ FixturePtr Fixture::CreatePolygon(const Param& param, const Vector& verte
FixturePtr Fixture::CreateEdge(const Param& param, const Point& p1, const Point& p2)
{
- FixturePtr ptr = new (autogc) Fixture;
+ FixturePtr ptr = MakePtr();
if (ptr)
{
b2Vec2 start = global::LocalToWorld(p1);
@@ -99,7 +99,7 @@ FixturePtr Fixture::CreateEdge(const Param& param, const Point& p1, const Point&
FixturePtr Fixture::CreateChain(const Param& param, const Vector& vertices, bool loop)
{
- FixturePtr ptr = new (autogc) Fixture;
+ FixturePtr ptr = MakePtr();
if (ptr)
{
Vector b2vertices;
diff --git a/src/kiwano-physics/Joint.cpp b/src/kiwano-physics/Joint.cpp
index 220d3d29..6c3d06ae 100644
--- a/src/kiwano-physics/Joint.cpp
+++ b/src/kiwano-physics/Joint.cpp
@@ -107,18 +107,9 @@ void Joint::Destroy()
// DistanceJoint
//
-DistanceJointPtr DistanceJoint::Create(const Param& param)
-{
- DistanceJointPtr ptr = new (autogc) DistanceJoint;
- if (ptr)
- {
- ptr->param_ = param;
- }
- return ptr;
-}
-
-DistanceJoint::DistanceJoint()
- : raw_joint_(nullptr)
+DistanceJoint::DistanceJoint(const Param& param)
+ : param_(param)
+ , raw_joint_(nullptr)
{
}
@@ -154,18 +145,9 @@ float DistanceJoint::GetLength() const
// FrictionJoint
//
-FrictionJointPtr FrictionJoint::Create(const Param& param)
-{
- FrictionJointPtr ptr = new (autogc) FrictionJoint;
- if (ptr)
- {
- ptr->param_ = param;
- }
- return ptr;
-}
-
-FrictionJoint::FrictionJoint()
- : raw_joint_(nullptr)
+FrictionJoint::FrictionJoint(const Param& param)
+ : param_(param)
+ , raw_joint_(nullptr)
{
}
@@ -212,18 +194,9 @@ float FrictionJoint::GetMaxTorque() const
// GearJoint
//
-GearJointPtr GearJoint::Create(const Param& param)
-{
- GearJointPtr ptr = new (autogc) GearJoint;
- if (ptr)
- {
- ptr->param_ = param;
- }
- return ptr;
-}
-
-GearJoint::GearJoint()
- : raw_joint_(nullptr)
+GearJoint::GearJoint(const Param& param)
+ : param_(param)
+ , raw_joint_(nullptr)
{
}
@@ -258,18 +231,9 @@ float GearJoint::GetRatio() const
// MotorJoint
//
-MotorJointPtr MotorJoint::Create(const Param& param)
-{
- MotorJointPtr ptr = new (autogc) MotorJoint;
- if (ptr)
- {
- ptr->param_ = param;
- }
- return ptr;
-}
-
-MotorJoint::MotorJoint()
- : raw_joint_(nullptr)
+MotorJoint::MotorJoint(const Param& param)
+ : param_(param)
+ , raw_joint_(nullptr)
{
}
@@ -317,18 +281,9 @@ float MotorJoint::GetMaxTorque() const
// PrismaticJoint
//
-PrismaticJointPtr PrismaticJoint::Create(const Param& param)
-{
- PrismaticJointPtr ptr = new (autogc) PrismaticJoint;
- if (ptr)
- {
- ptr->param_ = param;
- }
- return ptr;
-}
-
-PrismaticJoint::PrismaticJoint()
- : raw_joint_(nullptr)
+PrismaticJoint::PrismaticJoint(const Param& param)
+ : param_(param)
+ , raw_joint_(nullptr)
{
}
@@ -386,18 +341,9 @@ void PrismaticJoint::SetLimits(float lower, float upper)
// PulleyJoint
//
-PulleyJointPtr PulleyJoint::Create(const Param& param)
-{
- PulleyJointPtr ptr = new (autogc) PulleyJoint;
- if (ptr)
- {
- ptr->param_ = param;
- }
- return ptr;
-}
-
-PulleyJoint::PulleyJoint()
- : raw_joint_(nullptr)
+PulleyJoint::PulleyJoint(const Param& param)
+ : param_(param)
+ , raw_joint_(nullptr)
{
}
@@ -462,18 +408,9 @@ float PulleyJoint::GetCurrentLengthB() const
// RevoluteJoint
//
-RevoluteJointPtr RevoluteJoint::Create(const Param& param)
-{
- RevoluteJointPtr ptr = new (autogc) RevoluteJoint;
- if (ptr)
- {
- ptr->param_ = param;
- }
- return ptr;
-}
-
-RevoluteJoint::RevoluteJoint()
- : raw_joint_(nullptr)
+RevoluteJoint::RevoluteJoint(const Param& param)
+ : param_(param)
+ , raw_joint_(nullptr)
{
}
@@ -542,18 +479,9 @@ float RevoluteJoint::GetMaxMotorTorque() const
// RopeJoint
//
-RopeJointPtr RopeJoint::Create(const Param& param)
-{
- RopeJointPtr ptr = new (autogc) RopeJoint;
- if (ptr)
- {
- ptr->param_ = param;
- }
- return ptr;
-}
-
-RopeJoint::RopeJoint()
- : raw_joint_(nullptr)
+RopeJoint::RopeJoint(const Param& param)
+ : param_(param)
+ , raw_joint_(nullptr)
{
}
@@ -590,18 +518,9 @@ float RopeJoint::GetMaxLength() const
// WeldJoint
//
-WeldJointPtr WeldJoint::Create(const Param& param)
-{
- WeldJointPtr ptr = new (autogc) WeldJoint;
- if (ptr)
- {
- ptr->param_ = param;
- }
- return ptr;
-}
-
-WeldJoint::WeldJoint()
- : raw_joint_(nullptr)
+WeldJoint::WeldJoint(const Param& param)
+ : param_(param)
+ , raw_joint_(nullptr)
{
}
@@ -624,18 +543,9 @@ bool WeldJoint::Init(PhysicWorld* world)
// WheelJoint
//
-WheelJointPtr WheelJoint::Create(const Param& param)
-{
- WheelJointPtr ptr = new (autogc) WheelJoint;
- if (ptr)
- {
- ptr->param_ = param;
- }
- return ptr;
-}
-
-WheelJoint::WheelJoint()
- : raw_joint_(nullptr)
+WheelJoint::WheelJoint(const Param& param)
+ : param_(param)
+ , raw_joint_(nullptr)
{
}
@@ -686,18 +596,9 @@ float WheelJoint::GetMaxMotorTorque() const
// MouseJoint
//
-MouseJointPtr MouseJoint::Create(const Param& param)
-{
- MouseJointPtr ptr = new (autogc) MouseJoint;
- if (ptr)
- {
- ptr->param_ = param;
- }
- return ptr;
-}
-
-MouseJoint::MouseJoint()
- : raw_joint_(nullptr)
+MouseJoint::MouseJoint(const Param& param)
+ : param_(param)
+ , raw_joint_(nullptr)
{
}
diff --git a/src/kiwano-physics/Joint.h b/src/kiwano-physics/Joint.h
index afd9c152..059f5812 100644
--- a/src/kiwano-physics/Joint.h
+++ b/src/kiwano-physics/Joint.h
@@ -161,9 +161,7 @@ public:
/// \~chinese
/// @brief 创建固定距离关节
/// @param param 关节参数
- static DistanceJointPtr Create(const Param& param);
-
- DistanceJoint();
+ DistanceJoint(const Param& param);
/// \~chinese
/// @brief 初始化关节
@@ -226,9 +224,7 @@ public:
/// \~chinese
/// @brief 创建摩擦关节
/// @param param 关节参数
- static FrictionJointPtr Create(const Param& param);
-
- FrictionJoint();
+ FrictionJoint(const Param& param);
/// \~chinese
/// @brief 初始化关节
@@ -285,9 +281,7 @@ public:
/// \~chinese
/// @brief 创建齿轮关节
/// @param param 关节参数
- static GearJointPtr Create(const Param& param);
-
- GearJoint();
+ GearJoint(const Param& param);
/// \~chinese
/// @brief 初始化关节
@@ -336,9 +330,7 @@ public:
/// \~chinese
/// @brief 创建马达关节
/// @param param 关节参数
- static MotorJointPtr Create(const Param& param);
-
- MotorJoint();
+ MotorJoint(const Param& param);
/// \~chinese
/// @brief 初始化关节
@@ -405,9 +397,7 @@ public:
/// \~chinese
/// @brief 创建平移关节
/// @param param 关节参数
- static PrismaticJointPtr Create(const Param& param);
-
- PrismaticJoint();
+ PrismaticJoint(const Param& param);
/// \~chinese
/// @brief 初始化关节
@@ -509,9 +499,7 @@ public:
/// \~chinese
/// @brief 创建滑轮关节
/// @param param 关节参数
- static PulleyJointPtr Create(const Param& param);
-
- PulleyJoint();
+ PulleyJoint(const Param& param);
/// \~chinese
/// @brief 初始化关节
@@ -588,9 +576,7 @@ public:
/// \~chinese
/// @brief 创建旋转关节
/// @param param 关节参数
- static RevoluteJointPtr Create(const Param& param);
-
- RevoluteJoint();
+ RevoluteJoint(const Param& param);
/// \~chinese
/// @brief 初始化关节
@@ -687,9 +673,7 @@ public:
/// \~chinese
/// @brief 创建绳关节
/// @param param 关节参数
- static RopeJointPtr Create(const Param& param);
-
- RopeJoint();
+ RopeJoint(const Param& param);
/// \~chinese
/// @brief 初始化关节
@@ -738,9 +722,7 @@ public:
/// \~chinese
/// @brief 创建焊接关节
/// @param param 关节参数
- static WeldJointPtr Create(const Param& param);
-
- WeldJoint();
+ WeldJoint(const Param& param);
/// \~chinese
/// @brief 初始化关节
@@ -809,9 +791,7 @@ public:
/// \~chinese
/// @brief 创建轮关节
/// @param param 关节参数
- static WheelJointPtr Create(const Param& param);
-
- WheelJoint();
+ WheelJoint(const Param& param);
/// \~chinese
/// @brief 初始化关节
@@ -911,9 +891,7 @@ public:
/// \~chinese
/// @brief 创建鼠标关节
/// @param param 关节参数
- static MouseJointPtr Create(const Param& param);
-
- MouseJoint();
+ MouseJoint(const Param& param);
/// \~chinese
/// @brief 初始化关节
diff --git a/src/kiwano-physics/PhysicBody.cpp b/src/kiwano-physics/PhysicBody.cpp
index 770b7101..b5da59d7 100644
--- a/src/kiwano-physics/PhysicBody.cpp
+++ b/src/kiwano-physics/PhysicBody.cpp
@@ -28,37 +28,20 @@ namespace kiwano
namespace physics
{
-PhysicBodyPtr PhysicBody::Create(PhysicWorldPtr world, Type type)
-{
- return PhysicBody::Create(world.Get(), type);
-}
-
-PhysicBodyPtr PhysicBody::Create(PhysicWorld* world, Type type)
-{
- KGE_ASSERT(world);
-
- PhysicBodyPtr ptr = new (autogc) PhysicBody;
- if (ptr)
- {
- ptr->SetType(type);
- if (ptr->Init(world))
- {
- world->AddBody(ptr);
- return ptr;
- }
- }
- return nullptr;
-}
-
-PhysicBody::PhysicBody()
+PhysicBody::PhysicBody(PhysicWorld* world, Type type)
: body_(nullptr)
- , world_(nullptr)
+ , world_(world)
, type_(Type::Static)
, category_bits_(0x0001)
, mask_bits_(0xFFFF)
, group_index_(0)
{
SetName(KGE_PHYSIC_COMP_NAME);
+
+ if (Init(world))
+ {
+ world->AddBody(this);
+ }
}
PhysicBody::~PhysicBody() {}
@@ -88,11 +71,6 @@ void PhysicBody::DestroyComponent()
}
}
-bool PhysicBody::Init(PhysicWorldPtr world)
-{
- return Init(world.Get());
-}
-
bool PhysicBody::Init(PhysicWorld* world)
{
KGE_ASSERT(body_ == nullptr);
diff --git a/src/kiwano-physics/PhysicBody.h b/src/kiwano-physics/PhysicBody.h
index 875e4a8a..296193b5 100644
--- a/src/kiwano-physics/PhysicBody.h
+++ b/src/kiwano-physics/PhysicBody.h
@@ -54,23 +54,10 @@ public:
/// @brief 初始化物体
/// @param world 物理世界
/// @param type 物体类型
- static PhysicBodyPtr Create(PhysicWorldPtr world, Type type);
-
- /// \~chinese
- /// @brief 初始化物体
- /// @param world 物理世界
- /// @param type 物体类型
- static PhysicBodyPtr Create(PhysicWorld* world, Type type);
-
- PhysicBody();
+ PhysicBody(PhysicWorld* world, Type type);
virtual ~PhysicBody();
- /// \~chinese
- /// @brief 初始化物体
- /// @param[in] world 物理世界
- bool Init(PhysicWorldPtr world);
-
/// \~chinese
/// @brief 初始化物体
/// @param[in] world 物理世界
diff --git a/src/kiwano-physics/PhysicWorld.cpp b/src/kiwano-physics/PhysicWorld.cpp
index b712a343..acdd9ce4 100644
--- a/src/kiwano-physics/PhysicWorld.cpp
+++ b/src/kiwano-physics/PhysicWorld.cpp
@@ -31,11 +31,11 @@ class PhysicWorld::DebugDrawer : public b2Draw
public:
DebugDrawer(const Size& size)
{
- canvas_ = Canvas::Create(size);
+ canvas_ = MakePtr