Improved Atlas class
It now handles layer resize failure and will notify listeners of a pointer change Former-commit-id: df5e2a129897128a4e41e0b3205f6a1dbeb2069c
This commit is contained in:
@@ -45,6 +45,23 @@ void NzAbstractAtlas::NotifyCleared()
|
||||
m_listenersLocked = false;
|
||||
}
|
||||
|
||||
void NzAbstractAtlas::NotifyLayerChange(NzAbstractImage* oldLayer, NzAbstractImage* newLayer)
|
||||
{
|
||||
m_listenersLocked = true;
|
||||
|
||||
auto it = m_listeners.begin();
|
||||
while (it != m_listeners.end())
|
||||
{
|
||||
if (!it->first->OnAtlasLayerChange(this, oldLayer, newLayer, it->second))
|
||||
m_listeners.erase(it++);
|
||||
else
|
||||
++it;
|
||||
}
|
||||
|
||||
m_listenersLocked = false;
|
||||
}
|
||||
|
||||
|
||||
NzAbstractAtlas::Listener::~Listener() = default;
|
||||
|
||||
bool NzAbstractAtlas::Listener::OnAtlasCleared(const NzAbstractAtlas* atlas, void* userdata)
|
||||
@@ -55,6 +72,16 @@ bool NzAbstractAtlas::Listener::OnAtlasCleared(const NzAbstractAtlas* atlas, voi
|
||||
return true;
|
||||
}
|
||||
|
||||
bool NzAbstractAtlas::Listener::OnAtlasLayerChange(const NzAbstractAtlas* atlas, NzAbstractImage* oldLayer, NzAbstractImage* newLayer, void* userdata)
|
||||
{
|
||||
NazaraUnused(atlas);
|
||||
NazaraUnused(oldLayer);
|
||||
NazaraUnused(newLayer);
|
||||
NazaraUnused(userdata);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void NzAbstractAtlas::Listener::OnAtlasReleased(const NzAbstractAtlas* atlas, void* userdata)
|
||||
{
|
||||
NazaraUnused(atlas);
|
||||
|
||||
Reference in New Issue
Block a user