diff options
author | WBoerenkamps <wrj.boerenkamps@student.avans.nl> | 2024-12-12 20:45:49 +0100 |
---|---|---|
committer | WBoerenkamps <wrj.boerenkamps@student.avans.nl> | 2024-12-12 20:45:49 +0100 |
commit | 431d7cceb25db86f31a8c89440f3cdd2c7bf061f (patch) | |
tree | eb32cf71b0f3fe369cd4509c54b8df960e2765e4 /src/example | |
parent | e75e355c3a59d53a1d64fd8fae3331b2234083e2 (diff) |
load font almost working
Diffstat (limited to 'src/example')
-rw-r--r-- | src/example/loadfont.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/example/loadfont.cpp b/src/example/loadfont.cpp index 0002026..fe5466f 100644 --- a/src/example/loadfont.cpp +++ b/src/example/loadfont.cpp @@ -3,18 +3,19 @@ #include <memory> #include <crepe/facade/SDLFontContext.h> #include <crepe/api/Text.h> - +#include <crepe/facade/Font.h> +#include <crepe/manager/Mediator.h> using namespace crepe; int main() { SDLFontContext font_facade; - - // Create a unique pointer to the font asset - std::unique_ptr<Asset> asset = font_facade.get_font_asset("OpenSymbol"); - std::cout << "path: " << asset->get_path() << std::endl; + Mediator 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), *asset); + std::unique_ptr<Text> label = std::make_unique<Text>(1, vec2(100, 100), vec2(0, 0), "test test","OpenSymbol"); + std::unique_ptr<Asset> asset = font_facade.get_font_asset(label->font_family); + std::cout << "path: " << asset->get_path() << std::endl; + std::unique_ptr<Font> font = make_unique<Font>(asset,mediator) }catch (const std::exception& e) { std::cout << "Standard exception thrown: " << e.what() << std::endl; } |