Refactoring in SizeNotifiable.

Class is a template now and accepts a registraton policy.
This commit is contained in:
King_DuckZ 2014-03-20 20:21:59 +01:00
parent dbf29f13d1
commit d0a052ddb2
7 changed files with 122 additions and 22 deletions

View file

@ -28,13 +28,10 @@ namespace cloonel {
Character::Character (const std::string& parPath, SDLMain* parMain, float2 parSize) :
Placeable(float2(0.0f)),
Drawable(parSize),
m_screenRatio(),
m_screenRatioID(0),
m_sdlmain(parMain),
m_screenRatio(parMain),
m_texture(new Texture(parPath, parMain, false))
{
assert(parMain);
m_screenRatioID = parMain->RegisterForResChange(&m_screenRatio);
}
///-------------------------------------------------------------------------
@ -42,19 +39,15 @@ namespace cloonel {
Character::Character (const std::string&& parPath, SDLMain* parMain, float2 parSize) :
Placeable(float2(0.0f)),
Drawable(parSize),
m_screenRatio(),
m_screenRatioID(0),
m_sdlmain(parMain),
m_screenRatio(parMain),
m_texture(new Texture(parPath, parMain, false))
{
assert(parMain);
m_screenRatioID = parMain->RegisterForResChange(&m_screenRatio);
}
///-------------------------------------------------------------------------
///-------------------------------------------------------------------------
Character::~Character() noexcept {
m_sdlmain->UnregisterForResChange(m_screenRatioID);
}
///-------------------------------------------------------------------------