/** \file * * Standalone example for usage of the internal ECS */ #include #include #include #include #include #include #include #include using namespace crepe; using namespace std; #define OBJ_COUNT 100000 int main() { dbg_trace(); ComponentManager mgr{}; auto start_adding = chrono::high_resolution_clock::now(); GameObject * game_object[OBJ_COUNT]; for (int i = 0; i < OBJ_COUNT; ++i) { GameObject obj = mgr.new_object("Name", "Tag"); obj.add_component("test"); obj.add_component(0, 0, i); } auto stop_adding = chrono::high_resolution_clock::now(); auto sprites = mgr.get_components_by_type(); for (auto sprite : sprites) { assert(true); } auto stop_looping = chrono::high_resolution_clock::now(); auto add_time = chrono::duration_cast(stop_adding - start_adding); auto loop_time = chrono::duration_cast(stop_looping - stop_adding); printf("add time: %ldus\n", add_time.count()); printf("loop time: %ldus\n", loop_time.count()); return 0; }