aboutsummaryrefslogtreecommitdiff
path: root/src/example/loadfont.cpp
diff options
context:
space:
mode:
authorWBoerenkamps <wrj.boerenkamps@student.avans.nl>2024-12-11 22:17:43 +0100
committerWBoerenkamps <wrj.boerenkamps@student.avans.nl>2024-12-11 22:17:43 +0100
commite75e355c3a59d53a1d64fd8fae3331b2234083e2 (patch)
tree24176a074d529271e7279794f7fa2dcf5aed2525 /src/example/loadfont.cpp
parentbb2a6f1a0ab19f6cbc78b2747a26920f24bf13ca (diff)
text component pretty much finished
Diffstat (limited to 'src/example/loadfont.cpp')
-rw-r--r--src/example/loadfont.cpp23
1 files changed, 17 insertions, 6 deletions
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 <iostream>
+#include <exception>
#include <memory>
-
#include <crepe/facade/SDLFontContext.h>
+#include <crepe/api/Text.h>
using namespace crepe;
-int main(){
- SDLFontContext font_facade;
- std::unique_ptr<Asset> 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> 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<Text> label = std::make_unique<Text>(1, vec2(100, 100), vec2(0, 0), *asset);
+ }catch (const std::exception& e) {
+ std::cout << "Standard exception thrown: " << e.what() << std::endl;
+ }
+
+
+ return 0;
}