Refactoring : GC 机制重做

This commit is contained in:
Nomango 2018-09-07 00:28:54 +08:00
parent 83462faad0
commit 5f698fb475
40 changed files with 256 additions and 319 deletions

View File

@ -16,7 +16,7 @@ e2d::Animate::Animate(Animation * animation)
e2d::Animate::~Animate()
{
GC::GetInstance()->SafeRelease(animation_);
SafeRelease(animation_);
}
e2d::Animation * e2d::Animate::GetAnimation() const
@ -26,11 +26,15 @@ e2d::Animation * e2d::Animate::GetAnimation() const
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_->Retain();
frame_index_ = 0;
}
}
@ -92,7 +96,7 @@ e2d::Animate * e2d::Animate::Clone() const
{
if (animation_)
{
return new (e2d::autorelease) Animate(animation_);
return new Animate(animation_);
}
return nullptr;
}
@ -104,7 +108,7 @@ e2d::Animate * e2d::Animate::Reverse() const
auto animation = animation_->Reverse();
if (animation)
{
return new (e2d::autorelease) Animate(animation);
return new Animate(animation);
}
}
return nullptr;

View File

@ -24,9 +24,9 @@ e2d::Animation::Animation(float interval, const Images& frames)
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
{
auto animation = new (e2d::autorelease) Animation(interval_);
auto animation = new Animation(interval_);
if (animation)
{
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);
}

View File

@ -7,12 +7,12 @@ e2d::Callback::Callback(const Function& func) :
e2d::Callback * e2d::Callback::Clone() const
{
return new (e2d::autorelease) Callback(callback_);
return new Callback(callback_);
}
e2d::Callback * e2d::Callback::Reverse() const
{
return new (e2d::autorelease) Callback(callback_);
return new Callback(callback_);
}
void e2d::Callback::Init()

View File

@ -8,12 +8,12 @@ e2d::Delay::Delay(float duration)
e2d::Delay * e2d::Delay::Clone() const
{
return new (e2d::autorelease) Delay(delay_);
return new Delay(delay_);
}
e2d::Delay * e2d::Delay::Reverse() const
{
return new (e2d::autorelease) Delay(delay_);
return new Delay(delay_);
}
void e2d::Delay::Reset()

View File

@ -11,12 +11,12 @@ e2d::JumpBy::JumpBy(float duration, const Point & vec, float height, int jumps)
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
{
return new (e2d::autorelease) JumpBy(duration_, -delta_pos_, height_, jumps_);
return new JumpBy(duration_, -delta_pos_, height_, jumps_);
}
void e2d::JumpBy::Init()

View File

@ -9,7 +9,7 @@ e2d::JumpTo::JumpTo(float duration, const Point & pos, float height, int jumps)
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()

View File

