diff options
author | heavydemon21 <nielsstunnebrink1@gmail.com> | 2024-12-17 13:36:35 +0100 |
---|---|---|
committer | heavydemon21 <nielsstunnebrink1@gmail.com> | 2024-12-17 13:36:35 +0100 |
commit | 31fe4b1d44a7a7114c7ef8c0c5310a6070214cb2 (patch) | |
tree | 14564711f3ce996ccb1000e3f4f07d265e6fab88 /src/crepe/facade | |
parent | 0c02511f6a64766174cb0db3beb4cc159d3efdf7 (diff) | |
parent | 69ca7fdd738fd4ed98aefc07bab5a43486a55619 (diff) |
Merge branch 'wouter/text-component' into niels/UI
Diffstat (limited to 'src/crepe/facade')
-rw-r--r-- | src/crepe/facade/Font.cpp | 3 | ||||
-rw-r--r-- | src/crepe/facade/FontFacade.cpp | 10 | ||||
-rw-r--r-- | src/crepe/facade/FontFacade.h | 10 | ||||
-rw-r--r-- | src/crepe/facade/SDLContext.cpp | 2 | ||||
-rw-r--r-- | src/crepe/facade/SDLContext.h | 7 |
5 files changed, 16 insertions, 16 deletions
diff --git a/src/crepe/facade/Font.cpp b/src/crepe/facade/Font.cpp index 9c1a800..81a9e7a 100644 --- a/src/crepe/facade/Font.cpp +++ b/src/crepe/facade/Font.cpp @@ -9,8 +9,7 @@ using namespace std; using namespace crepe; -Font::Font(const Asset & src, Mediator & mediator) - : Resource(src, mediator){ +Font::Font(const Asset & src, Mediator & mediator) : Resource(src, mediator) { Config & config = Config::get_instance(); const std::string FONT_PATH = src.get_path(); diff --git a/src/crepe/facade/FontFacade.cpp b/src/crepe/facade/FontFacade.cpp index 9919032..cec3507 100644 --- a/src/crepe/facade/FontFacade.cpp +++ b/src/crepe/facade/FontFacade.cpp @@ -7,16 +7,14 @@ using namespace crepe; using namespace std; -FontFacade::FontFacade(){ +FontFacade::FontFacade() { if (!FcInit()) { throw runtime_error("Failed to initialize Fontconfig."); } } -FontFacade::~FontFacade(){ - FcFini(); -} -Asset FontFacade::get_font_asset(const string& font_family) { - +FontFacade::~FontFacade() { FcFini(); } +Asset FontFacade::get_font_asset(const string & font_family) { + // Create a pattern to search for the font family FcPattern * pattern = FcNameParse(reinterpret_cast<const FcChar8 *>(font_family.c_str())); if (!pattern) { diff --git a/src/crepe/facade/FontFacade.h b/src/crepe/facade/FontFacade.h index 2e08f3f..9761070 100644 --- a/src/crepe/facade/FontFacade.h +++ b/src/crepe/facade/FontFacade.h @@ -15,10 +15,10 @@ class FontFacade { public: FontFacade(); ~FontFacade(); - FontFacade(const FontFacade & other) = delete; - FontFacade & operator=(const FontFacade & other) = delete; - FontFacade(FontFacade && other) noexcept = delete; - FontFacade & operator=(FontFacade && other) noexcept = delete; + FontFacade(const FontFacade & other) = delete; + FontFacade & operator=(const FontFacade & other) = delete; + FontFacade(FontFacade && other) noexcept = delete; + FontFacade & operator=(FontFacade && other) noexcept = delete; /** * * \brief Facade function to convert a font_family into an asset. @@ -28,7 +28,7 @@ public: * \param font_family Name of the font family name. * \return Asset with filepath to the corresponding font. */ - Asset get_font_asset(const std::string& font_family); + Asset get_font_asset(const std::string & font_family); }; } // namespace crepe diff --git a/src/crepe/facade/SDLContext.cpp b/src/crepe/facade/SDLContext.cpp index c19f0aa..a5ccdae 100644 --- a/src/crepe/facade/SDLContext.cpp +++ b/src/crepe/facade/SDLContext.cpp @@ -467,6 +467,6 @@ void SDLContext::set_color_texture(const Texture & texture, const Color & color) SDL_SetTextureAlphaMod(texture.get_img(), color.a); } -Asset SDLContext::get_font_from_name(const std::string& font_family){ +Asset SDLContext::get_font_from_name(const std::string & font_family) { return this->font_facade.get_font_asset(font_family); } diff --git a/src/crepe/facade/SDLContext.h b/src/crepe/facade/SDLContext.h index fcf3559..33a4ff9 100644 --- a/src/crepe/facade/SDLContext.h +++ b/src/crepe/facade/SDLContext.h @@ -18,6 +18,7 @@ #include "types.h" #include "FontFacade.h" + namespace crepe { class Texture; @@ -244,9 +245,11 @@ private: * - this is defined in this class because get_events() needs this information aswell */ CameraAuxiliaryData cam_aux_data; -private: + +private: //! instance of the font_facade FontFacade font_facade{}; + public: /** * \brief Function to Get asset from font_family @@ -257,7 +260,7 @@ public: * * \return asset with the font style absolute path */ - Asset get_font_from_name(const std::string& font_family); + Asset get_font_from_name(const std::string & font_family); }; } // namespace crepe |