Fully replace listener system by signals

Former-commit-id: 032dfddd12cc3a792c71426148c758ffac3621f9
This commit is contained in:
Lynix
2015-06-07 20:42:41 +02:00
parent 0f4cf3c910
commit a069b105e6
63 changed files with 291 additions and 606 deletions

View File

@@ -34,7 +34,7 @@ bool NzAnimationParams::IsValid() const
NzAnimation::~NzAnimation()
{
Destroy();
OnAnimationRelease(this);
}
bool NzAnimation::AddSequence(const NzSequence& sequence)
@@ -172,7 +172,6 @@ bool NzAnimation::CreateSkeletal(unsigned int frameCount, unsigned int jointCoun
m_impl->sequenceJoints.resize(frameCount*jointCount);
m_impl->type = nzAnimationType_Skeletal;
NotifyCreated();
return true;
}
@@ -180,7 +179,7 @@ void NzAnimation::Destroy()
{
if (m_impl)
{
NotifyDestroy();
OnAnimationDestroy(this);
delete m_impl;
m_impl = nullptr;

View File

@@ -40,6 +40,8 @@ m_impl(nullptr)
NzBuffer::~NzBuffer()
{
OnBufferRelease(this);
Destroy();
}
@@ -86,7 +88,6 @@ bool NzBuffer::Create(unsigned int size, nzUInt32 storage, nzBufferUsage usage)
m_storage = storage;
m_usage = usage;
NotifyCreated();
return true; // Si on arrive ici c'est que tout s'est bien passé.
}
@@ -94,7 +95,7 @@ void NzBuffer::Destroy()
{
if (m_impl)
{
NotifyDestroy();
OnBufferDestroy(this);
m_impl->Destroy();
delete m_impl;

View File

@@ -90,17 +90,21 @@ bool NzFont::Create(NzFontData* data)
#endif
m_data.reset(data);
return true;
}
void NzFont::Destroy()
{
ClearGlyphCache();
if (m_data)
{
OnFontDestroy(this);
m_data.reset();
m_kerningCache.clear();
m_sizeInfoCache.clear();
ClearGlyphCache();
m_data.reset();
m_kerningCache.clear();
m_sizeInfoCache.clear();
}
}
bool NzFont::ExtractGlyph(unsigned int characterSize, char32_t character, nzUInt32 style, NzFontGlyph* glyph) const

View File

@@ -65,6 +65,8 @@ m_sharedImage(sharedImage)
NzImage::~NzImage()
{
OnImageRelease(this);
Destroy();
}
@@ -306,7 +308,6 @@ bool NzImage::Create(nzImageType type, nzPixelFormat format, unsigned int width,
m_sharedImage = new SharedImage(1, type, format, levelCount, levels, width, height, depth);
NotifyCreated();
return true;
}
@@ -314,7 +315,7 @@ void NzImage::Destroy()
{
if (m_sharedImage != &emptyImage)
{
NotifyDestroy();
OnImageDestroy(this);
ReleaseImage();
}
}

View File

@@ -66,6 +66,8 @@ struct NzMeshImpl
NzMesh::~NzMesh()
{
OnMeshRelease(this);
Destroy();
}
@@ -359,7 +361,6 @@ bool NzMesh::CreateSkeletal(unsigned int jointCount)
return false;
}
NotifyCreated();
return true;
}
@@ -370,7 +371,6 @@ bool NzMesh::CreateStatic()
m_impl = new NzMeshImpl;
m_impl->animationType = nzAnimationType_Static;
NotifyCreated();
return true;
}
@@ -378,7 +378,7 @@ void NzMesh::Destroy()
{
if (m_impl)
{
NotifyDestroy();
OnMeshDestroy(this);
delete m_impl;
m_impl = nullptr;

View File

@@ -24,6 +24,8 @@ m_characterSize(drawer.m_characterSize)
SetFont(drawer.m_font);
}
NzSimpleTextDrawer::~NzSimpleTextDrawer() = default;
const NzRectui& NzSimpleTextDrawer::GetBounds() const
{
if (!m_glyphUpdated)

View File

@@ -16,6 +16,8 @@ NzSubMesh(parent)
NzSkeletalMesh::~NzSkeletalMesh()
{
OnSkeletalMeshRelease(this);
Destroy();
}
@@ -39,7 +41,7 @@ void NzSkeletalMesh::Destroy()
{
if (m_vertexBuffer)
{
NotifyDestroy();
OnSkeletalMeshDestroy(this);
m_indexBuffer.Reset();
m_vertexBuffer.Reset();

View File

@@ -24,6 +24,8 @@ m_impl(nullptr)
NzSkeleton::~NzSkeleton()
{
OnSkeletonRelease(this);
Destroy();
}
@@ -47,6 +49,8 @@ void NzSkeleton::Destroy()
{
if (m_impl)
{
OnSkeletonDestroy(this);
delete m_impl;
m_impl = nullptr;
}
@@ -372,7 +376,8 @@ NzSkeleton& NzSkeleton::operator=(const NzSkeleton& skeleton)
void NzSkeleton::InvalidateJoints()
{
m_impl->aabbUpdated = false;
NotifyModified(0);
OnSkeletonJointsInvalidated(this);
}
void NzSkeleton::InvalidateJointMap()

View File

@@ -18,6 +18,8 @@ NzSubMesh(parent)
NzStaticMesh::~NzStaticMesh()
{
OnStaticMeshRelease(this);
Destroy();
}
@@ -57,7 +59,7 @@ void NzStaticMesh::Destroy()
{
if (m_vertexBuffer)
{
NotifyDestroy();
OnStaticMeshDestroy(this);
m_indexBuffer.Reset();
m_vertexBuffer.Reset();

View File

@@ -20,7 +20,10 @@ m_matIndex(0)
{
}
NzSubMesh::~NzSubMesh() = default;
NzSubMesh::~NzSubMesh()
{
OnSubMeshRelease(this);
}
void NzSubMesh::GenerateNormals()
{