@ -17,14 +17,14 @@ e2d::Loop::Loop(Action * action, int times /* = -1 */)
e2d::Loop::~Loop()
{
GC::GetInstance()->SafeRelease(action_);
SafeRelease(action_);
}
e2d::Loop * e2d::Loop::Clone() const
{
if (action_)
{
return new (e2d::autorelease) Loop(action_->Clone());
return new Loop(action_->Clone());
}
else
{
@ -36,7 +36,7 @@ e2d::Loop * e2d::Loop::Reverse() const
{
if (action_)
{
return new (e2d::autorelease) Loop(action_->Clone());
return new Loop(action_->Clone());
}
else
{

View File

@ -37,10 +37,10 @@ void e2d::MoveBy::Update()
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
{
return new (e2d::autorelease) MoveBy(duration_, -delta_pos_);
return new MoveBy(duration_, -delta_pos_);
}

View File

@ -9,7 +9,7 @@ e2d::MoveTo::MoveTo(float duration, Point pos)
e2d::MoveTo * e2d::MoveTo::Clone() const
{
return new (e2d::autorelease) MoveTo(duration_, end_pos_);
return new MoveTo(duration_, end_pos_);
}
void e2d::MoveTo::Init()

View File

@ -30,10 +30,10 @@ void e2d::OpacityBy::Update()
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
{
return new (e2d::autorelease) OpacityBy(duration_, -delta_val_);
return new OpacityBy(duration_, -delta_val_);
}

View File

@ -10,7 +10,7 @@ e2d::OpacityTo::OpacityTo(float duration, float opacity)
e2d::OpacityTo * e2d::OpacityTo::Clone() const
{
return new (e2d::autorelease) OpacityTo(duration_, end_val_);
return new OpacityTo(duration_, end_val_);
}
void e2d::OpacityTo::Init()

View File

@ -30,10 +30,10 @@ void e2d::RotateBy::Update()
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
{
return new (e2d::autorelease) RotateBy(duration_, -delta_val_);
return new RotateBy(duration_, -delta_val_);
}

View File

@ -10,7 +10,7 @@ e2d::RotateTo::RotateTo(float duration, float rotation)
e2d::RotateTo * e2d::RotateTo::Clone() const
{
return new (e2d::autorelease) RotateTo(duration_, end_val_);
return new RotateTo(duration_, end_val_);
}
void e2d::RotateTo::Init()

View File

@ -39,10 +39,10 @@ void e2d::ScaleBy::Update()
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
{
return new (e2d::autorelease) ScaleBy(duration_, -delta_x_, -delta_y_);
return new ScaleBy(duration_, -delta_x_, -delta_y_);
}

View File

@ -17,7 +17,7 @@ e2d::ScaleTo::ScaleTo(float duration, float scale_x, float scale_y)
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()

View File

@ -13,9 +13,9 @@ e2d::Sequence::Sequence(const Actions& actions)
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
{
auto sequence = new (e2d::autorelease) Sequence();
auto sequence = new Sequence();
for (const auto& action : actions_)
{
if (action)
@ -105,7 +105,7 @@ e2d::Sequence * e2d::Sequence::Clone() const
e2d::Sequence * e2d::Sequence::Reverse() const
{
auto sequence = new (e2d::autorelease) Sequence();
auto sequence = new Sequence();
if (sequence && !actions_.empty())
{
std::vector<Action*> newActions(actions_.size());

View File

@ -11,9 +11,9 @@ e2d::Spawn::Spawn(const Actions& actions)
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
{
auto spawn = new (e2d::autorelease) Spawn();
auto spawn = new Spawn();
for (const auto& action : actions_)
{
if (action)
@ -103,7 +103,7 @@ e2d::Spawn * e2d::Spawn::Clone() const
e2d::Spawn * e2d::Spawn::Reverse() const
{
auto spawn = new (e2d::autorelease) Spawn();
auto spawn = new Spawn();
if (spawn && !actions_.empty())
{
std::vector<Action*> newActions(actions_.size());

View File

@ -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)
{
if (FAILED(hr))

View File

@ -376,26 +376,9 @@ namespace e2d
};
// 垃圾回收池
// ŔŹťřťŘĘŐ
class GC
{
public:
// 获取 GC 实例
static GC * GetInstance();
// 自动释放
void AutoRelease(
Ref* ref
);
// 安全地释放对象
void SafeRelease(
Ref* ref
);
// 刷新内存池
void Flush();
private:
GC();
@ -403,10 +386,7 @@ namespace e2d
E2D_DISABLE_COPY(GC);
private:
bool notifyed_;
bool cleanup_;
std::set<Ref*> pool_;
static GC instance_;
};
}

View File

@ -79,6 +79,11 @@ namespace e2d
// 获取 ID2D1Bitmap 对象
ID2D1Bitmap * GetBitmap();
// ÉèÖÃ Bitmap
void SetBitmap(
ID2D1Bitmap * bitmap
);
// 预加载图片资源
static bool Preload(
const String& file_name
@ -95,11 +100,6 @@ namespace e2d
protected:
E2D_DISABLE_COPY(Image);
// ÉèÖÃ Bitmap
void SetBitmap(
ID2D1Bitmap * bitmap
);
protected:
Rect crop_rect_;
ID2D1Bitmap * bitmap_;

View File

@ -50,7 +50,8 @@ namespace e2d
// 稜있
class Music
class Music :
public Ref
{
public:
Music();

View File

@ -610,38 +610,31 @@ namespace e2d
virtual ~Ref();
// 增加引用计数
void Retain();
LONG Retain();
// 减少引用计数
void Release();
LONG Release();
// 获取引用计数
int GetRefCount() const;
LONG GetRefCount() const;
protected:
E2D_DISABLE_COPY(Ref);
private:
int ref_count_;
protected:
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;

View File

@ -1,55 +1,17 @@
#include "..\e2dmodule.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()
{
static GC instance_;
return &instance_;
}
e2d::GC e2d::GC::instance_;
e2d::GC::GC()
: notifyed_(false)
, cleanup_(false)
, pool_()
{
}
e2d::GC::~GC()
{
// <20>뇜杰唐뚤蹶
cleanup_ = true;
for (const auto& ref : pool_)
{
delete ref;
}
pool_.clear();
cleanup_ = false;
// 헌뇜뻠닸
Image::ClearCache();
// 헌뇜데절
Player::DestroyInstance();
Audio::DestroyInstance();
Renderer::DestroyInstance();
@ -57,43 +19,3 @@ e2d::GC::~GC()
Window::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;
}
}

View File

@ -36,6 +36,10 @@ e2d::Game::Game()
e2d::Game::~Game()
{
SafeRelease(transition_);
SafeRelease(curr_scene_);
SafeRelease(next_scene_);
::CoUninitialize();
}
@ -75,7 +79,6 @@ void e2d::Game::Start()
DrawScene();
window->Poll();
GC::GetInstance()->Flush();
}
else
{
@ -122,8 +125,10 @@ void e2d::Game::EnterScene(Scene * scene)
if (!scene)
return;
// 保存下一场景的指针
if (next_scene_) next_scene_->Release();
if (next_scene_)
{
next_scene_->Release();
}
next_scene_ = scene;
next_scene_->Retain();
}

View File

@ -18,6 +18,8 @@ e2d::Collider::Collider(Node * parent)
e2d::Collider::~Collider()
{
SafeRelease(geometry_);
CollisionManager::GetInstance()->RemoveCollider(this);
}
const e2d::Color& e2d::Collider::GetBorderColor() const

View File

@ -42,6 +42,7 @@ e2d::Image::Image(const String & file_name, const Rect & crop_rect)
e2d::Image::~Image()
{
SafeRelease(bitmap_);
}
bool e2d::Image::Open(const Resource& res)
@ -366,8 +367,18 @@ void e2d::Image::ClearCache()
void e2d::Image::SetBitmap(ID2D1Bitmap * bitmap)
{
if (bitmap_ == bitmap)
return;
if (bitmap_)
{
bitmap_->Release();
}
if (bitmap)
{
bitmap->AddRef();
bitmap_ = bitmap;
crop_rect_.origin.x = crop_rect_.origin.y = 0;
crop_rect_.size.width = bitmap_->GetSize().width;

View File

@ -63,14 +63,14 @@ e2d::Node::~Node()
{
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);
}
}

View File

@ -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_;
}

View File

@ -20,8 +20,8 @@ e2d::Scene::~Scene()
{
if (root_)
{
root_->Release();
root_->SetParentScene(nullptr);
root_->Release();
}
}
@ -32,8 +32,8 @@ void e2d::Scene::SetRoot(Node * root)
if (root_)
{
root_->Release();
root_->SetParentScene(nullptr);
root_->Release();
}
if (root)

View File

@ -40,14 +40,18 @@ e2d::Sprite::Sprite(const String & file_name, const Rect & crop_rect)
e2d::Sprite::~Sprite()
{
GC::GetInstance()->SafeRelease(image_);
SafeRelease(image_);
}
bool e2d::Sprite::Open(Image * image)
{
if (image)
{
if (image_) image_->Release();
if (image_)
{
image_->Release();
}
image_ = image;
image_->Retain();
@ -61,7 +65,7 @@ bool e2d::Sprite::Open(const Resource& res)
{
if (!image_)
{
image_ = new (e2d::autorelease) Image();
image_ = new Image();
image_->Retain();
}
@ -77,7 +81,7 @@ bool e2d::Sprite::Open(const String & file_name)
{
if (!image_)
{
image_ = new (e2d::autorelease) Image();
image_ = new Image();
image_->Retain();
}

View File

@ -174,60 +174,60 @@ e2d::File e2d::File::ShowOpenDialog(const String & title, const String & filter)
if (SUCCEEDED(hr))
{
IFileOpenDialog *pFileOpen;
IFileOpenDialog *file_open;
hr = ::CoCreateInstance(CLSID_FileOpenDialog, NULL, CLSCTX_ALL,
IID_IFileOpenDialog, reinterpret_cast<void**>(&pFileOpen));
IID_IFileOpenDialog, reinterpret_cast<void**>(&file_open));
if (SUCCEEDED(hr))
{
if (!title.IsEmpty())
{
pFileOpen->SetTitle(LPCWSTR(title));
file_open->SetTitle(LPCWSTR(title));
}
if (!filter.IsEmpty())
{
COMDLG_FILTERSPEC rgSpec[] =
COMDLG_FILTERSPEC spec[] =
{
{ L"", LPCWSTR(filter) }
};
pFileOpen->SetFileTypes(1, rgSpec);
file_open->SetFileTypes(1, spec);
}
else
{
COMDLG_FILTERSPEC rgSpec[] =
COMDLG_FILTERSPEC spec[] =
{
{ L"ËùÓÐÎļþ", L"*.*" }
};
pFileOpen->SetFileTypes(1, rgSpec);
file_open->SetFileTypes(1, spec);
}
Game::GetInstance()->Pause();
{
HWND hWnd = Window::GetInstance()->GetHWnd();
hr = pFileOpen->Show(hWnd);
hr = file_open->Show(hWnd);
}
Game::GetInstance()->Resume();
if (SUCCEEDED(hr))
{
IShellItem *pItem;
hr = pFileOpen->GetResult(&pItem);
IShellItem *item;
hr = file_open->GetResult(&item);
if (SUCCEEDED(hr))
{
PWSTR pszFilePath;
hr = pItem->GetDisplayName(SIGDN_FILESYSPATH, &pszFilePath);
PWSTR str_file_path;
hr = item->GetDisplayName(SIGDN_FILESYSPATH, &str_file_path);
if (SUCCEEDED(hr))
{
file_path = pszFilePath;
::CoTaskMemFree(pszFilePath);
file_path = str_file_path;
::CoTaskMemFree(str_file_path);
}
pItem->Release();
item->Release();
}
}
pFileOpen->Release();
file_open->Release();
}
::CoUninitialize();
}
@ -241,68 +241,68 @@ e2d::File e2d::File::ShowSaveDialog(const String & title, const String& def_file
if (SUCCEEDED(hr))
{
IFileSaveDialog *pFileSave;
IFileSaveDialog *file_save;
hr = ::CoCreateInstance(CLSID_FileSaveDialog, NULL, CLSCTX_ALL,
IID_IFileSaveDialog, reinterpret_cast<void**>(&pFileSave));
IID_IFileSaveDialog, reinterpret_cast<void**>(&file_save));
if (SUCCEEDED(hr))
{
if (!title.IsEmpty())
{
pFileSave->SetTitle(LPCWSTR(title));
file_save->SetTitle(LPCWSTR(title));
}
if (!def_file.IsEmpty())
{
pFileSave->SetFileName(LPCWSTR(def_file));
file_save->SetFileName(LPCWSTR(def_file));
}
if (!def_ext.IsEmpty())
{
pFileSave->SetDefaultExtension(LPCWSTR(def_ext));
file_save->SetDefaultExtension(LPCWSTR(def_ext));
String spec = L"*." + def_ext;
COMDLG_FILTERSPEC rgSpec[] =
String ext = L"*." + def_ext;
COMDLG_FILTERSPEC spec[] =
{
{ L"", LPCWSTR(spec) }
{ L"", LPCWSTR(ext) }
};
pFileSave->SetFileTypes(1, rgSpec);
file_save->SetFileTypes(1, spec);
}
else
{
COMDLG_FILTERSPEC rgSpec[] =
COMDLG_FILTERSPEC spec[] =
{
{ L"ËùÓÐÎļþ", L"*.*" }
};
pFileSave->SetFileTypes(1, rgSpec);
file_save->SetFileTypes(1, spec);
}
Game::GetInstance()->Pause();
{
HWND hWnd = Window::GetInstance()->GetHWnd();
hr = pFileSave->Show(hWnd);
hr = file_save->Show(hWnd);
}
Game::GetInstance()->Resume();
if (SUCCEEDED(hr))
{
IShellItem *pItem;
hr = pFileSave->GetResult(&pItem);
IShellItem *item;
hr = file_save->GetResult(&item);
if (SUCCEEDED(hr))
{
PWSTR pszFilePath;
hr = pItem->GetDisplayName(SIGDN_FILESYSPATH, &pszFilePath);
PWSTR str_file_path;
hr = item->GetDisplayName(SIGDN_FILESYSPATH, &str_file_path);
if (SUCCEEDED(hr))
{
file_path = pszFilePath;
::CoTaskMemFree(pszFilePath);
file_path = str_file_path;
::CoTaskMemFree(str_file_path);
}
pItem->Release();
item->Release();
}
}
pFileSave->Release();
file_save->Release();
}
::CoUninitialize();
}

View File

@ -32,7 +32,7 @@ e2d::Player::~Player()
{
for (const auto& pair : musics_)
{
delete pair.second;
pair.second->Release();
}
}
}
@ -44,12 +44,21 @@ bool e2d::Player::Preload(const String & file_path)
Music * music = new (std::nothrow) Music();
if (music && music->Open(file_path))
if (music)
{
music->Retain();
if (music->Open(file_path))
{
music->SetVolume(volume_);
musics_.insert(std::make_pair(file_path.GetHash(), music));
return true;
}
else
{
music->Release();
}
}
return false;
}
@ -117,12 +126,21 @@ bool e2d::Player::Preload(const Resource& res)
Music * music = new (std::nothrow) Music();
if (music && music->Open(res))
if (music)
{
music->Retain();
if (music->Open(res))
{
music->SetVolume(volume_);
musics_.insert(std::make_pair(res.name, music));
return true;
}
else
{
music->Release();
}
}
return false;
}

View File

@ -22,8 +22,8 @@ e2d::Transition::~Transition()
{
SafeRelease(out_layer_);
SafeRelease(in_layer_);
GC::GetInstance()->SafeRelease(out_scene_);
GC::GetInstance()->SafeRelease(in_scene_);
SafeRelease(out_scene_);
SafeRelease(in_scene_);
}
bool e2d::Transition::IsDone()

33
core/utils/Ref.cpp Normal file
View File

@ -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_;
}

View File

@ -61,7 +61,6 @@
<ClCompile Include="..\..\core\objects\Collider.cpp" />
<ClCompile Include="..\..\core\objects\Image.cpp" />
<ClCompile Include="..\..\core\objects\Node.cpp" />
<ClCompile Include="..\..\core\objects\Object.cpp" />
<ClCompile Include="..\..\core\objects\Scene.cpp" />
<ClCompile Include="..\..\core\objects\Sprite.cpp" />
<ClCompile Include="..\..\core\objects\Text.cpp" />
@ -84,6 +83,7 @@
<ClCompile Include="..\..\core\utils\Function.cpp" />
<ClCompile Include="..\..\core\utils\Point.cpp" />
<ClCompile Include="..\..\core\utils\Rect.cpp" />
<ClCompile Include="..\..\core\utils\Ref.cpp" />
<ClCompile Include="..\..\core\utils\Resource.cpp" />
<ClCompile Include="..\..\core\utils\Size.cpp" />
<ClCompile Include="..\..\core\utils\String.cpp" />

View File

@ -32,20 +32,6 @@
<UniqueIdentifier>{51864c81-02ee-4043-bf09-9ce3cbe5b6da}</UniqueIdentifier>
</Filter>
</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>
<ClCompile Include="..\..\core\actions\Action.cpp">
<Filter>actions</Filter>
@ -242,9 +228,6 @@
<ClCompile Include="..\..\core\objects\Node.cpp">
<Filter>objects</Filter>
</ClCompile>
<ClCompile Include="..\..\core\objects\Object.cpp">
<Filter>objects</Filter>
</ClCompile>
<ClCompile Include="..\..\core\objects\Scene.cpp">
<Filter>objects</Filter>
</ClCompile>
@ -254,5 +237,22 @@
<ClCompile Include="..\..\core\objects\Text.cpp">
<Filter>objects</Filter>
</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>
</Project>

View File

@ -205,7 +205,6 @@
<ClCompile Include="..\..\core\objects\Collider.cpp" />
<ClCompile Include="..\..\core\objects\Image.cpp" />
<ClCompile Include="..\..\core\objects\Node.cpp" />
<ClCompile Include="..\..\core\objects\Object.cpp" />
<ClCompile Include="..\..\core\objects\Scene.cpp" />
<ClCompile Include="..\..\core\objects\Sprite.cpp" />
<ClCompile Include="..\..\core\objects\Text.cpp" />
@ -228,6 +227,7 @@
<ClCompile Include="..\..\core\utils\Function.cpp" />
<ClCompile Include="..\..\core\utils\Point.cpp" />
<ClCompile Include="..\..\core\utils\Rect.cpp" />
<ClCompile Include="..\..\core\utils\Ref.cpp" />
<ClCompile Include="..\..\core\utils\Resource.cpp" />
<ClCompile Include="..\..\core\utils\Size.cpp" />
<ClCompile Include="..\..\core\utils\String.cpp" />

View File

@ -32,20 +32,6 @@
<UniqueIdentifier>{51864c81-02ee-4043-bf09-9ce3cbe5b6da}</UniqueIdentifier>
</Filter>
</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>
<ClCompile Include="..\..\core\actions\Action.cpp">
<Filter>actions</Filter>
@ -242,9 +228,6 @@
<ClCompile Include="..\..\core\objects\Node.cpp">
<Filter>objects</Filter>
</ClCompile>
<ClCompile Include="..\..\core\objects\Object.cpp">
<Filter>objects</Filter>
</ClCompile>
<ClCompile Include="..\..\core\objects\Scene.cpp">
<Filter>objects</Filter>
</ClCompile>
@ -254,5 +237,22 @@
<ClCompile Include="..\..\core\objects\Text.cpp">
<Filter>objects</Filter>
</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>
</Project>

View File

@ -238,7 +238,6 @@
<ClCompile Include="..\..\core\objects\Collider.cpp" />
<ClCompile Include="..\..\core\objects\Image.cpp" />
<ClCompile Include="..\..\core\objects\Node.cpp" />
<ClCompile Include="..\..\core\objects\Object.cpp" />
<ClCompile Include="..\..\core\objects\Scene.cpp" />
<ClCompile Include="..\..\core\objects\Sprite.cpp" />
<ClCompile Include="..\..\core\objects\Text.cpp" />
@ -261,6 +260,7 @@
<ClCompile Include="..\..\core\utils\Function.cpp" />
<ClCompile Include="..\..\core\utils\Point.cpp" />
<ClCompile Include="..\..\core\utils\Rect.cpp" />
<ClCompile Include="..\..\core\utils\Ref.cpp" />
<ClCompile Include="..\..\core\utils\Resource.cpp" />
<ClCompile Include="..\..\core\utils\Size.cpp" />
<ClCompile Include="..\..\core\utils\String.cpp" />

View File

@ -32,20 +32,6 @@
<UniqueIdentifier>{51864c81-02ee-4043-bf09-9ce3cbe5b6da}</UniqueIdentifier>
</Filter>
</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>
<ClCompile Include="..\..\core\actions\Action.cpp">
<Filter>actions</Filter>
@ -242,9 +228,6 @@
<ClCompile Include="..\..\core\objects\Node.cpp">
<Filter>objects</Filter>
</ClCompile>
<ClCompile Include="..\..\core\objects\Object.cpp">
<Filter>objects</Filter>
</ClCompile>
<ClCompile Include="..\..\core\objects\Scene.cpp">
<Filter>objects</Filter>
</ClCompile>
@ -254,5 +237,22 @@
<ClCompile Include="..\..\core\objects\Text.cpp">
<Filter>objects</Filter>
</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>
</Project>