#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: steady_clock::time_point start_time; 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(); 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{}); text_object.add_component().set_script(); text_object.add_component(ivec2{300,300},vec2{100,100},Camera::Data{ }); } std::string get_name() const override { return "hey"; } }; int main() { LoopManager engine; engine.add_scene(); engine.start(); return 0; }