void Device::init() { // Initialize CE_LOGI("Initializing Crown Engine %s...", version()); // Create resource manager CE_LOGD("Creating resource manager..."); _resource_manager = CE_NEW(_allocator, ResourceManager)(_fs); CE_LOGD("Creating material manager..."); material_manager::init(); debug_line::init(); _lua_environment = CE_NEW(_allocator, LuaEnvironment)(); _lua_environment->load_libs(); CE_LOGD("Crown Engine initialized."); CE_LOGD("Initializing Game..."); _is_init = true; _is_running = true; _last_time = os::clocktime(); _boot_package = create_resource_package(_boot_package_id); _boot_package->load(); _boot_package->flush(); _lua_environment->execute((LuaResource*)_resource_manager->get(SCRIPT_TYPE, _boot_script_id)); _lua_environment->call_global("init", 0); }
//----------------------------------------------------------------------------- void Device::init() { // Initialize CE_LOGI("Initializing Crown Engine %s...", version()); _resource_bundle = Bundle::create(_allocator, _fs); // Create resource manager CE_LOGD("Creating resource manager..."); _resource_manager = CE_NEW(_allocator, ResourceManager)(*_resource_bundle); // Create world manager CE_LOGD("Creating world manager..."); _world_manager = CE_NEW(_allocator, WorldManager)(); CE_LOGD("Creating material manager..."); material_manager::init(); CE_LOGD("Creating lua system..."); lua_system::init(); _lua_environment = CE_NEW(_allocator, LuaEnvironment)(lua_system::state()); CE_LOGD("Crown Engine initialized."); CE_LOGD("Initializing Game..."); _is_init = true; _is_running = true; _last_time = os::clocktime(); _boot_package = create_resource_package(_boot_package_id); _boot_package->load(); _boot_package->flush(); ResourceId bootid; bootid.type = LUA_TYPE; bootid.name = _boot_script_id; _lua_environment->execute((LuaResource*) _resource_manager->get(bootid)); _lua_environment->call_global("init", 0); }
//----------------------------------------------------------------------------- ResourcePackage* Device::create_resource_package(const char* name) { ResourceId resid("package", name); return create_resource_package((StringId64) resid.name); }