diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/crepe/api/Text.cpp | 4 | ||||
-rw-r--r-- | src/crepe/api/Text.h | 4 | ||||
-rw-r--r-- | src/crepe/facade/Font.cpp | 2 | ||||
-rw-r--r-- | src/crepe/facade/Font.h | 2 | ||||
-rw-r--r-- | src/crepe/facade/SDLContext.cpp | 2 | ||||
-rw-r--r-- | src/example/loadfont.cpp | 6 |
6 files changed, 10 insertions, 10 deletions
diff --git a/src/crepe/api/Text.cpp b/src/crepe/api/Text.cpp index 9de9038..568af7f 100644 --- a/src/crepe/api/Text.cpp +++ b/src/crepe/api/Text.cpp @@ -2,8 +2,8 @@ using namespace crepe; -Text::Text(game_object_id_t id, const vec2 & dimensions, const vec2 & offset, const std::string & text, - const std::string & font_family,const Data & data) +Text::Text(game_object_id_t id, const vec2 & dimensions, const vec2 & offset, + const std::string & text, const std::string & font_family, const Data & data) : UIObject(id, dimensions, offset), text(text), data(data), diff --git a/src/crepe/api/Text.h b/src/crepe/api/Text.h index 96e1265..64b2008 100644 --- a/src/crepe/api/Text.h +++ b/src/crepe/api/Text.h @@ -39,8 +39,8 @@ public: }; public: - Text(game_object_id_t id, const vec2 & dimensions, const vec2 & offset, const std::string &, - const std::string & font_family, const Data& data); + Text(game_object_id_t id, const vec2 & dimensions, const vec2 & offset, + const std::string &, const std::string & font_family, const Data & data); //! font family name such as (Arial,Helvetica,Inter) std::string font_family = ""; //! Label text. diff --git a/src/crepe/facade/Font.cpp b/src/crepe/facade/Font.cpp index f111af9..1ee3de1 100644 --- a/src/crepe/facade/Font.cpp +++ b/src/crepe/facade/Font.cpp @@ -13,7 +13,7 @@ Font::Font(const Asset & src, Mediator & mediator) TTF_Font * font = TTF_OpenFont(FONT_PATH.c_str(), config.font.size); if (font == NULL) throw runtime_error(format("Font: {} (path: {})", TTF_GetError(), FONT_PATH)); - this->font = { font, [] (TTF_Font * font) { TTF_CloseFont(font); } }; + this->font = {font, [](TTF_Font * font) { TTF_CloseFont(font); }}; } TTF_Font * Font::get_font() const { return this->font.get(); } diff --git a/src/crepe/facade/Font.h b/src/crepe/facade/Font.h index f7d5b50..e93bfe9 100644 --- a/src/crepe/facade/Font.h +++ b/src/crepe/facade/Font.h @@ -35,7 +35,7 @@ public: private: //! The SDL_ttf font object with custom deleter. - std::unique_ptr<TTF_Font, std::function<void(TTF_Font*)>> font; + std::unique_ptr<TTF_Font, std::function<void(TTF_Font *)>> font; }; } // namespace crepe diff --git a/src/crepe/facade/SDLContext.cpp b/src/crepe/facade/SDLContext.cpp index 47dda81..d1d109c 100644 --- a/src/crepe/facade/SDLContext.cpp +++ b/src/crepe/facade/SDLContext.cpp @@ -6,8 +6,8 @@ #include <SDL2/SDL_rect.h> #include <SDL2/SDL_render.h> #include <SDL2/SDL_surface.h> -#include <SDL2/SDL_video.h> #include <SDL2/SDL_ttf.h> +#include <SDL2/SDL_video.h> #include <array> #include <cmath> #include <cstddef> diff --git a/src/example/loadfont.cpp b/src/example/loadfont.cpp index 6020908..dae64bc 100644 --- a/src/example/loadfont.cpp +++ b/src/example/loadfont.cpp @@ -14,13 +14,13 @@ int main() { SDLContext sdl_context{mediator}; try { // Correct way to create a unique pointer for Text - std::unique_ptr<Text> label - = std::make_unique<Text>(1, vec2(100, 100), vec2(0, 0), "test test", "OpenSymbol",Text::Data{}); + std::unique_ptr<Text> label = std::make_unique<Text>( + 1, vec2(100, 100), vec2(0, 0), "test test", "OpenSymbol", Text::Data{}); Asset asset = font_facade.get_font_asset(label->font_family); std::cout << "path: " << asset.get_path() << std::endl; std::unique_ptr<Font> font = std::make_unique<Font>(asset, mediator); // Get the TTF_Font from the Font object - TTF_Font* ttf_font = font->get_font(); + TTF_Font * ttf_font = font->get_font(); //example if the asset is not correct for font //std::unique_ptr<Font> fontThrow = std::make_unique<Font>(Asset("../help.txt"), mediator); // Check if the font is loaded properly |