From d63eb7302d05fbe9b4c044ece3444e8ac4e56e02 Mon Sep 17 00:00:00 2001 From: WBoerenkamps Date: Mon, 16 Dec 2024 23:00:33 +0100 Subject: make format --- src/example/FontExample.cpp | 52 +++++++++++++++++++++------------------------ src/example/loadfont.cpp | 18 ++++++++-------- 2 files changed, 33 insertions(+), 37 deletions(-) (limited to 'src/example') diff --git a/src/example/FontExample.cpp b/src/example/FontExample.cpp index c2f21c4..3f5af48 100644 --- a/src/example/FontExample.cpp +++ b/src/example/FontExample.cpp @@ -1,49 +1,45 @@ -#include #include +#include +#include +#include +#include +#include +#include +#include #include #include +#include #include #include -#include -#include -#include -#include -#include -#include #include #include #include -#include using namespace crepe; using namespace std; using namespace std::chrono; -class TestScript : public Script{ - public: +class TestScript : public Script { +public: steady_clock::time_point start_time; - virtual void init() override{ - start_time = steady_clock::now(); - } - virtual void update() override{ + virtual void init() override { start_time = steady_clock::now(); } + virtual void update() override { auto now = steady_clock::now(); - auto elapsed = duration_cast(now - start_time).count(); + auto elapsed = duration_cast(now - start_time).count(); - if (elapsed >= 5) { - Mediator& med = mediator; - EventManager& event_mgr = med.event_manager; + if (elapsed >= 5) { + Mediator & med = mediator; + EventManager & event_mgr = med.event_manager; event_mgr.trigger_event(); - } + } } }; -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(vec2(100, 100), vec2(0, 0), "test test", - "Noto Sans", Text::Data{}); +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(vec2(100, 100), vec2(0, 0), "test test", "Noto Sans", + Text::Data{}); text_object.add_component().set_script(); - text_object.add_component(ivec2{300,300},vec2{100,100},Camera::Data{ - }); - + text_object.add_component(ivec2{300, 300}, vec2{100, 100}, Camera::Data{}); } std::string get_name() const override { return "hey"; } }; diff --git a/src/example/loadfont.cpp b/src/example/loadfont.cpp index f863053..ce287b4 100644 --- a/src/example/loadfont.cpp +++ b/src/example/loadfont.cpp @@ -1,5 +1,5 @@ -#include #include +#include #include #include #include @@ -25,14 +25,14 @@ int main() { = std::make_unique(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(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(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; } -- cgit v1.2.3