コード例 #1
0
ファイル: os_android.cpp プロジェクト: ErosOlmi/godot
void OS_Android::initialize(const VideoMode& p_desired,int p_video_driver,int p_audio_driver) {


	use_gl2=p_video_driver!=1;


	if (gfx_init_func)
		gfx_init_func(gfx_init_ud,use_gl2);

	AudioDriverManagerSW::add_driver(&audio_driver_android);


	if (use_gl2) {
		RasterizerGLES2 *rasterizer_gles22=memnew( RasterizerGLES2(false,use_reload_hooks,false,use_reload_hooks ) );
		if (gl_extensions)
			rasterizer_gles22->set_extensions(gl_extensions);
		rasterizer = rasterizer_gles22;
	} else {
		rasterizer = memnew( RasterizerGLES1(use_reload_hooks, use_reload_hooks) );

	}

	visual_server = memnew( VisualServerRaster(rasterizer) );
	if (get_render_thread_mode() != RENDER_THREAD_UNSAFE) {

		visual_server = memnew(VisualServerWrapMT(visual_server, false));
	};
	visual_server->init();
	visual_server->cursor_set_visible(false, 0);

	AudioDriverManagerSW::get_driver(p_audio_driver)->set_singleton();

	if (AudioDriverManagerSW::get_driver(p_audio_driver)->init()!=OK) {

		ERR_PRINT("Initializing audio failed.");
	}

	sample_manager = memnew( SampleManagerMallocSW );
	audio_server = memnew( AudioServerSW(sample_manager) );

	audio_server->set_mixer_params(AudioMixerSW::INTERPOLATION_LINEAR,false);
	audio_server->init();

	spatial_sound_server = memnew( SpatialSoundServerSW );
	spatial_sound_server->init();

	spatial_sound_2d_server = memnew( SpatialSound2DServerSW );
	spatial_sound_2d_server->init();

	//
	physics_server = memnew( PhysicsServerSW );
	physics_server->init();
	physics_2d_server = memnew( Physics2DServerSW );
	physics_2d_server->init();

	input = memnew( InputDefault );

}
コード例 #2
0
ファイル: os_bb10.cpp プロジェクト: baekdahl/godot
void OSBB10::initialize(const VideoMode& p_desired,int p_video_driver,int p_audio_driver) {

	data_dir = getenv("HOME");

	//Create a screen context that will be used to create an EGL surface to to receive libscreen events
	screen_create_context(&screen_cxt,0);

	//Initialize BPS library
	bps_initialize();

	//Use utility code to initialize EGL for 2D rendering with GL ES 1.1
	enum RENDERING_API api = GL_ES_2;
	#ifdef BB10_LGLES_OVERRIDE
	api = GL_ES_1;
	#endif
	if (EXIT_SUCCESS != bbutil_init(screen_cxt, api)) {
		bbutil_terminate();
		screen_destroy_context(screen_cxt);
		return;
	};

	EGLint surface_width, surface_height;

	eglQuerySurface(egl_disp, egl_surf, EGL_WIDTH, &surface_width);
	eglQuerySurface(egl_disp, egl_surf, EGL_HEIGHT, &surface_height);
	printf("screen size: %ix%i\n", surface_width, surface_height);
	VideoMode mode;
	mode.width = surface_width;
	mode.height = surface_height;
	mode.fullscreen = true;
	mode.resizable = false;
	set_video_mode(mode);

	//Signal BPS library that navigator and screen events will be requested
	screen_request_events(screen_cxt);
	navigator_request_events(0);
	virtualkeyboard_request_events(0);
	audiodevice_request_events(0);

	#ifdef DEBUG_ENABLED
	bps_set_verbosity(3);
	#endif

	accel_supported = accelerometer_is_supported();
	if (accel_supported)
		accelerometer_set_update_frequency(FREQ_40_HZ);
	pitch = 0;
	roll = 0;

	#ifdef BB10_LGLES_OVERRIDE
	rasterizer = memnew( RasterizerGLES1(false) );
	#else
	rasterizer = memnew( RasterizerGLES2(false, false) );
	#endif

	visual_server = memnew( VisualServerRaster(rasterizer) );
	visual_server->init();
	visual_server->cursor_set_visible(false, 0);

	audio_driver = memnew(AudioDriverBB10);
	audio_driver->set_singleton();
	audio_driver->init(NULL);

	physics_server = memnew( PhysicsServerSW );
	physics_server->init();
	physics_2d_server = memnew( Physics2DServerSW );
	physics_2d_server->init();

	input = memnew( InputDefault );

	#ifdef PAYMENT_SERVICE_ENABLED
	payment_service = memnew(PaymentService);
	Globals::get_singleton()->add_singleton(Globals::Singleton("InAppStore", payment_service));
	#endif

}