Refactoring : GC 机制重做
This commit is contained in:
parent
83462faad0
commit
5f698fb475
|
|
@ -16,7 +16,7 @@ e2d::Animate::Animate(Animation * animation)
|
||||||
|
|
||||||
e2d::Animate::~Animate()
|
e2d::Animate::~Animate()
|
||||||
{
|
{
|
||||||
GC::GetInstance()->SafeRelease(animation_);
|
SafeRelease(animation_);
|
||||||
}
|
}
|
||||||
|
|
||||||
e2d::Animation * e2d::Animate::GetAnimation() const
|
e2d::Animation * e2d::Animate::GetAnimation() const
|
||||||
|
|
@ -26,11 +26,15 @@ e2d::Animation * e2d::Animate::GetAnimation() const
|
||||||
|
|
||||||
void e2d::Animate::SetAnimation(Animation * animation)
|
void e2d::Animate::SetAnimation(Animation * animation)
|
||||||
{
|
{
|
||||||
if (animation && animation != animation_ && !animation->GetFrames().empty())
|
if (animation && animation != animation_)
|
||||||
{
|
{
|
||||||
if (animation_) animation_->Release();
|
if (animation_)
|
||||||
|
{
|
||||||
|
animation_->Release();
|
||||||
|
}
|
||||||
animation_ = animation;
|
animation_ = animation;
|
||||||
animation_->Retain();
|
animation_->Retain();
|
||||||
|
frame_index_ = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -92,7 +96,7 @@ e2d::Animate * e2d::Animate::Clone() const
|
||||||
{
|
{
|
||||||
if (animation_)
|
if (animation_)
|
||||||
{
|
{
|
||||||
return new (e2d::autorelease) Animate(animation_);
|
return new Animate(animation_);
|
||||||
}
|
}
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
@ -104,7 +108,7 @@ e2d::Animate * e2d::Animate::Reverse() const
|
||||||
auto animation = animation_->Reverse();
|
auto animation = animation_->Reverse();
|
||||||
if (animation)
|
if (animation)
|
||||||
{
|
{
|
||||||
return new (e2d::autorelease) Animate(animation);
|
return new Animate(animation);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
|
||||||
|
|
@ -24,9 +24,9 @@ e2d::Animation::Animation(float interval, const Images& frames)
|
||||||
|
|
||||||
e2d::Animation::~Animation()
|
e2d::Animation::~Animation()
|
||||||
{
|
{
|
||||||
for (const auto& frame : frames_)
|
for (auto frame : frames_)
|
||||||
{
|
{
|
||||||
GC::GetInstance()->SafeRelease(frame);
|
SafeRelease(frame);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -65,7 +65,7 @@ const e2d::Animation::Images& e2d::Animation::GetFrames() const
|
||||||
|
|
||||||
e2d::Animation * e2d::Animation::Clone() const
|
e2d::Animation * e2d::Animation::Clone() const
|
||||||
{
|
{
|
||||||
auto animation = new (e2d::autorelease) Animation(interval_);
|
auto animation = new Animation(interval_);
|
||||||
if (animation)
|
if (animation)
|
||||||
{
|
{
|
||||||
for (const auto& frame : frames_)
|
for (const auto& frame : frames_)
|
||||||
|
|
@ -96,5 +96,5 @@ e2d::Animation * e2d::Animation::Reverse() const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return new (e2d::autorelease) Animation(this->GetInterval(), frames);
|
return new Animation(this->GetInterval(), frames);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,12 +7,12 @@ e2d::Callback::Callback(const Function& func) :
|
||||||
|
|
||||||
e2d::Callback * e2d::Callback::Clone() const
|
e2d::Callback * e2d::Callback::Clone() const
|
||||||
{
|
{
|
||||||
return new (e2d::autorelease) Callback(callback_);
|
return new Callback(callback_);
|
||||||
}
|
}
|
||||||
|
|
||||||
e2d::Callback * e2d::Callback::Reverse() const
|
e2d::Callback * e2d::Callback::Reverse() const
|
||||||
{
|
{
|
||||||
return new (e2d::autorelease) Callback(callback_);
|
return new Callback(callback_);
|
||||||
}
|
}
|
||||||
|
|
||||||
void e2d::Callback::Init()
|
void e2d::Callback::Init()
|
||||||
|
|
|
||||||
|
|
@ -8,12 +8,12 @@ e2d::Delay::Delay(float duration)
|
||||||
|
|
||||||
e2d::Delay * e2d::Delay::Clone() const
|
e2d::Delay * e2d::Delay::Clone() const
|
||||||
{
|
{
|
||||||
return new (e2d::autorelease) Delay(delay_);
|
return new Delay(delay_);
|
||||||
}
|
}
|
||||||
|
|
||||||
e2d::Delay * e2d::Delay::Reverse() const
|
e2d::Delay * e2d::Delay::Reverse() const
|
||||||
{
|
{
|
||||||
return new (e2d::autorelease) Delay(delay_);
|
return new Delay(delay_);
|
||||||
}
|
}
|
||||||
|
|
||||||
void e2d::Delay::Reset()
|
void e2d::Delay::Reset()
|
||||||
|
|
|
||||||
|
|
@ -11,12 +11,12 @@ e2d::JumpBy::JumpBy(float duration, const Point & vec, float height, int jumps)
|
||||||
|
|
||||||
e2d::JumpBy * e2d::JumpBy::Clone() const
|
e2d::JumpBy * e2d::JumpBy::Clone() const
|
||||||
{
|
{
|
||||||
return new (e2d::autorelease) JumpBy(duration_, delta_pos_, height_, jumps_);
|
return new JumpBy(duration_, delta_pos_, height_, jumps_);
|
||||||
}
|
}
|
||||||
|
|
||||||
e2d::JumpBy * e2d::JumpBy::Reverse() const
|
e2d::JumpBy * e2d::JumpBy::Reverse() const
|
||||||
{
|
{
|
||||||
return new (e2d::autorelease) JumpBy(duration_, -delta_pos_, height_, jumps_);
|
return new JumpBy(duration_, -delta_pos_, height_, jumps_);
|
||||||
}
|
}
|
||||||
|
|
||||||
void e2d::JumpBy::Init()
|
void e2d::JumpBy::Init()
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ e2d::JumpTo::JumpTo(float duration, const Point & pos, float height, int jumps)
|
||||||
|
|
||||||
e2d::JumpTo * e2d::JumpTo::Clone() const
|
e2d::JumpTo * e2d::JumpTo::Clone() const
|
||||||
{
|
{
|
||||||
return new (e2d::autorelease) JumpTo(duration_, end_pos_, height_, jumps_);
|
return new JumpTo(duration_, end_pos_, height_, jumps_);
|
||||||
}
|
}
|
||||||
|
|
||||||
void e2d::JumpTo::Init()
|
void e2d::JumpTo::Init()
|
||||||
|
|
|
||||||
|
|
@ -17,14 +17,14 @@ e2d::Loop::Loop(Action * action, int times /* = -1 */)
|
||||||
|
|
||||||
e2d::Loop::~Loop()
|
e2d::Loop::~Loop()
|
||||||
{
|
{
|
||||||
GC::GetInstance()->SafeRelease(action_);
|
SafeRelease(action_);
|
||||||
}
|
}
|
||||||
|
|
||||||
e2d::Loop * e2d::Loop::Clone() const
|
e2d::Loop * e2d::Loop::Clone() const
|
||||||
{
|
{
|
||||||
if (action_)
|
if (action_)
|
||||||
{
|
{
|
||||||
return new (e2d::autorelease) Loop(action_->Clone());
|
return new Loop(action_->Clone());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -36,7 +36,7 @@ e2d::Loop * e2d::Loop::Reverse() const
|
||||||
{
|
{
|
||||||
if (action_)
|
if (action_)
|
||||||
{
|
{
|
||||||
return new (e2d::autorelease) Loop(action_->Clone());
|
return new Loop(action_->Clone());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -37,10 +37,10 @@ void e2d::MoveBy::Update()
|
||||||
|
|
||||||
e2d::MoveBy * e2d::MoveBy::Clone() const
|
e2d::MoveBy * e2d::MoveBy::Clone() const
|
||||||
{
|
{
|
||||||
return new (e2d::autorelease) MoveBy(duration_, delta_pos_);
|
return new MoveBy(duration_, delta_pos_);
|
||||||
}
|
}
|
||||||
|
|
||||||
e2d::MoveBy * e2d::MoveBy::Reverse() const
|
e2d::MoveBy * e2d::MoveBy::Reverse() const
|
||||||
{
|
{
|
||||||
return new (e2d::autorelease) MoveBy(duration_, -delta_pos_);
|
return new MoveBy(duration_, -delta_pos_);
|
||||||
}
|
}
|
||||||
|
|
@ -9,7 +9,7 @@ e2d::MoveTo::MoveTo(float duration, Point pos)
|
||||||
|
|
||||||
e2d::MoveTo * e2d::MoveTo::Clone() const
|
e2d::MoveTo * e2d::MoveTo::Clone() const
|
||||||
{
|
{
|
||||||
return new (e2d::autorelease) MoveTo(duration_, end_pos_);
|
return new MoveTo(duration_, end_pos_);
|
||||||
}
|
}
|
||||||
|
|
||||||
void e2d::MoveTo::Init()
|
void e2d::MoveTo::Init()
|
||||||
|
|
|
||||||
|
|
@ -30,10 +30,10 @@ void e2d::OpacityBy::Update()
|
||||||
|
|
||||||
e2d::OpacityBy * e2d::OpacityBy::Clone() const
|
e2d::OpacityBy * e2d::OpacityBy::Clone() const
|
||||||
{
|
{
|
||||||
return new (e2d::autorelease) OpacityBy(duration_, delta_val_);
|
return new OpacityBy(duration_, delta_val_);
|
||||||
}
|
}
|
||||||
|
|
||||||
e2d::OpacityBy * e2d::OpacityBy::Reverse() const
|
e2d::OpacityBy * e2d::OpacityBy::Reverse() const
|
||||||
{
|
{
|
||||||
return new (e2d::autorelease) OpacityBy(duration_, -delta_val_);
|
return new OpacityBy(duration_, -delta_val_);
|
||||||
}
|
}
|
||||||
|
|
@ -10,7 +10,7 @@ e2d::OpacityTo::OpacityTo(float duration, float opacity)
|
||||||
|
|
||||||
e2d::OpacityTo * e2d::OpacityTo::Clone() const
|
e2d::OpacityTo * e2d::OpacityTo::Clone() const
|
||||||
{
|
{
|
||||||
return new (e2d::autorelease) OpacityTo(duration_, end_val_);
|
return new OpacityTo(duration_, end_val_);
|
||||||
}
|
}
|
||||||
|
|
||||||
void e2d::OpacityTo::Init()
|
void e2d::OpacityTo::Init()
|
||||||
|
|
|
||||||
|
|
@ -30,10 +30,10 @@ void e2d::RotateBy::Update()
|
||||||
|
|
||||||
e2d::RotateBy * e2d::RotateBy::Clone() const
|
e2d::RotateBy * e2d::RotateBy::Clone() const
|
||||||
{
|
{
|
||||||
return new (e2d::autorelease) RotateBy(duration_, delta_val_);
|
return new RotateBy(duration_, delta_val_);
|
||||||
}
|
}
|
||||||
|
|
||||||
e2d::RotateBy * e2d::RotateBy::Reverse() const
|
e2d::RotateBy * e2d::RotateBy::Reverse() const
|
||||||
{
|
{
|
||||||
return new (e2d::autorelease) RotateBy(duration_, -delta_val_);
|
return new RotateBy(duration_, -delta_val_);
|
||||||
}
|
}
|
||||||
|
|
@ -10,7 +10,7 @@ e2d::RotateTo::RotateTo(float duration, float rotation)
|
||||||
|
|
||||||
e2d::RotateTo * e2d::RotateTo::Clone() const
|
e2d::RotateTo * e2d::RotateTo::Clone() const
|
||||||
{
|
{
|
||||||
return new (e2d::autorelease) RotateTo(duration_, end_val_);
|
return new RotateTo(duration_, end_val_);
|
||||||
}
|
}
|
||||||
|
|
||||||
void e2d::RotateTo::Init()
|
void e2d::RotateTo::Init()
|
||||||
|
|
|
||||||
|
|
@ -39,10 +39,10 @@ void e2d::ScaleBy::Update()
|
||||||
|
|
||||||
e2d::ScaleBy * e2d::ScaleBy::Clone() const
|
e2d::ScaleBy * e2d::ScaleBy::Clone() const
|
||||||
{
|
{
|
||||||
return new (e2d::autorelease) ScaleBy(duration_, delta_x_, delta_y_);
|
return new ScaleBy(duration_, delta_x_, delta_y_);
|
||||||
}
|
}
|
||||||
|
|
||||||
e2d::ScaleBy * e2d::ScaleBy::Reverse() const
|
e2d::ScaleBy * e2d::ScaleBy::Reverse() const
|
||||||
{
|
{
|
||||||
return new (e2d::autorelease) ScaleBy(duration_, -delta_x_, -delta_y_);
|
return new ScaleBy(duration_, -delta_x_, -delta_y_);
|
||||||
}
|
}
|
||||||
|
|
@ -17,7 +17,7 @@ e2d::ScaleTo::ScaleTo(float duration, float scale_x, float scale_y)
|
||||||
|
|
||||||
e2d::ScaleTo * e2d::ScaleTo::Clone() const
|
e2d::ScaleTo * e2d::ScaleTo::Clone() const
|
||||||
{
|
{
|
||||||
return new (e2d::autorelease) ScaleTo(duration_, end_scale_x_, end_scale_y_);
|
return new ScaleTo(duration_, end_scale_x_, end_scale_y_);
|
||||||
}
|
}
|
||||||
|
|
||||||
void e2d::ScaleTo::Init()
|
void e2d::ScaleTo::Init()
|
||||||
|
|
|
||||||
|
|
@ -13,9 +13,9 @@ e2d::Sequence::Sequence(const Actions& actions)
|
||||||
|
|
||||||
e2d::Sequence::~Sequence()
|
e2d::Sequence::~Sequence()
|
||||||
{
|
{
|
||||||
for (const auto& action : actions_)
|
for (auto action : actions_)
|
||||||
{
|
{
|
||||||
GC::GetInstance()->SafeRelease(action);
|
SafeRelease(action);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -92,7 +92,7 @@ void e2d::Sequence::Add(const Actions& actions)
|
||||||
|
|
||||||
e2d::Sequence * e2d::Sequence::Clone() const
|
e2d::Sequence * e2d::Sequence::Clone() const
|
||||||
{
|
{
|
||||||
auto sequence = new (e2d::autorelease) Sequence();
|
auto sequence = new Sequence();
|
||||||
for (const auto& action : actions_)
|
for (const auto& action : actions_)
|
||||||
{
|
{
|
||||||
if (action)
|
if (action)
|
||||||
|
|
@ -105,7 +105,7 @@ e2d::Sequence * e2d::Sequence::Clone() const
|
||||||
|
|
||||||
e2d::Sequence * e2d::Sequence::Reverse() const
|
e2d::Sequence * e2d::Sequence::Reverse() const
|
||||||
{
|
{
|
||||||
auto sequence = new (e2d::autorelease) Sequence();
|
auto sequence = new Sequence();
|
||||||
if (sequence && !actions_.empty())
|
if (sequence && !actions_.empty())
|
||||||
{
|
{
|
||||||
std::vector<Action*> newActions(actions_.size());
|
std::vector<Action*> newActions(actions_.size());
|
||||||
|
|
|
||||||
|
|
@ -11,9 +11,9 @@ e2d::Spawn::Spawn(const Actions& actions)
|
||||||
|
|
||||||
e2d::Spawn::~Spawn()
|
e2d::Spawn::~Spawn()
|
||||||
{
|
{
|
||||||
for (const auto& action : actions_)
|
for (auto action : actions_)
|
||||||
{
|
{
|
||||||
GC::GetInstance()->SafeRelease(action);
|
SafeRelease(action);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -90,7 +90,7 @@ void e2d::Spawn::Add(const Actions& actions)
|
||||||
|
|
||||||
e2d::Spawn * e2d::Spawn::Clone() const
|
e2d::Spawn * e2d::Spawn::Clone() const
|
||||||
{
|
{
|
||||||
auto spawn = new (e2d::autorelease) Spawn();
|
auto spawn = new Spawn();
|
||||||
for (const auto& action : actions_)
|
for (const auto& action : actions_)
|
||||||
{
|
{
|
||||||
if (action)
|
if (action)
|
||||||
|
|
@ -103,7 +103,7 @@ e2d::Spawn * e2d::Spawn::Clone() const
|
||||||
|
|
||||||
e2d::Spawn * e2d::Spawn::Reverse() const
|
e2d::Spawn * e2d::Spawn::Reverse() const
|
||||||
{
|
{
|
||||||
auto spawn = new (e2d::autorelease) Spawn();
|
auto spawn = new Spawn();
|
||||||
if (spawn && !actions_.empty())
|
if (spawn && !actions_.empty())
|
||||||
{
|
{
|
||||||
std::vector<Action*> newActions(actions_.size());
|
std::vector<Action*> newActions(actions_.size());
|
||||||
|
|
|
||||||
|
|
@ -170,17 +170,6 @@ namespace e2d
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
template<class Interface>
|
|
||||||
inline void SafeRelease(Interface*& p)
|
|
||||||
{
|
|
||||||
if (p != nullptr)
|
|
||||||
{
|
|
||||||
p->Release();
|
|
||||||
p = nullptr;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
inline void ThrowIfFailed(HRESULT hr)
|
inline void ThrowIfFailed(HRESULT hr)
|
||||||
{
|
{
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
|
|
|
||||||
|
|
@ -376,26 +376,9 @@ namespace e2d
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// 垃圾回收池
|
// ŔŹťřťŘĘŐ
|
||||||
class GC
|
class GC
|
||||||
{
|
{
|
||||||
public:
|
|
||||||
// 获取 GC 实例
|
|
||||||
static GC * GetInstance();
|
|
||||||
|
|
||||||
// 自动释放
|
|
||||||
void AutoRelease(
|
|
||||||
Ref* ref
|
|
||||||
);
|
|
||||||
|
|
||||||
// 安全地释放对象
|
|
||||||
void SafeRelease(
|
|
||||||
Ref* ref
|
|
||||||
);
|
|
||||||
|
|
||||||
// 刷新内存池
|
|
||||||
void Flush();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
GC();
|
GC();
|
||||||
|
|
||||||
|
|
@ -403,10 +386,7 @@ namespace e2d
|
||||||
|
|
||||||
E2D_DISABLE_COPY(GC);
|
E2D_DISABLE_COPY(GC);
|
||||||
|
|
||||||
private:
|
static GC instance_;
|
||||||
bool notifyed_;
|
|
||||||
bool cleanup_;
|
|
||||||
std::set<Ref*> pool_;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -79,6 +79,11 @@ namespace e2d
|
||||||
// 获取 ID2D1Bitmap 对象
|
// 获取 ID2D1Bitmap 对象
|
||||||
ID2D1Bitmap * GetBitmap();
|
ID2D1Bitmap * GetBitmap();
|
||||||
|
|
||||||
|
// ÉèÖÃ Bitmap
|
||||||
|
void SetBitmap(
|
||||||
|
ID2D1Bitmap * bitmap
|
||||||
|
);
|
||||||
|
|
||||||
// 预加载图片资源
|
// 预加载图片资源
|
||||||
static bool Preload(
|
static bool Preload(
|
||||||
const String& file_name
|
const String& file_name
|
||||||
|
|
@ -95,11 +100,6 @@ namespace e2d
|
||||||
protected:
|
protected:
|
||||||
E2D_DISABLE_COPY(Image);
|
E2D_DISABLE_COPY(Image);
|
||||||
|
|
||||||
// ÉèÖÃ Bitmap
|
|
||||||
void SetBitmap(
|
|
||||||
ID2D1Bitmap * bitmap
|
|
||||||
);
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Rect crop_rect_;
|
Rect crop_rect_;
|
||||||
ID2D1Bitmap * bitmap_;
|
ID2D1Bitmap * bitmap_;
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,8 @@ namespace e2d
|
||||||
|
|
||||||
|
|
||||||
// 稜있
|
// 稜있
|
||||||
class Music
|
class Music :
|
||||||
|
public Ref
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Music();
|
Music();
|
||||||
|
|
|
||||||
|
|
@ -610,38 +610,31 @@ namespace e2d
|
||||||
virtual ~Ref();
|
virtual ~Ref();
|
||||||
|
|
||||||
// 增加引用计数
|
// 增加引用计数
|
||||||
void Retain();
|
LONG Retain();
|
||||||
|
|
||||||
// 减少引用计数
|
// 减少引用计数
|
||||||
void Release();
|
LONG Release();
|
||||||
|
|
||||||
// 获取引用计数
|
// 获取引用计数
|
||||||
int GetRefCount() const;
|
LONG GetRefCount() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
E2D_DISABLE_COPY(Ref);
|
E2D_DISABLE_COPY(Ref);
|
||||||
|
|
||||||
private:
|
protected:
|
||||||
int ref_count_;
|
LONG ref_count_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
template<class Interface>
|
||||||
|
inline void SafeRelease(Interface*& p)
|
||||||
|
{
|
||||||
|
if (p != nullptr)
|
||||||
|
{
|
||||||
|
p->Release();
|
||||||
|
p = nullptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
namespace e2d
|
|
||||||
{
|
|
||||||
struct autorelease_t { };
|
|
||||||
|
|
||||||
extern autorelease_t const autorelease;
|
|
||||||
}
|
|
||||||
|
|
||||||
void* operator new(
|
|
||||||
size_t size,
|
|
||||||
e2d::autorelease_t const&
|
|
||||||
) E2D_NOEXCEPT;
|
|
||||||
|
|
||||||
void operator delete(
|
|
||||||
void* block,
|
|
||||||
e2d::autorelease_t const&
|
|
||||||
) E2D_NOEXCEPT;
|
|
||||||
|
|
|
||||||
|
|
@ -1,55 +1,17 @@
|
||||||
#include "..\e2dmodule.h"
|
#include "..\e2dmodule.h"
|
||||||
#include "..\e2dtool.h"
|
#include "..\e2dtool.h"
|
||||||
#include "..\e2dmanager.h"
|
|
||||||
|
|
||||||
using namespace e2d;
|
|
||||||
|
|
||||||
e2d::autorelease_t const e2d::autorelease = e2d::autorelease_t();
|
|
||||||
|
|
||||||
void * operator new(size_t size, e2d::autorelease_t const &) E2D_NOEXCEPT
|
|
||||||
{
|
|
||||||
void* p = ::operator new(size, std::nothrow);
|
|
||||||
if (p)
|
|
||||||
{
|
|
||||||
GC::GetInstance()->AutoRelease(static_cast<Ref*>(p));
|
|
||||||
}
|
|
||||||
return p;
|
|
||||||
}
|
|
||||||
|
|
||||||
void operator delete(void * block, e2d::autorelease_t const &) E2D_NOEXCEPT
|
|
||||||
{
|
|
||||||
::operator delete (block, std::nothrow);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
e2d::GC * e2d::GC::GetInstance()
|
e2d::GC e2d::GC::instance_;
|
||||||
{
|
|
||||||
static GC instance_;
|
|
||||||
return &instance_;
|
|
||||||
}
|
|
||||||
|
|
||||||
e2d::GC::GC()
|
e2d::GC::GC()
|
||||||
: notifyed_(false)
|
|
||||||
, cleanup_(false)
|
|
||||||
, pool_()
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
e2d::GC::~GC()
|
e2d::GC::~GC()
|
||||||
{
|
{
|
||||||
// <20>뇜杰唐뚤蹶
|
|
||||||
cleanup_ = true;
|
|
||||||
for (const auto& ref : pool_)
|
|
||||||
{
|
|
||||||
delete ref;
|
|
||||||
}
|
|
||||||
pool_.clear();
|
|
||||||
cleanup_ = false;
|
|
||||||
|
|
||||||
// 헌뇜뻠닸
|
|
||||||
Image::ClearCache();
|
Image::ClearCache();
|
||||||
|
|
||||||
// 헌뇜데절
|
|
||||||
Player::DestroyInstance();
|
Player::DestroyInstance();
|
||||||
Audio::DestroyInstance();
|
Audio::DestroyInstance();
|
||||||
Renderer::DestroyInstance();
|
Renderer::DestroyInstance();
|
||||||
|
|
@ -57,43 +19,3 @@ e2d::GC::~GC()
|
||||||
Window::DestroyInstance();
|
Window::DestroyInstance();
|
||||||
Game::DestroyInstance();
|
Game::DestroyInstance();
|
||||||
}
|
}
|
||||||
|
|
||||||
void e2d::GC::Flush()
|
|
||||||
{
|
|
||||||
if (!notifyed_)
|
|
||||||
return;
|
|
||||||
|
|
||||||
notifyed_ = false;
|
|
||||||
for (auto iter = pool_.begin(); iter != pool_.end();)
|
|
||||||
{
|
|
||||||
if ((*iter)->GetRefCount() <= 0)
|
|
||||||
{
|
|
||||||
delete (*iter);
|
|
||||||
iter = pool_.erase(iter);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
++iter;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void e2d::GC::AutoRelease(Ref * ref)
|
|
||||||
{
|
|
||||||
if (ref)
|
|
||||||
{
|
|
||||||
pool_.insert(ref);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void e2d::GC::SafeRelease(Ref* ref)
|
|
||||||
{
|
|
||||||
if (cleanup_)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (ref)
|
|
||||||
{
|
|
||||||
ref->Release();
|
|
||||||
notifyed_ = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,10 @@ e2d::Game::Game()
|
||||||
|
|
||||||
e2d::Game::~Game()
|
e2d::Game::~Game()
|
||||||
{
|
{
|
||||||
|
SafeRelease(transition_);
|
||||||
|
SafeRelease(curr_scene_);
|
||||||
|
SafeRelease(next_scene_);
|
||||||
|
|
||||||
::CoUninitialize();
|
::CoUninitialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -75,7 +79,6 @@ void e2d::Game::Start()
|
||||||
|
|
||||||
DrawScene();
|
DrawScene();
|
||||||
window->Poll();
|
window->Poll();
|
||||||
GC::GetInstance()->Flush();
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -122,8 +125,10 @@ void e2d::Game::EnterScene(Scene * scene)
|
||||||
if (!scene)
|
if (!scene)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// 保存下一场景的指针
|
if (next_scene_)
|
||||||
if (next_scene_) next_scene_->Release();
|
{
|
||||||
|
next_scene_->Release();
|
||||||
|
}
|
||||||
next_scene_ = scene;
|
next_scene_ = scene;
|
||||||
next_scene_->Retain();
|
next_scene_->Retain();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,8 @@ e2d::Collider::Collider(Node * parent)
|
||||||
e2d::Collider::~Collider()
|
e2d::Collider::~Collider()
|
||||||
{
|
{
|
||||||
SafeRelease(geometry_);
|
SafeRelease(geometry_);
|
||||||
|
|
||||||
|
CollisionManager::GetInstance()->RemoveCollider(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
const e2d::Color& e2d::Collider::GetBorderColor() const
|
const e2d::Color& e2d::Collider::GetBorderColor() const
|
||||||
|
|
|
||||||
|
|
@ -42,6 +42,7 @@ e2d::Image::Image(const String & file_name, const Rect & crop_rect)
|
||||||
|
|
||||||
e2d::Image::~Image()
|
e2d::Image::~Image()
|
||||||
{
|
{
|
||||||
|
SafeRelease(bitmap_);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool e2d::Image::Open(const Resource& res)
|
bool e2d::Image::Open(const Resource& res)
|
||||||
|
|
@ -366,8 +367,18 @@ void e2d::Image::ClearCache()
|
||||||
|
|
||||||
void e2d::Image::SetBitmap(ID2D1Bitmap * bitmap)
|
void e2d::Image::SetBitmap(ID2D1Bitmap * bitmap)
|
||||||
{
|
{
|
||||||
|
if (bitmap_ == bitmap)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (bitmap_)
|
||||||
|
{
|
||||||
|
bitmap_->Release();
|
||||||
|
}
|
||||||
|
|
||||||
if (bitmap)
|
if (bitmap)
|
||||||
{
|
{
|
||||||
|
bitmap->AddRef();
|
||||||
|
|
||||||
bitmap_ = bitmap;
|
bitmap_ = bitmap;
|
||||||
crop_rect_.origin.x = crop_rect_.origin.y = 0;
|
crop_rect_.origin.x = crop_rect_.origin.y = 0;
|
||||||
crop_rect_.size.width = bitmap_->GetSize().width;
|
crop_rect_.size.width = bitmap_->GetSize().width;
|
||||||
|
|
|
||||||
|
|
@ -63,14 +63,14 @@ e2d::Node::~Node()
|
||||||
{
|
{
|
||||||
SafeRelease(border_);
|
SafeRelease(border_);
|
||||||
|
|
||||||
for (const auto& action : actions_)
|
for (auto action : actions_)
|
||||||
{
|
{
|
||||||
GC::GetInstance()->SafeRelease(action);
|
SafeRelease(action);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const auto& child : children_)
|
for (auto child : children_)
|
||||||
{
|
{
|
||||||
GC::GetInstance()->SafeRelease(child);
|
SafeRelease(child);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,25 +0,0 @@
|
||||||
#include "..\e2dobject.h"
|
|
||||||
|
|
||||||
e2d::Ref::Ref()
|
|
||||||
: ref_count_(0)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
e2d::Ref::~Ref()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void e2d::Ref::Retain()
|
|
||||||
{
|
|
||||||
ref_count_++;
|
|
||||||
}
|
|
||||||
|
|
||||||
void e2d::Ref::Release()
|
|
||||||
{
|
|
||||||
ref_count_--;
|
|
||||||
}
|
|
||||||
|
|
||||||
int e2d::Ref::GetRefCount() const
|
|
||||||
{
|
|
||||||
return ref_count_;
|
|
||||||
}
|
|
||||||
|
|
@ -20,8 +20,8 @@ e2d::Scene::~Scene()
|
||||||
{
|
{
|
||||||
if (root_)
|
if (root_)
|
||||||
{
|
{
|
||||||
root_->Release();
|
|
||||||
root_->SetParentScene(nullptr);
|
root_->SetParentScene(nullptr);
|
||||||
|
root_->Release();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -32,8 +32,8 @@ void e2d::Scene::SetRoot(Node * root)
|
||||||
|
|
||||||
if (root_)
|
if (root_)
|
||||||
{
|
{
|
||||||
root_->Release();
|
|
||||||
root_->SetParentScene(nullptr);
|
root_->SetParentScene(nullptr);
|
||||||
|
root_->Release();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (root)
|
if (root)
|
||||||
|
|
|
||||||
|
|
@ -40,14 +40,18 @@ e2d::Sprite::Sprite(const String & file_name, const Rect & crop_rect)
|
||||||
|
|
||||||
e2d::Sprite::~Sprite()
|
e2d::Sprite::~Sprite()
|
||||||
{
|
{
|
||||||
GC::GetInstance()->SafeRelease(image_);
|
SafeRelease(image_);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool e2d::Sprite::Open(Image * image)
|
bool e2d::Sprite::Open(Image * image)
|
||||||
{
|
{
|
||||||
if (image)
|
if (image)
|
||||||
{
|
{
|
||||||
if (image_) image_->Release();
|
if (image_)
|
||||||
|
{
|
||||||
|
image_->Release();
|
||||||
|
}
|
||||||
|
|
||||||
image_ = image;
|
image_ = image;
|
||||||
image_->Retain();
|
image_->Retain();
|
||||||
|
|
||||||
|
|
@ -61,7 +65,7 @@ bool e2d::Sprite::Open(const Resource& res)
|
||||||
{
|
{
|
||||||
if (!image_)
|
if (!image_)
|
||||||
{
|
{
|
||||||
image_ = new (e2d::autorelease) Image();
|
image_ = new Image();
|
||||||
image_->Retain();
|
image_->Retain();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -77,7 +81,7 @@ bool e2d::Sprite::Open(const String & file_name)
|
||||||
{
|
{
|
||||||
if (!image_)
|
if (!image_)
|
||||||
{
|
{
|
||||||
image_ = new (e2d::autorelease) Image();
|
image_ = new Image();
|
||||||
image_->Retain();
|
image_->Retain();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -174,60 +174,60 @@ e2d::File e2d::File::ShowOpenDialog(const String & title, const String & filter)
|
||||||
|
|
||||||
if (SUCCEEDED(hr))
|
if (SUCCEEDED(hr))
|
||||||
{
|
{
|
||||||
IFileOpenDialog *pFileOpen;
|
IFileOpenDialog *file_open;
|
||||||
|
|
||||||
hr = ::CoCreateInstance(CLSID_FileOpenDialog, NULL, CLSCTX_ALL,
|
hr = ::CoCreateInstance(CLSID_FileOpenDialog, NULL, CLSCTX_ALL,
|
||||||
IID_IFileOpenDialog, reinterpret_cast<void**>(&pFileOpen));
|
IID_IFileOpenDialog, reinterpret_cast<void**>(&file_open));
|
||||||
|
|
||||||
if (SUCCEEDED(hr))
|
if (SUCCEEDED(hr))
|
||||||
{
|
{
|
||||||
if (!title.IsEmpty())
|
if (!title.IsEmpty())
|
||||||
{
|
{
|
||||||
pFileOpen->SetTitle(LPCWSTR(title));
|
file_open->SetTitle(LPCWSTR(title));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!filter.IsEmpty())
|
if (!filter.IsEmpty())
|
||||||
{
|
{
|
||||||
COMDLG_FILTERSPEC rgSpec[] =
|
COMDLG_FILTERSPEC spec[] =
|
||||||
{
|
{
|
||||||
{ L"", LPCWSTR(filter) }
|
{ L"", LPCWSTR(filter) }
|
||||||
};
|
};
|
||||||
pFileOpen->SetFileTypes(1, rgSpec);
|
file_open->SetFileTypes(1, spec);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
COMDLG_FILTERSPEC rgSpec[] =
|
COMDLG_FILTERSPEC spec[] =
|
||||||
{
|
{
|
||||||
{ L"ËùÓÐÎļþ", L"*.*" }
|
{ L"ËùÓÐÎļþ", L"*.*" }
|
||||||
};
|
};
|
||||||
pFileOpen->SetFileTypes(1, rgSpec);
|
file_open->SetFileTypes(1, spec);
|
||||||
}
|
}
|
||||||
|
|
||||||
Game::GetInstance()->Pause();
|
Game::GetInstance()->Pause();
|
||||||
{
|
{
|
||||||
HWND hWnd = Window::GetInstance()->GetHWnd();
|
HWND hWnd = Window::GetInstance()->GetHWnd();
|
||||||
hr = pFileOpen->Show(hWnd);
|
hr = file_open->Show(hWnd);
|
||||||
}
|
}
|
||||||
Game::GetInstance()->Resume();
|
Game::GetInstance()->Resume();
|
||||||
|
|
||||||
if (SUCCEEDED(hr))
|
if (SUCCEEDED(hr))
|
||||||
{
|
{
|
||||||
IShellItem *pItem;
|
IShellItem *item;
|
||||||
hr = pFileOpen->GetResult(&pItem);
|
hr = file_open->GetResult(&item);
|
||||||
if (SUCCEEDED(hr))
|
if (SUCCEEDED(hr))
|
||||||
{
|
{
|
||||||
PWSTR pszFilePath;
|
PWSTR str_file_path;
|
||||||
hr = pItem->GetDisplayName(SIGDN_FILESYSPATH, &pszFilePath);
|
hr = item->GetDisplayName(SIGDN_FILESYSPATH, &str_file_path);
|
||||||
|
|
||||||
if (SUCCEEDED(hr))
|
if (SUCCEEDED(hr))
|
||||||
{
|
{
|
||||||
file_path = pszFilePath;
|
file_path = str_file_path;
|
||||||
::CoTaskMemFree(pszFilePath);
|
::CoTaskMemFree(str_file_path);
|
||||||
}
|
}
|
||||||
pItem->Release();
|
item->Release();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pFileOpen->Release();
|
file_open->Release();
|
||||||
}
|
}
|
||||||
::CoUninitialize();
|
::CoUninitialize();
|
||||||
}
|
}
|
||||||
|
|
@ -241,68 +241,68 @@ e2d::File e2d::File::ShowSaveDialog(const String & title, const String& def_file
|
||||||
|
|
||||||
if (SUCCEEDED(hr))
|
if (SUCCEEDED(hr))
|
||||||
{
|
{
|
||||||
IFileSaveDialog *pFileSave;
|
IFileSaveDialog *file_save;
|
||||||
|
|
||||||
hr = ::CoCreateInstance(CLSID_FileSaveDialog, NULL, CLSCTX_ALL,
|
hr = ::CoCreateInstance(CLSID_FileSaveDialog, NULL, CLSCTX_ALL,
|
||||||
IID_IFileSaveDialog, reinterpret_cast<void**>(&pFileSave));
|
IID_IFileSaveDialog, reinterpret_cast<void**>(&file_save));
|
||||||
|
|
||||||
if (SUCCEEDED(hr))
|
if (SUCCEEDED(hr))
|
||||||
{
|
{
|
||||||
if (!title.IsEmpty())
|
if (!title.IsEmpty())
|
||||||
{
|
{
|
||||||
pFileSave->SetTitle(LPCWSTR(title));
|
file_save->SetTitle(LPCWSTR(title));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!def_file.IsEmpty())
|
if (!def_file.IsEmpty())
|
||||||
{
|
{
|
||||||
pFileSave->SetFileName(LPCWSTR(def_file));
|
file_save->SetFileName(LPCWSTR(def_file));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!def_ext.IsEmpty())
|
if (!def_ext.IsEmpty())
|
||||||
{
|
{
|
||||||
pFileSave->SetDefaultExtension(LPCWSTR(def_ext));
|
file_save->SetDefaultExtension(LPCWSTR(def_ext));
|
||||||
|
|
||||||
String spec = L"*." + def_ext;
|
String ext = L"*." + def_ext;
|
||||||
COMDLG_FILTERSPEC rgSpec[] =
|
COMDLG_FILTERSPEC spec[] =
|
||||||
{
|
{
|
||||||
{ L"", LPCWSTR(spec) }
|
{ L"", LPCWSTR(ext) }
|
||||||
};
|
};
|
||||||
pFileSave->SetFileTypes(1, rgSpec);
|
file_save->SetFileTypes(1, spec);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
COMDLG_FILTERSPEC rgSpec[] =
|
COMDLG_FILTERSPEC spec[] =
|
||||||
{
|
{
|
||||||
{ L"ËùÓÐÎļþ", L"*.*" }
|
{ L"ËùÓÐÎļþ", L"*.*" }
|
||||||
};
|
};
|
||||||
pFileSave->SetFileTypes(1, rgSpec);
|
file_save->SetFileTypes(1, spec);
|
||||||
}
|
}
|
||||||
|
|
||||||
Game::GetInstance()->Pause();
|
Game::GetInstance()->Pause();
|
||||||
{
|
{
|
||||||
HWND hWnd = Window::GetInstance()->GetHWnd();
|
HWND hWnd = Window::GetInstance()->GetHWnd();
|
||||||
hr = pFileSave->Show(hWnd);
|
hr = file_save->Show(hWnd);
|
||||||
}
|
}
|
||||||
Game::GetInstance()->Resume();
|
Game::GetInstance()->Resume();
|
||||||
|
|
||||||
if (SUCCEEDED(hr))
|
if (SUCCEEDED(hr))
|
||||||
{
|
{
|
||||||
IShellItem *pItem;
|
IShellItem *item;
|
||||||
hr = pFileSave->GetResult(&pItem);
|
hr = file_save->GetResult(&item);
|
||||||
if (SUCCEEDED(hr))
|
if (SUCCEEDED(hr))
|
||||||
{
|
{
|
||||||
PWSTR pszFilePath;
|
PWSTR str_file_path;
|
||||||
hr = pItem->GetDisplayName(SIGDN_FILESYSPATH, &pszFilePath);
|
hr = item->GetDisplayName(SIGDN_FILESYSPATH, &str_file_path);
|
||||||
|
|
||||||
if (SUCCEEDED(hr))
|
if (SUCCEEDED(hr))
|
||||||
{
|
{
|
||||||
file_path = pszFilePath;
|
file_path = str_file_path;
|
||||||
::CoTaskMemFree(pszFilePath);
|
::CoTaskMemFree(str_file_path);
|
||||||
}
|
}
|
||||||
pItem->Release();
|
item->Release();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pFileSave->Release();
|
file_save->Release();
|
||||||
}
|
}
|
||||||
::CoUninitialize();
|
::CoUninitialize();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ e2d::Player::~Player()
|
||||||
{
|
{
|
||||||
for (const auto& pair : musics_)
|
for (const auto& pair : musics_)
|
||||||
{
|
{
|
||||||
delete pair.second;
|
pair.second->Release();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -44,11 +44,20 @@ bool e2d::Player::Preload(const String & file_path)
|
||||||
|
|
||||||
Music * music = new (std::nothrow) Music();
|
Music * music = new (std::nothrow) Music();
|
||||||
|
|
||||||
if (music && music->Open(file_path))
|
if (music)
|
||||||
{
|
{
|
||||||
music->SetVolume(volume_);
|
music->Retain();
|
||||||
musics_.insert(std::make_pair(file_path.GetHash(), music));
|
|
||||||
return true;
|
if (music->Open(file_path))
|
||||||
|
{
|
||||||
|
music->SetVolume(volume_);
|
||||||
|
musics_.insert(std::make_pair(file_path.GetHash(), music));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
music->Release();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -117,11 +126,20 @@ bool e2d::Player::Preload(const Resource& res)
|
||||||
|
|
||||||
Music * music = new (std::nothrow) Music();
|
Music * music = new (std::nothrow) Music();
|
||||||
|
|
||||||
if (music && music->Open(res))
|
if (music)
|
||||||
{
|
{
|
||||||
music->SetVolume(volume_);
|
music->Retain();
|
||||||
musics_.insert(std::make_pair(res.name, music));
|
|
||||||
return true;
|
if (music->Open(res))
|
||||||
|
{
|
||||||
|
music->SetVolume(volume_);
|
||||||
|
musics_.insert(std::make_pair(res.name, music));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
music->Release();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -22,8 +22,8 @@ e2d::Transition::~Transition()
|
||||||
{
|
{
|
||||||
SafeRelease(out_layer_);
|
SafeRelease(out_layer_);
|
||||||
SafeRelease(in_layer_);
|
SafeRelease(in_layer_);
|
||||||
GC::GetInstance()->SafeRelease(out_scene_);
|
SafeRelease(out_scene_);
|
||||||
GC::GetInstance()->SafeRelease(in_scene_);
|
SafeRelease(in_scene_);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool e2d::Transition::IsDone()
|
bool e2d::Transition::IsDone()
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,33 @@
|
||||||
|
#include "..\e2dobject.h"
|
||||||
|
|
||||||
|
e2d::Ref::Ref()
|
||||||
|
: ref_count_(0)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
e2d::Ref::~Ref()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
LONG e2d::Ref::Retain()
|
||||||
|
{
|
||||||
|
return ::InterlockedIncrement(&ref_count_);
|
||||||
|
}
|
||||||
|
|
||||||
|
LONG e2d::Ref::Release()
|
||||||
|
{
|
||||||
|
LONG new_count = ::InterlockedDecrement(&ref_count_);
|
||||||
|
|
||||||
|
if (new_count <= 0)
|
||||||
|
{
|
||||||
|
delete this;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return new_count;
|
||||||
|
}
|
||||||
|
|
||||||
|
LONG e2d::Ref::GetRefCount() const
|
||||||
|
{
|
||||||
|
return ref_count_;
|
||||||
|
}
|
||||||
|
|
@ -61,7 +61,6 @@
|
||||||
<ClCompile Include="..\..\core\objects\Collider.cpp" />
|
<ClCompile Include="..\..\core\objects\Collider.cpp" />
|
||||||
<ClCompile Include="..\..\core\objects\Image.cpp" />
|
<ClCompile Include="..\..\core\objects\Image.cpp" />
|
||||||
<ClCompile Include="..\..\core\objects\Node.cpp" />
|
<ClCompile Include="..\..\core\objects\Node.cpp" />
|
||||||
<ClCompile Include="..\..\core\objects\Object.cpp" />
|
|
||||||
<ClCompile Include="..\..\core\objects\Scene.cpp" />
|
<ClCompile Include="..\..\core\objects\Scene.cpp" />
|
||||||
<ClCompile Include="..\..\core\objects\Sprite.cpp" />
|
<ClCompile Include="..\..\core\objects\Sprite.cpp" />
|
||||||
<ClCompile Include="..\..\core\objects\Text.cpp" />
|
<ClCompile Include="..\..\core\objects\Text.cpp" />
|
||||||
|
|
@ -84,6 +83,7 @@
|
||||||
<ClCompile Include="..\..\core\utils\Function.cpp" />
|
<ClCompile Include="..\..\core\utils\Function.cpp" />
|
||||||
<ClCompile Include="..\..\core\utils\Point.cpp" />
|
<ClCompile Include="..\..\core\utils\Point.cpp" />
|
||||||
<ClCompile Include="..\..\core\utils\Rect.cpp" />
|
<ClCompile Include="..\..\core\utils\Rect.cpp" />
|
||||||
|
<ClCompile Include="..\..\core\utils\Ref.cpp" />
|
||||||
<ClCompile Include="..\..\core\utils\Resource.cpp" />
|
<ClCompile Include="..\..\core\utils\Resource.cpp" />
|
||||||
<ClCompile Include="..\..\core\utils\Size.cpp" />
|
<ClCompile Include="..\..\core\utils\Size.cpp" />
|
||||||
<ClCompile Include="..\..\core\utils\String.cpp" />
|
<ClCompile Include="..\..\core\utils\String.cpp" />
|
||||||
|
|
|
||||||
|
|
@ -32,20 +32,6 @@
|
||||||
<UniqueIdentifier>{51864c81-02ee-4043-bf09-9ce3cbe5b6da}</UniqueIdentifier>
|
<UniqueIdentifier>{51864c81-02ee-4043-bf09-9ce3cbe5b6da}</UniqueIdentifier>
|
||||||
</Filter>
|
</Filter>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
|
||||||
<ClInclude Include="..\..\core\easy2d.h" />
|
|
||||||
<ClInclude Include="..\..\core\e2daction.h" />
|
|
||||||
<ClInclude Include="..\..\core\e2dmacros.h" />
|
|
||||||
<ClInclude Include="..\..\core\e2dmanager.h" />
|
|
||||||
<ClInclude Include="..\..\core\e2dtransition.h" />
|
|
||||||
<ClInclude Include="..\..\core\e2devent.h" />
|
|
||||||
<ClInclude Include="..\..\core\e2dmodule.h" />
|
|
||||||
<ClInclude Include="..\..\core\e2dcomponent.h" />
|
|
||||||
<ClInclude Include="..\..\core\e2dimpl.h" />
|
|
||||||
<ClInclude Include="..\..\core\e2dtool.h" />
|
|
||||||
<ClInclude Include="..\..\core\e2dutil.h" />
|
|
||||||
<ClInclude Include="..\..\core\e2dobject.h" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="..\..\core\actions\Action.cpp">
|
<ClCompile Include="..\..\core\actions\Action.cpp">
|
||||||
<Filter>actions</Filter>
|
<Filter>actions</Filter>
|
||||||
|
|
@ -242,9 +228,6 @@
|
||||||
<ClCompile Include="..\..\core\objects\Node.cpp">
|
<ClCompile Include="..\..\core\objects\Node.cpp">
|
||||||
<Filter>objects</Filter>
|
<Filter>objects</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="..\..\core\objects\Object.cpp">
|
|
||||||
<Filter>objects</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="..\..\core\objects\Scene.cpp">
|
<ClCompile Include="..\..\core\objects\Scene.cpp">
|
||||||
<Filter>objects</Filter>
|
<Filter>objects</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
|
@ -254,5 +237,22 @@
|
||||||
<ClCompile Include="..\..\core\objects\Text.cpp">
|
<ClCompile Include="..\..\core\objects\Text.cpp">
|
||||||
<Filter>objects</Filter>
|
<Filter>objects</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\core\utils\Ref.cpp">
|
||||||
|
<Filter>utils</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClInclude Include="..\..\core\easy2d.h" />
|
||||||
|
<ClInclude Include="..\..\core\e2daction.h" />
|
||||||
|
<ClInclude Include="..\..\core\e2dmacros.h" />
|
||||||
|
<ClInclude Include="..\..\core\e2dmanager.h" />
|
||||||
|
<ClInclude Include="..\..\core\e2dtransition.h" />
|
||||||
|
<ClInclude Include="..\..\core\e2devent.h" />
|
||||||
|
<ClInclude Include="..\..\core\e2dmodule.h" />
|
||||||
|
<ClInclude Include="..\..\core\e2dcomponent.h" />
|
||||||
|
<ClInclude Include="..\..\core\e2dimpl.h" />
|
||||||
|
<ClInclude Include="..\..\core\e2dtool.h" />
|
||||||
|
<ClInclude Include="..\..\core\e2dutil.h" />
|
||||||
|
<ClInclude Include="..\..\core\e2dobject.h" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
|
@ -205,7 +205,6 @@
|
||||||
<ClCompile Include="..\..\core\objects\Collider.cpp" />
|
<ClCompile Include="..\..\core\objects\Collider.cpp" />
|
||||||
<ClCompile Include="..\..\core\objects\Image.cpp" />
|
<ClCompile Include="..\..\core\objects\Image.cpp" />
|
||||||
<ClCompile Include="..\..\core\objects\Node.cpp" />
|
<ClCompile Include="..\..\core\objects\Node.cpp" />
|
||||||
<ClCompile Include="..\..\core\objects\Object.cpp" />
|
|
||||||
<ClCompile Include="..\..\core\objects\Scene.cpp" />
|
<ClCompile Include="..\..\core\objects\Scene.cpp" />
|
||||||
<ClCompile Include="..\..\core\objects\Sprite.cpp" />
|
<ClCompile Include="..\..\core\objects\Sprite.cpp" />
|
||||||
<ClCompile Include="..\..\core\objects\Text.cpp" />
|
<ClCompile Include="..\..\core\objects\Text.cpp" />
|
||||||
|
|
@ -228,6 +227,7 @@
|
||||||
<ClCompile Include="..\..\core\utils\Function.cpp" />
|
<ClCompile Include="..\..\core\utils\Function.cpp" />
|
||||||
<ClCompile Include="..\..\core\utils\Point.cpp" />
|
<ClCompile Include="..\..\core\utils\Point.cpp" />
|
||||||
<ClCompile Include="..\..\core\utils\Rect.cpp" />
|
<ClCompile Include="..\..\core\utils\Rect.cpp" />
|
||||||
|
<ClCompile Include="..\..\core\utils\Ref.cpp" />
|
||||||
<ClCompile Include="..\..\core\utils\Resource.cpp" />
|
<ClCompile Include="..\..\core\utils\Resource.cpp" />
|
||||||
<ClCompile Include="..\..\core\utils\Size.cpp" />
|
<ClCompile Include="..\..\core\utils\Size.cpp" />
|
||||||
<ClCompile Include="..\..\core\utils\String.cpp" />
|
<ClCompile Include="..\..\core\utils\String.cpp" />
|
||||||
|
|
|
||||||
|
|
@ -32,20 +32,6 @@
|
||||||
<UniqueIdentifier>{51864c81-02ee-4043-bf09-9ce3cbe5b6da}</UniqueIdentifier>
|
<UniqueIdentifier>{51864c81-02ee-4043-bf09-9ce3cbe5b6da}</UniqueIdentifier>
|
||||||
</Filter>
|
</Filter>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
|
||||||
<ClInclude Include="..\..\core\easy2d.h" />
|
|
||||||
<ClInclude Include="..\..\core\e2daction.h" />
|
|
||||||
<ClInclude Include="..\..\core\e2dmacros.h" />
|
|
||||||
<ClInclude Include="..\..\core\e2dmanager.h" />
|
|
||||||
<ClInclude Include="..\..\core\e2dtransition.h" />
|
|
||||||
<ClInclude Include="..\..\core\e2devent.h" />
|
|
||||||
<ClInclude Include="..\..\core\e2dmodule.h" />
|
|
||||||
<ClInclude Include="..\..\core\e2dcomponent.h" />
|
|
||||||
<ClInclude Include="..\..\core\e2dimpl.h" />
|
|
||||||
<ClInclude Include="..\..\core\e2dtool.h" />
|
|
||||||
<ClInclude Include="..\..\core\e2dutil.h" />
|
|
||||||
<ClInclude Include="..\..\core\e2dobject.h" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="..\..\core\actions\Action.cpp">
|
<ClCompile Include="..\..\core\actions\Action.cpp">
|
||||||
<Filter>actions</Filter>
|
<Filter>actions</Filter>
|
||||||
|
|
@ -242,9 +228,6 @@
|
||||||
<ClCompile Include="..\..\core\objects\Node.cpp">
|
<ClCompile Include="..\..\core\objects\Node.cpp">
|
||||||
<Filter>objects</Filter>
|
<Filter>objects</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="..\..\core\objects\Object.cpp">
|
|
||||||
<Filter>objects</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="..\..\core\objects\Scene.cpp">
|
<ClCompile Include="..\..\core\objects\Scene.cpp">
|
||||||
<Filter>objects</Filter>
|
<Filter>objects</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
|
@ -254,5 +237,22 @@
|
||||||
<ClCompile Include="..\..\core\objects\Text.cpp">
|
<ClCompile Include="..\..\core\objects\Text.cpp">
|
||||||
<Filter>objects</Filter>
|
<Filter>objects</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\core\utils\Ref.cpp">
|
||||||
|
<Filter>utils</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClInclude Include="..\..\core\easy2d.h" />
|
||||||
|
<ClInclude Include="..\..\core\e2daction.h" />
|
||||||
|
<ClInclude Include="..\..\core\e2dmacros.h" />
|
||||||
|
<ClInclude Include="..\..\core\e2dmanager.h" />
|
||||||
|
<ClInclude Include="..\..\core\e2dtransition.h" />
|
||||||
|
<ClInclude Include="..\..\core\e2devent.h" />
|
||||||
|
<ClInclude Include="..\..\core\e2dmodule.h" />
|
||||||
|
<ClInclude Include="..\..\core\e2dcomponent.h" />
|
||||||
|
<ClInclude Include="..\..\core\e2dimpl.h" />
|
||||||
|
<ClInclude Include="..\..\core\e2dtool.h" />
|
||||||
|
<ClInclude Include="..\..\core\e2dutil.h" />
|
||||||
|
<ClInclude Include="..\..\core\e2dobject.h" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
|
@ -238,7 +238,6 @@
|
||||||
<ClCompile Include="..\..\core\objects\Collider.cpp" />
|
<ClCompile Include="..\..\core\objects\Collider.cpp" />
|
||||||
<ClCompile Include="..\..\core\objects\Image.cpp" />
|
<ClCompile Include="..\..\core\objects\Image.cpp" />
|
||||||
<ClCompile Include="..\..\core\objects\Node.cpp" />
|
<ClCompile Include="..\..\core\objects\Node.cpp" />
|
||||||
<ClCompile Include="..\..\core\objects\Object.cpp" />
|
|
||||||
<ClCompile Include="..\..\core\objects\Scene.cpp" />
|
<ClCompile Include="..\..\core\objects\Scene.cpp" />
|
||||||
<ClCompile Include="..\..\core\objects\Sprite.cpp" />
|
<ClCompile Include="..\..\core\objects\Sprite.cpp" />
|
||||||
<ClCompile Include="..\..\core\objects\Text.cpp" />
|
<ClCompile Include="..\..\core\objects\Text.cpp" />
|
||||||
|
|
@ -261,6 +260,7 @@
|
||||||
<ClCompile Include="..\..\core\utils\Function.cpp" />
|
<ClCompile Include="..\..\core\utils\Function.cpp" />
|
||||||
<ClCompile Include="..\..\core\utils\Point.cpp" />
|
<ClCompile Include="..\..\core\utils\Point.cpp" />
|
||||||
<ClCompile Include="..\..\core\utils\Rect.cpp" />
|
<ClCompile Include="..\..\core\utils\Rect.cpp" />
|
||||||
|
<ClCompile Include="..\..\core\utils\Ref.cpp" />
|
||||||
<ClCompile Include="..\..\core\utils\Resource.cpp" />
|
<ClCompile Include="..\..\core\utils\Resource.cpp" />
|
||||||
<ClCompile Include="..\..\core\utils\Size.cpp" />
|
<ClCompile Include="..\..\core\utils\Size.cpp" />
|
||||||
<ClCompile Include="..\..\core\utils\String.cpp" />
|
<ClCompile Include="..\..\core\utils\String.cpp" />
|
||||||
|
|
|
||||||
|
|
@ -32,20 +32,6 @@
|
||||||
<UniqueIdentifier>{51864c81-02ee-4043-bf09-9ce3cbe5b6da}</UniqueIdentifier>
|
<UniqueIdentifier>{51864c81-02ee-4043-bf09-9ce3cbe5b6da}</UniqueIdentifier>
|
||||||
</Filter>
|
</Filter>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
|
||||||
<ClInclude Include="..\..\core\easy2d.h" />
|
|
||||||
<ClInclude Include="..\..\core\e2daction.h" />
|
|
||||||
<ClInclude Include="..\..\core\e2dmacros.h" />
|
|
||||||
<ClInclude Include="..\..\core\e2dmanager.h" />
|
|
||||||
<ClInclude Include="..\..\core\e2dtransition.h" />
|
|
||||||
<ClInclude Include="..\..\core\e2devent.h" />
|
|
||||||
<ClInclude Include="..\..\core\e2dmodule.h" />
|
|
||||||
<ClInclude Include="..\..\core\e2dcomponent.h" />
|
|
||||||
<ClInclude Include="..\..\core\e2dimpl.h" />
|
|
||||||
<ClInclude Include="..\..\core\e2dtool.h" />
|
|
||||||
<ClInclude Include="..\..\core\e2dutil.h" />
|
|
||||||
<ClInclude Include="..\..\core\e2dobject.h" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="..\..\core\actions\Action.cpp">
|
<ClCompile Include="..\..\core\actions\Action.cpp">
|
||||||
<Filter>actions</Filter>
|
<Filter>actions</Filter>
|
||||||
|
|
@ -242,9 +228,6 @@
|
||||||
<ClCompile Include="..\..\core\objects\Node.cpp">
|
<ClCompile Include="..\..\core\objects\Node.cpp">
|
||||||
<Filter>objects</Filter>
|
<Filter>objects</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="..\..\core\objects\Object.cpp">
|
|
||||||
<Filter>objects</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="..\..\core\objects\Scene.cpp">
|
<ClCompile Include="..\..\core\objects\Scene.cpp">
|
||||||
<Filter>objects</Filter>
|
<Filter>objects</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
|
@ -254,5 +237,22 @@
|
||||||
<ClCompile Include="..\..\core\objects\Text.cpp">
|
<ClCompile Include="..\..\core\objects\Text.cpp">
|
||||||
<Filter>objects</Filter>
|
<Filter>objects</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\core\utils\Ref.cpp">
|
||||||
|
<Filter>utils</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClInclude Include="..\..\core\easy2d.h" />
|
||||||
|
<ClInclude Include="..\..\core\e2daction.h" />
|
||||||
|
<ClInclude Include="..\..\core\e2dmacros.h" />
|
||||||
|
<ClInclude Include="..\..\core\e2dmanager.h" />
|
||||||
|
<ClInclude Include="..\..\core\e2dtransition.h" />
|
||||||
|
<ClInclude Include="..\..\core\e2devent.h" />
|
||||||
|
<ClInclude Include="..\..\core\e2dmodule.h" />
|
||||||
|
<ClInclude Include="..\..\core\e2dcomponent.h" />
|
||||||
|
<ClInclude Include="..\..\core\e2dimpl.h" />
|
||||||
|
<ClInclude Include="..\..\core\e2dtool.h" />
|
||||||
|
<ClInclude Include="..\..\core\e2dutil.h" />
|
||||||
|
<ClInclude Include="..\..\core\e2dobject.h" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
Loading…
Reference in New Issue