Engine* Engine::create(FS::FileSystem* fs, IAllocator& allocator) { installUnhandledExceptionHandler(); g_log_info.getCallback().bind<showLogInVS>(); g_log_warning.getCallback().bind<showLogInVS>(); g_log_error.getCallback().bind<showLogInVS>(); EngineImpl* engine = allocator.newObject<EngineImpl>(fs, allocator); if (!engine->create()) { allocator.deleteObject(engine); return nullptr; } return engine; }
Engine* Engine::create(FS::FileSystem* fs, IAllocator& allocator) { g_log_info.log("engine") << "Creating engine..."; Profiler::setThreadName("Main"); installUnhandledExceptionHandler(); g_is_error_file_opened = g_error_file.open("error.log", FS::Mode::CREATE | FS::Mode::WRITE, allocator); g_log_error.getCallback().bind<logErrorToFile>(); g_log_info.getCallback().bind<showLogInVS>(); g_log_warning.getCallback().bind<showLogInVS>(); g_log_error.getCallback().bind<showLogInVS>(); EngineImpl* engine = LUMIX_NEW(allocator, EngineImpl)(fs, allocator); if (!engine->create()) { g_log_error.log("engine") << "Failed to create engine."; LUMIX_DELETE(allocator, engine); return nullptr; } g_log_info.log("engine") << "Engine created."; return engine; }