From e75e355c3a59d53a1d64fd8fae3331b2234083e2 Mon Sep 17 00:00:00 2001 From: WBoerenkamps Date: Wed, 11 Dec 2024 22:17:43 +0100 Subject: text component pretty much finished --- src/example/loadfont.cpp | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) (limited to 'src/example/loadfont.cpp') diff --git a/src/example/loadfont.cpp b/src/example/loadfont.cpp index 8931ce3..0002026 100644 --- a/src/example/loadfont.cpp +++ b/src/example/loadfont.cpp @@ -1,13 +1,24 @@ #include +#include #include - #include +#include using namespace crepe; -int main(){ - SDLFontContext font_facade; - std::unique_ptr asset = font_facade.get_font_asset("OpenSymbol"); - std::cout << "path: " << asset->get_path() << std::endl; - return 0; +int main() { + SDLFontContext font_facade; + + // Create a unique pointer to the font asset + std::unique_ptr asset = font_facade.get_font_asset("OpenSymbol"); + std::cout << "path: " << asset->get_path() << std::endl; + try{ + // Correct way to create a unique pointer for Text + std::unique_ptr label = std::make_unique(1, vec2(100, 100), vec2(0, 0), *asset); + }catch (const std::exception& e) { + std::cout << "Standard exception thrown: " << e.what() << std::endl; + } + + + return 0; } -- cgit v1.2.3