aboutsummaryrefslogtreecommitdiff
path: root/src/example
diff options
context:
space:
mode:
authorheavydemon21 <nielsstunnebrink1@gmail.com>2024-12-17 13:36:35 +0100
committerheavydemon21 <nielsstunnebrink1@gmail.com>2024-12-17 13:36:35 +0100
commit31fe4b1d44a7a7114c7ef8c0c5310a6070214cb2 (patch)
tree14564711f3ce996ccb1000e3f4f07d265e6fab88 /src/example
parent0c02511f6a64766174cb0db3beb4cc159d3efdf7 (diff)
parent69ca7fdd738fd4ed98aefc07bab5a43486a55619 (diff)
Merge branch 'wouter/text-component' into niels/UI
Diffstat (limited to 'src/example')
-rw-r--r--src/example/FontExample.cpp5
-rw-r--r--src/example/loadfont.cpp10
2 files changed, 8 insertions, 7 deletions
diff --git a/src/example/FontExample.cpp b/src/example/FontExample.cpp
index 7b2dadb..6a334b1 100644
--- a/src/example/FontExample.cpp
+++ b/src/example/FontExample.cpp
@@ -1,6 +1,7 @@
#include <SDL2/SDL_ttf.h>
#include <chrono>
#include <crepe/api/Camera.h>
+#include <crepe/api/Config.h>
#include <crepe/api/GameObject.h>
#include <crepe/api/LoopManager.h>
#include <crepe/api/Scene.h>
@@ -11,7 +12,6 @@
#include <crepe/manager/EventManager.h>
#include <crepe/manager/Mediator.h>
#include <crepe/manager/ResourceManager.h>
-#include <crepe/api/Config.h>
#include <exception>
#include <iostream>
#include <memory>
@@ -37,7 +37,8 @@ class TestScene : public Scene {
public:
void load_scene() override {
GameObject text_object = this->new_object("test", "test", vec2{0, 0}, 0, 1);
- text_object.add_component<Text>(vec2(100, 100), vec2(0, 0), "OpenSymbol", Text::Data{});
+ text_object.add_component<Text>(vec2(100, 100), vec2(0, 0), "OpenSymbol",
+ Text::Data{});
text_object.add_component<BehaviorScript>().set_script<TestScript>();
text_object.add_component<Camera>(ivec2{300, 300}, vec2{100, 100}, Camera::Data{});
}
diff --git a/src/example/loadfont.cpp b/src/example/loadfont.cpp
index 36d00dd..ed67ffa 100644
--- a/src/example/loadfont.cpp
+++ b/src/example/loadfont.cpp
@@ -1,14 +1,14 @@
#include <SDL2/SDL_ttf.h>
+#include <crepe/api/Asset.h>
#include <crepe/api/Text.h>
#include <crepe/facade/Font.h>
#include <crepe/facade/SDLContext.h>
-#include <crepe/api/Asset.h>
#include <crepe/manager/Mediator.h>
#include <crepe/manager/ResourceManager.h>
#include <exception>
#include <iostream>
-#include <optional>
#include <memory>
+#include <optional>
using namespace crepe;
int main() {
@@ -20,11 +20,11 @@ int main() {
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), "OpenSymbol", Text::Data{},"test text", Asset(""));
+ 1, vec2(100, 100), vec2(0, 0), "OpenSymbol", Text::Data{}, "test text", Asset(""));
// std::cout << "Path: " << label->font.get_path() << std::endl;
- std::unique_ptr<Text> label2
- = std::make_unique<Text>(1, vec2(100, 100), vec2(0, 0),"fsaafdafsdafsdafsdasfdds", Text::Data{});
+ std::unique_ptr<Text> label2 = std::make_unique<Text>(
+ 1, vec2(100, 100), vec2(0, 0), "fsaafdafsdafsdafsdasfdds", Text::Data{});
Asset asset = Asset("test test");
label->font = asset;
std::cout << label->font.value().get_path() << std::endl;