diff options
author | heavydemon21 <nielsstunnebrink1@gmail.com> | 2024-12-17 09:09:32 +0100 |
---|---|---|
committer | heavydemon21 <nielsstunnebrink1@gmail.com> | 2024-12-17 09:09:32 +0100 |
commit | bfc07676707eae2c0161c6b86ccdd1583d96f71b (patch) | |
tree | b18bd17b0d07b3b51b2461462e3380d36905e61f /src/example/loadfont.cpp | |
parent | 2f8d36a33854715828d412792663f355b9e393ae (diff) | |
parent | d63eb7302d05fbe9b4c044ece3444e8ac4e56e02 (diff) |
Merge branch 'wouter/text-component' into niels/UI
Diffstat (limited to 'src/example/loadfont.cpp')
-rw-r--r-- | src/example/loadfont.cpp | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/src/example/loadfont.cpp b/src/example/loadfont.cpp index 35afdf7..ce287b4 100644 --- a/src/example/loadfont.cpp +++ b/src/example/loadfont.cpp @@ -1,5 +1,5 @@ -#include <crepe/api/Text.h> #include <SDL2/SDL_ttf.h> +#include <crepe/api/Text.h> #include <crepe/facade/Font.h> #include <crepe/facade/SDLContext.h> #include <crepe/manager/Mediator.h> @@ -13,6 +13,7 @@ int main() { // SDLFontContext font_facade; Mediator mediator; SDLContext sdl_context{mediator}; + // ComponentManager component_manager{mediator}; ResourceManager resource_manager{mediator}; try { // Correct way to create a unique pointer for Text @@ -24,14 +25,14 @@ int main() { = std::make_unique<Text>(1, vec2(100, 100), vec2(0, 0), "test test", "fsaafdafsdafsdafsdasfdds", Text::Data{}); std::cout << "Path: " << label2->font.get_path() << std::endl; - ResourceManager & resource_mgr = mediator.resource_manager; - const Font & res = resource_manager.get<Font>(label->font); - TTF_Font * test_font = res.get_font(); - if(test_font == NULL){ - std::cout << "error with font" << std::endl; - }else{ - std::cout << "correct font retrieved" << std::endl; - } + ResourceManager & resource_mgr = mediator.resource_manager; + const Font & res = resource_manager.get<Font>(label->font); + TTF_Font * test_font = res.get_font(); + if (test_font == NULL) { + std::cout << "error with font" << std::endl; + } else { + std::cout << "correct font retrieved" << std::endl; + } } catch (const std::exception & e) { std::cout << "Standard exception thrown: " << e.what() << std::endl; } |