예제 #1
0
파일: device.cpp 프로젝트: dgu123/crown
//-----------------------------------------------------------------------------
void Device::shutdown()
{
	CE_ASSERT(_is_init, "Engine is not initialized");

	// Shutdowns the game
	_lua_environment->call_global("shutdown", 0);

	_boot_package->unload();
	destroy_resource_package(_boot_package);

	CE_LOGD("Releasing lua system...");
	lua_system::shutdown();
	CE_DELETE(_allocator, _lua_environment);

	CE_LOGD("Releasing material manager...");
	material_manager::shutdown();

	CE_LOGD("Releasing world manager...");
	CE_DELETE(_allocator, _world_manager);

	CE_LOGD("Releasing resource manager...");
	CE_DELETE(_allocator, _resource_manager);

	Bundle::destroy(_allocator, _resource_bundle);

	_allocator.clear();
	_is_init = false;
}
예제 #2
0
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);
}
예제 #3
0
	void init()
	{
		s_al_device = alcOpenDevice(NULL);
		CE_ASSERT(s_al_device, "Cannot open OpenAL audio device");

		s_al_context = alcCreateContext(s_al_device, NULL);
		CE_ASSERT(s_al_context, "Cannot create OpenAL context");

		AL_CHECK(alcMakeContextCurrent(s_al_context));

		CE_LOGD("OpenAL Vendor   : %s", alGetString(AL_VENDOR));
		CE_LOGD("OpenAL Version  : %s", alGetString(AL_VERSION));
		CE_LOGD("OpenAL Renderer : %s", alGetString(AL_RENDERER));

		AL_CHECK(alDistanceModel(AL_INVERSE_DISTANCE_CLAMPED));
		AL_CHECK(alDopplerFactor(1.0f));
		AL_CHECK(alDopplerVelocity(343.0f));
	}
예제 #4
0
파일: device.cpp 프로젝트: dgu123/crown
//-----------------------------------------------------------------------------
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);
}