Refactoring in SizeNotifiable.
Class is a template now and accepts a registraton policy.
This commit is contained in:
parent
dbf29f13d1
commit
d0a052ddb2
7 changed files with 122 additions and 22 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
///-------------------------------------------------------------------------
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue