NotifyResChanged() should not be virtual itself.

Make an OnResChanged() virtual method instead.
This commit is contained in:
King_DuckZ 2016-11-09 23:35:19 +01:00
parent a87255ef66
commit 72bfb64795
5 changed files with 14 additions and 5 deletions

@ -1 +1 @@
Subproject commit 00470290fe404e2977882917a4cf4197124256b5
Subproject commit 2f4d31967541c9c4a87b2511fb0c6d3792c72c2d

View file

@ -55,5 +55,11 @@ namespace cloonel {
///--------------------------------------------------------------------------
void SizeNotifiableBase::NotifyResChanged (const SizeRatio& parSize) {
m_scaleRatio = parSize.Ratio();
this->OnResChanged(parSize);
}
///--------------------------------------------------------------------------
///--------------------------------------------------------------------------
void SizeNotifiableBase::OnResChanged (const SizeRatio&) {
}
} //namespace cloonel

View file

@ -23,6 +23,7 @@
#include "vectypes.hpp"
#include <cstddef>
#include <algorithm>
#include <functional>
namespace cloonel {
class SizeRatio;
@ -76,10 +77,12 @@ namespace cloonel {
SizeNotifiableBase& operator= ( const SizeNotifiableBase& ) = delete;
public:
virtual void NotifyResChanged ( const SizeRatio& parSize );
void NotifyResChanged ( const SizeRatio& parSize );
const float2& Ratio ( void ) const noexcept { return m_scaleRatio; }
private:
virtual void OnResChanged ( const SizeRatio& );
float2 m_scaleRatio;
};

View file

@ -111,9 +111,8 @@ namespace cloonel {
///--------------------------------------------------------------------------
///--------------------------------------------------------------------------
void TiledWallpaper::TileCountNotifiable::NotifyResChanged (const SizeRatio& parSize) {
void TiledWallpaper::TileCountNotifiable::OnResChanged (const SizeRatio& parSize) {
std::cout << "Autoregistering" << std::endl;
BaseClass::NotifyResChanged(parSize);
m_tileCount = CountTilesInScreen(vector_cast<ushort2>(parSize.Resolution()), vector_cast<ushort2>(m_tileSize));
#if defined(WITH_DEBUG_VISUALS)
m_screenRes = parSize.Resolution();

View file

@ -52,7 +52,6 @@ namespace cloonel {
TileCountNotifiable ( SDLMain* parMain, const ushort2& parTileSize );
virtual ~TileCountNotifiable ( void ) noexcept = default;
virtual void NotifyResChanged ( const SizeRatio& parSize );
const float2& tileCount ( void ) const noexcept { return m_tileCount; }
const float2& tileSize ( void ) const noexcept { return m_tileSize; }
#if defined(WITH_DEBUG_VISUALS)
@ -60,6 +59,8 @@ namespace cloonel {
#endif
private:
virtual void OnResChanged ( const SizeRatio& parSize ) override;
float2 m_tileCount;
const float2 m_tileSize;
#if defined(WITH_DEBUG_VISUALS)