From cced27fc5344f65aa0cc7c2c09d7289210a92dc5 Mon Sep 17 00:00:00 2001 From: kiritow <1362050620@qq.com> Date: Mon, 31 Jul 2017 00:23:33 +0800 Subject: [PATCH] Update Font --- SDLWrapper/Font.cpp | 6 +++--- SDLWrapper/Font.h | 9 ++++++--- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/SDLWrapper/Font.cpp b/SDLWrapper/Font.cpp index 2d94533..5a729c9 100644 --- a/SDLWrapper/Font.cpp +++ b/SDLWrapper/Font.cpp @@ -10,12 +10,12 @@ void Font::_set(TTF_Font* p) // private void Font::_clear() { - _font.reset(); + _font.release(); } // private TTF_Font* Font::_get() const { - return _font.get(); + return const_cast(_font.get()); } Font::Font(const std::string& FontFileName, size_t size) @@ -400,5 +400,5 @@ void Font::release() { _clear(); } -} /// End of namespace MiniEngine +} /// End of namespace MiniEngine diff --git a/SDLWrapper/Font.h b/SDLWrapper/Font.h index 19c9fe9..cd9d753 100644 --- a/SDLWrapper/Font.h +++ b/SDLWrapper/Font.h @@ -8,9 +8,11 @@ #include "Renderer.h" #include #include "__Plugin.h" +#include "__Noncopyable.h" +#include "_handler.h" namespace MiniEngine { -class Font +class Font : public NonCopyable { public: Font() = default; @@ -116,12 +118,13 @@ private: void _real_setFontStyle(int); int _style_caster(FontStyle); - std::shared_ptr _font; + res_ptr _font; + void _set(TTF_Font*); void _clear(); TTF_Font* _get() const; friend class _internal::Plugin; }; -} /// End of namespace MiniEngine +} /// End of namespace MiniEngine