void init() { Lumix::copyString(m_pipeline_path, "pipelines/app.lua"); Lumix::copyString(m_startup_script_path, "startup.lua"); char cmd_line[1024]; Lumix::getCommandLine(cmd_line, Lumix::lengthOf(cmd_line)); Lumix::CommandLineParser parser(cmd_line); while (parser.next()) { if (parser.currentEquals("-pipeline")) { if (!parser.next()) break; parser.getCurrent(m_pipeline_path, Lumix::lengthOf(m_pipeline_path)); } else if(parser.currentEquals("-script")) { if (!parser.next()) break; parser.getCurrent(m_startup_script_path, Lumix::lengthOf(m_startup_script_path)); } } createWindow(); Lumix::g_log_info.getCallback().bind<outputToConsole>(); Lumix::g_log_warning.getCallback().bind<outputToConsole>(); Lumix::g_log_error.getCallback().bind<outputToConsole>(); Lumix::enableCrashReporting(false); m_file_system = Lumix::FS::FileSystem::create(m_allocator); m_mem_file_device = LUMIX_NEW(m_allocator, Lumix::FS::MemoryFileDevice)(m_allocator); m_disk_file_device = LUMIX_NEW(m_allocator, Lumix::FS::DiskFileDevice)("disk", "", m_allocator); m_pack_file_device = LUMIX_NEW(m_allocator, Lumix::FS::PackFileDevice)(m_allocator); m_file_system->mount(m_mem_file_device); m_file_system->mount(m_disk_file_device); m_file_system->mount(m_pack_file_device); m_pack_file_device->mount("data.pak"); m_file_system->setDefaultDevice("memory:disk:pack"); m_file_system->setSaveGameDevice("memory:disk"); m_engine = Lumix::Engine::create("", "", m_file_system, m_allocator); Lumix::Engine::PlatformData platform_data; platform_data.window_handle = (void*)(uintptr_t)m_window; platform_data.display = m_display; m_engine->setPlatformData(platform_data); m_engine->getPluginManager().load("renderer"); m_engine->getPluginManager().load("animation"); m_engine->getPluginManager().load("audio"); m_engine->getPluginManager().load("lua_script"); m_engine->getPluginManager().load("physics"); m_engine->getInputSystem().enable(true); Lumix::Renderer* renderer = static_cast<Lumix::Renderer*>(m_engine->getPluginManager().getPlugin("renderer")); m_pipeline = Lumix::Pipeline::create(*renderer, Lumix::Path(m_pipeline_path), m_engine->getAllocator()); m_pipeline->load(); while (m_engine->getFileSystem().hasWork()) { Lumix::MT::sleep(100); m_engine->getFileSystem().updateAsyncTransactions(); } m_universe = &m_engine->createUniverse(true); m_pipeline->setScene((Lumix::RenderScene*)m_universe->getScene(Lumix::crc32("renderer"))); m_pipeline->setViewport(0, 0, 600, 400); renderer->resize(600, 400); registerLuaAPI(); //while (ShowCursor(false) >= 0); // TODO // onResize(); // TODO }
Timer* Timer::create(IAllocator& allocator) { return LUMIX_NEW(allocator, TimerImpl)(allocator); }
Resource* TextureManager::createResource(const Path& path) { return LUMIX_NEW(m_allocator, Texture)(path, *this, m_allocator); }
static Lumix::IEditorCommand* createInsertMeshCommand(Lumix::WorldEditor& editor) { return LUMIX_NEW(editor.getAllocator(), InsertMeshCommand)(editor); }
Resource* AnimationManager::createResource(const Path& path) { return LUMIX_NEW(m_allocator, Animation)(path, getOwner(), m_allocator); }
ProfilerUI* ProfilerUI::create(Lumix::Engine& engine) { auto& allocator = static_cast<Lumix::Debug::Allocator&>(engine.getAllocator()); return LUMIX_NEW(engine.getAllocator(), ProfilerUIImpl)(allocator, engine); }
void TCPFileDevice::connect(const char* ip, uint16 port, IAllocator& allocator) { m_impl = LUMIX_NEW(allocator, TCPImpl)(allocator); m_impl->m_stream = m_impl->m_connector.connect(ip, port); }
IFile* TCPFileDevice::createFile(IFile*) { return LUMIX_NEW(m_impl->m_allocator, TCPFile)(m_impl->m_stream, *this, m_impl->m_spin_mutex); }
Manager::Manager(IAllocator& allocator) { m_impl = LUMIX_NEW(allocator, ManagerImpl)(allocator); }