• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ GLOBAL_DEF函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中GLOBAL_DEF函数的典型用法代码示例。如果您正苦于以下问题:C++ GLOBAL_DEF函数的具体用法?C++ GLOBAL_DEF怎么用?C++ GLOBAL_DEF使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了GLOBAL_DEF函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: GLOBAL_DEF

BroadPhase2DHashGrid::BroadPhase2DHashGrid() {

	hash_table_size = GLOBAL_DEF("physics_2d/bp_hash_table_size",4096);
	hash_table_size = Math::larger_prime(hash_table_size);
	hash_table = memnew_arr( PosBin*, hash_table_size);

	cell_size = GLOBAL_DEF("physics_2d/cell_size",128);

	for(int i=0;i<hash_table_size;i++)
		hash_table[i]=NULL;
	pass=1;

	current=0;
}
开发者ID:MonochromeBears,项目名称:godot,代码行数:14,代码来源:broad_phase_2d_hash_grid.cpp


示例2: GLOBAL_DEF

BroadPhase2DHashGrid::BroadPhase2DHashGrid() {

	hash_table_size = GLOBAL_DEF("physics/2d/bp_hash_table_size", 4096);
	hash_table_size = Math::larger_prime(hash_table_size);
	hash_table = memnew_arr(PosBin *, hash_table_size);

	cell_size = GLOBAL_DEF("physics/2d/cell_size", 128);
	large_object_min_surface = GLOBAL_DEF("physics/2d/large_object_surface_threshold_in_cells", 512);

	for (int i = 0; i < hash_table_size; i++)
		hash_table[i] = NULL;
	pass = 1;

	current = 0;
}
开发者ID:GalanCM,项目名称:godot,代码行数:15,代码来源:broad_phase_2d_hash_grid.cpp


示例3: run

Error EditorRun::run(const String& p_scene,const String p_custom_args,const List<String>& p_breakpoints,const String& p_edited_scene) {

    List<String> args;


    String resource_path = Globals::get_singleton()->get_resource_path();

    if (resource_path!="") {
        args.push_back("-path");
        args.push_back(resource_path.replace(" ","%20"));

    }

    if (true) {
        args.push_back("-rdebug");
        args.push_back("localhost:"+String::num(GLOBAL_DEF("debug/debug_port", 6007)));
    }

    if (p_custom_args!="") {

        Vector<String> cargs=p_custom_args.split(" ",false);
        for(int i=0; i<cargs.size(); i++) {

            args.push_back(cargs[i].replace("%20"," ").replace("$scene",p_edited_scene.replace(" ","%20")));
        }
    }

    if (p_breakpoints.size()) {

        args.push_back("-bp");
        String bpoints;
        for(const List<String>::Element *E=p_breakpoints.front(); E; E=E->next()) {

            bpoints+=E->get().replace(" ","%20");
            if (E->next())
                bpoints+=",";
        }

        args.push_back(bpoints);
    }

    args.push_back(p_scene);

    String exec = OS::get_singleton()->get_executable_path();

    printf("running: %ls", exec.c_str());
    for (List<String>::Element* E = args.front(); E ; E = E->next()) {

        printf(" %ls", E->get().c_str());
    };
    printf("\n");

    pid=0;
    Error err = OS::get_singleton()->execute(exec,args,false,&pid);
    ERR_FAIL_COND_V(err,err);

    status = STATUS_PLAY;

    return OK;
}
开发者ID:9cat,项目名称:godot,代码行数:60,代码来源:editor_run.cpp


示例4: GLOBAL_DEF

EditorFileSystem::EditorFileSystem() {

	reimport_on_missing_imported_files = GLOBAL_DEF("editor/reimport_missing_imported_files", true);

	singleton = this;
	filesystem = memnew(EditorFileSystemDirectory); //like, empty
	filesystem->parent = NULL;

	thread = NULL;
	scanning = false;
	importing = false;
	use_threads = true;
	thread_sources = NULL;
	new_filesystem = NULL;

	abort_scan = false;
	scanning_changes = false;
	scanning_changes_done = false;
	ResourceSaver::set_save_callback(_resource_saved);

	DirAccess *da = DirAccess::create(DirAccess::ACCESS_RESOURCES);
	if (da->change_dir("res://.import") != OK) {
		da->make_dir("res://.import");
	}
	memdelete(da);

	scan_total = 0;
}
开发者ID:rrrfffrrr,项目名称:godot,代码行数:28,代码来源:editor_file_system.cpp


示例5: mouse_move

void OSIPhone::mouse_move(int p_idx, int p_prev_x, int p_prev_y, int p_x, int p_y, bool p_use_as_mouse) {

	if (!GLOBAL_DEF("debug/disable_touch", false)) {

		Ref<InputEventScreenDrag> ev;
		ev.instance();
		ev->set_index(p_idx);
		ev->set_position(Vector2(p_x, p_y));
		ev->set_relative(Vector2(p_x - p_prev_x, p_y - p_prev_y));
		queue_event(ev);
	};

	if (p_use_as_mouse) {
		Ref<InputEventMouseMotion> ev;
		ev.instance();

		ev->set_position(Vector2(p_x, p_y));
		ev->set_global_position(Vector2(p_x, p_y));
		ev->set_relative(Vector2(p_x - p_prev_x, p_y - p_prev_y));

		input->set_mouse_position(ev->get_position());
		ev->set_speed(input->get_last_mouse_speed());
		ev->set_button_mask(BUTTON_LEFT); // pressed

		queue_event(ev);
	};
};
开发者ID:arcanis,项目名称:godot,代码行数:27,代码来源:os_iphone.cpp


示例6: mouse_button

void OSIPhone::mouse_button(int p_idx, int p_x, int p_y, bool p_pressed, bool p_doubleclick, bool p_use_as_mouse) {

	if (!GLOBAL_DEF("debug/disable_touch", false)) {
		Ref<InputEventScreenTouch> ev;
		ev.instance();

		ev->set_index(p_idx);
		ev->set_pressed(p_pressed);
		ev->set_position(Vector2(p_x, p_y));
		queue_event(ev);
	};

	mouse_list.pressed[p_idx] = p_pressed;

	if (p_use_as_mouse) {

		Ref<InputEventMouseButton> ev;
		ev.instance();

		ev->set_position(Vector2(p_x, p_y));
		ev->set_global_position(Vector2(p_x, p_y));

		//mouse_list.pressed[p_idx] = p_pressed;

		input->set_mouse_position(ev->get_position());
		ev->set_button_index(BUTTON_LEFT);
		ev->set_doubleclick(p_doubleclick);
		ev->set_pressed(p_pressed);

		queue_event(ev);
	};
};
开发者ID:arcanis,项目名称:godot,代码行数:32,代码来源:os_iphone.cpp


示例7: memnew

ScriptDebuggerRemote::ScriptDebuggerRemote() {

	tcp_client  = StreamPeerTCP::create_ref();
	packet_peer_stream = Ref<PacketPeerStream>( memnew(PacketPeerStream) );
	packet_peer_stream->set_stream_peer(tcp_client);
	mutex = Mutex::create();
	locking=false;

	phl.printfunc=_print_handler;
	phl.userdata=this;
	add_print_handler(&phl);
	requested_quit=false;
	performance = Globals::get_singleton()->get_singleton_object("Performance");
	last_perf_time=0;
	poll_every=0;
	request_scene_tree=NULL;
	live_edit_funcs=NULL;
	max_cps = GLOBAL_DEF("debug/max_remote_stdout_chars_per_second",2048);
	char_count=0;
	msec_count=0;
	last_msec=0;

	eh.errfunc=_err_handler;
	eh.userdata=this;
	add_error_handler(&eh);

}
开发者ID:a12n,项目名称:godot,代码行数:27,代码来源:script_debugger_remote.cpp


示例8: command_queue

VisualServerWrapMT::VisualServerWrapMT(VisualServer* p_contained,bool p_create_thread) : command_queue(p_create_thread) {

	visual_server=p_contained;
	create_thread=p_create_thread;
	thread=NULL;
	draw_mutex=NULL;
	draw_pending=0;
	draw_thread_up=false;
	alloc_mutex=Mutex::create();
	texture_pool_max_size=GLOBAL_DEF("render/thread_textures_prealloc",20);
	mesh_pool_max_size=GLOBAL_DEF("render/thread_meshes_prealloc",20);
	if (!p_create_thread) {
		server_thread=Thread::get_caller_ID();
	} else {
		server_thread=0;
	}
}
开发者ID:MonochromeBears,项目名称:godot,代码行数:17,代码来源:visual_server_wrap_mt.cpp


示例9: Android_JNI_OpenAudioDevice

Error AudioDriverAndroid::init(){

	mutex = Mutex::create();
/*
	// TODO: pass in/return a (Java) device ID, also whether we're opening for input or output
	   this->spec.samples = Android_JNI_OpenAudioDevice(this->spec.freq, this->spec.format == AUDIO_U8 ? 0 : 1, this->spec.channels, this->spec.samples);
	   SDL_CalculateAudioSpec(&this->spec);

	   if (this->spec.samples == 0) {
	       // Init failed?
	       SDL_SetError("Java-side initialization failed!");
	       return 0;
	   }
*/

	//Android_JNI_SetupThread();


  //        __android_log_print(ANDROID_LOG_VERBOSE, "SDL", "SDL audio: opening device");


	JNIEnv *env = ThreadAndroid::get_env();
	int mix_rate = GLOBAL_DEF("audio/mix_rate",44100);

	int latency = GLOBAL_DEF("audio/output_latency",25);
	latency=50;
	unsigned int buffer_size = nearest_power_of_2( latency * mix_rate / 1000 );
	if (OS::get_singleton()->is_stdout_verbose()) {
		print_line("audio buffer size: "+itos(buffer_size));
	}

	__android_log_print(ANDROID_LOG_INFO,"godot","Initializing audio! params: %i,%i ",mix_rate,buffer_size);
	audioBuffer = env->CallObjectMethod(io,_init_audio, mix_rate, buffer_size);


	ERR_FAIL_COND_V( audioBuffer == NULL, ERR_INVALID_PARAMETER);

	audioBuffer = env->NewGlobalRef(audioBuffer);

	jboolean isCopy = JNI_FALSE;
	audioBufferPinned = env->GetShortArrayElements((jshortArray)audioBuffer, &isCopy);
	audioBufferFrames = env->GetArrayLength((jshortArray)audioBuffer);
	audioBuffer32 = memnew_arr(int32_t,audioBufferFrames);

	return OK;
}
开发者ID:baekdahl,项目名称:godot,代码行数:46,代码来源:audio_driver_jandroid.cpp


示例10:

VisualServer::VisualServer() {

//	ERR_FAIL_COND(singleton);
	singleton=this;
	mm_policy=GLOBAL_DEF("render/mipmap_policy",0);
	if (mm_policy<0 || mm_policy>2)
		mm_policy=0;

}
开发者ID:9cat,项目名称:godot,代码行数:9,代码来源:visual_server.cpp


示例11:

PacketPeerStream::PacketPeerStream() {


	int rbsize=GLOBAL_DEF( "core/packet_stream_peer_max_buffer_po2",(16));

	ring_buffer.resize(rbsize);
	temp_buffer.resize(1<<rbsize);


}
开发者ID:3miu,项目名称:godot,代码行数:10,代码来源:packet_peer.cpp


示例12: GLOBAL_DEF

Error AudioDriverXAudio2::init() {

	active = false;
	thread_exited = false;
	exit_thread = false;
	pcm_open = false;
	samples_in = NULL;

	mix_rate = 48000;
	// FIXME: speaker_mode seems unused in the Xaudio2 driver so far
	speaker_mode = SPEAKER_MODE_STEREO;
	channels = 2;

	int latency = GLOBAL_DEF("audio/output_latency", 25);
	buffer_size = closest_power_of_2(latency * mix_rate / 1000);

	samples_in = memnew_arr(int32_t, buffer_size * channels);
	for (int i = 0; i < AUDIO_BUFFERS; i++) {
		samples_out[i] = memnew_arr(int16_t, buffer_size * channels);
		xaudio_buffer[i].AudioBytes = buffer_size * channels * sizeof(int16_t);
		xaudio_buffer[i].pAudioData = (const BYTE *)(samples_out[i]);
		xaudio_buffer[i].Flags = 0;
	}

	HRESULT hr;
	hr = XAudio2Create(&xaudio, 0, XAUDIO2_DEFAULT_PROCESSOR);
	if (hr != S_OK) {
		ERR_EXPLAIN("Error creating XAudio2 engine.");
		ERR_FAIL_V(ERR_UNAVAILABLE);
	}
	hr = xaudio->CreateMasteringVoice(&mastering_voice);
	if (hr != S_OK) {
		ERR_EXPLAIN("Error creating XAudio2 mastering voice.");
		ERR_FAIL_V(ERR_UNAVAILABLE);
	}

	wave_format.nChannels = channels;
	wave_format.cbSize = 0;
	wave_format.nSamplesPerSec = mix_rate;
	wave_format.wFormatTag = WAVE_FORMAT_PCM;
	wave_format.wBitsPerSample = 16;
	wave_format.nBlockAlign = channels * wave_format.wBitsPerSample >> 3;
	wave_format.nAvgBytesPerSec = mix_rate * wave_format.nBlockAlign;

	hr = xaudio->CreateSourceVoice(&source_voice, &wave_format, 0, XAUDIO2_MAX_FREQ_RATIO, &voice_callback);
	if (hr != S_OK) {
		ERR_EXPLAIN("Error creating XAudio2 source voice. " + itos(hr));
		ERR_FAIL_V(ERR_UNAVAILABLE);
	}

	mutex = Mutex::create();
	thread = Thread::create(AudioDriverXAudio2::thread_func, this);

	return OK;
};
开发者ID:rrrfffrrr,项目名称:godot,代码行数:55,代码来源:audio_driver_xaudio2.cpp


示例13: ERR_FAIL_COND

MessageQueue::MessageQueue() {

	ERR_FAIL_COND(singleton!=NULL);
	singleton=this;

	buffer_end=0;
	buffer_max_used=0;
	buffer_size=GLOBAL_DEF( "core/message_queue_size_kb", DEFAULT_QUEUE_SIZE_KB );
	buffer_size*=1024;
	buffer = memnew_arr( uint8_t, buffer_size );
}
开发者ID:03050903,项目名称:godot,代码行数:11,代码来源:message_queue.cpp


示例14: touch_drag

void OSIPhone::touch_drag(int p_idx, int p_prev_x, int p_prev_y, int p_x, int p_y) {

	if (!GLOBAL_DEF("debug/disable_touch", false)) {

		Ref<InputEventScreenDrag> ev;
		ev.instance();
		ev->set_index(p_idx);
		ev->set_position(Vector2(p_x, p_y));
		ev->set_relative(Vector2(p_x - p_prev_x, p_y - p_prev_y));
		queue_event(ev);
	};
};
开发者ID:RandomShaper,项目名称:godot,代码行数:12,代码来源:os_iphone.cpp


示例15: GLOBAL_DEF

FileAccessNetwork::FileAccessNetwork() {

	eof_flag=false;
	opened=false;
	pos=0;
	sem=Semaphore::create();
	page_sem=Semaphore::create();
	buffer_mutex=Mutex::create();
	FileAccessNetworkClient *nc = FileAccessNetworkClient::singleton;
	nc->lock_mutex();
	id=nc->last_id++;
	nc->accesses[id]=this;
	nc->unlock_mutex();
	page_size = GLOBAL_DEF("remote_fs/page_size",65536);
	read_ahead = GLOBAL_DEF("remote_fs/page_read_ahead",4);
	max_pages = GLOBAL_DEF("remote_fs/max_pages",20);
	last_activity_val=0;
	waiting_on_page=-1;
	last_page=-1;


}
开发者ID:AwsomeGameEngine,项目名称:godot,代码行数:22,代码来源:file_access_network.cpp


示例16: touch_press

void OSIPhone::touch_press(int p_idx, int p_x, int p_y, bool p_pressed, bool p_doubleclick) {

	if (!GLOBAL_DEF("debug/disable_touch", false)) {
		Ref<InputEventScreenTouch> ev;
		ev.instance();

		ev->set_index(p_idx);
		ev->set_pressed(p_pressed);
		ev->set_position(Vector2(p_x, p_y));
		queue_event(ev);
	};

	touch_list.pressed[p_idx] = p_pressed;
};
开发者ID:RandomShaper,项目名称:godot,代码行数:14,代码来源:os_iphone.cpp


示例17: GLOBAL_DEF

ResourceFormatLoaderImage::ResourceFormatLoaderImage() {

	max_texture_size = GLOBAL_DEF("debug/max_texture_size",0);
	GLOBAL_DEF("debug/max_texture_size_alert",false);
	debug_load_times=GLOBAL_DEF("debug/image_load_times",false);
	GLOBAL_DEF("texture_import/filter",true);
	GLOBAL_DEF("texture_import/gen_mipmaps",true);
	GLOBAL_DEF("texture_import/repeat",true);

}
开发者ID:0871087123,项目名称:godot,代码行数:10,代码来源:resource_format_image.cpp


示例18: stop

void ScriptEditorDebugger::start() {

	stop();


	uint16_t port = GLOBAL_DEF("debug/remote_port",6007);
	perf_history.clear();
	for(int i=0;i<Performance::MONITOR_MAX;i++) {

		perf_max[i]=0;
	}

	server->listen(port);
	set_process(true);

}
开发者ID:Ragar0ck,项目名称:godot,代码行数:16,代码来源:script_editor_debugger.cpp


示例19: _get_gizmo_geometry

RES Skeleton::_get_gizmo_geometry() const {

	if (!GLOBAL_DEF("debug/draw_skeleton", true))
		return RES();

	if (bones.size()==0)
		return RES();

	Ref<SurfaceTool> surface_tool( memnew( SurfaceTool ));

	Ref<FixedMaterial> mat( memnew( FixedMaterial ));

	mat->set_parameter( FixedMaterial::PARAM_DIFFUSE,Color(0.6,1.0,0.3,0.1) );
	mat->set_line_width(4);
	mat->set_flag(Material::FLAG_DOUBLE_SIDED,true);
	mat->set_flag(Material::FLAG_UNSHADED,true);
	mat->set_flag(Material::FLAG_ONTOP,true);
//	mat->set_hint(Material::HINT_NO_DEPTH_DRAW,true);

	surface_tool->begin(Mesh::PRIMITIVE_LINES);
	surface_tool->set_material(mat);


	const Bone *bonesptr=&bones[0];
	int len=bones.size();

	for (int i=0;i<len;i++) {

		const Bone &b=bonesptr[i];

		Transform t;
		if (b.parent<0)
			continue;

		Vector3 v1=(bonesptr[b.parent].pose_global * bonesptr[b.parent].rest_global_inverse).xform(bonesptr[b.parent].rest_global_inverse.affine_inverse().origin);
		Vector3 v2=(b.pose_global * b.rest_global_inverse).xform(b.rest_global_inverse.affine_inverse().origin);

		surface_tool->add_vertex(v1);
		surface_tool->add_vertex(v2);

	}

	return surface_tool->commit();

}
开发者ID:03050903,项目名称:godot,代码行数:45,代码来源:skeleton.cpp


示例20: mouse_move

void OSIPhone::mouse_move(int p_idx, int p_prev_x, int p_prev_y, int p_x, int p_y, bool p_use_as_mouse) {

	if (!GLOBAL_DEF("debug/disable_touch", false)) {

		InputEvent ev;
		ev.type = InputEvent::SCREEN_DRAG;
		ev.ID = ++last_event_id;
		ev.screen_drag.index = p_idx;
		ev.screen_drag.x = p_x;
		ev.screen_drag.y = p_y;
		ev.screen_drag.relative_x = p_x - p_prev_x;
		ev.screen_drag.relative_y = p_y - p_prev_y;
		queue_event(ev);
	};

	if (p_use_as_mouse) {
		InputEvent ev;
		ev.type = InputEvent::MOUSE_MOTION;
		ev.device = 0;
		ev.mouse_motion.pointer_index = p_idx;
		ev.ID = ++last_event_id;

		if (true) { // vertical

			ev.mouse_motion.x = ev.mouse_button.global_x = p_x;
			ev.mouse_motion.y = ev.mouse_button.global_y = p_y;
			ev.mouse_motion.relative_x = ev.mouse_motion.x - p_prev_x;
			ev.mouse_motion.relative_y = ev.mouse_motion.y - p_prev_y;

		} else { // horizontal?
			ev.mouse_motion.x = ev.mouse_button.global_x = video_mode.height - p_y;
			ev.mouse_motion.y = ev.mouse_button.global_y = p_x;
			ev.mouse_motion.relative_x = ev.mouse_motion.x - (video_mode.height - p_prev_x);
			ev.mouse_motion.relative_y = ev.mouse_motion.y - p_prev_x;
		};

		input->set_mouse_pos(Point2(ev.mouse_motion.x, ev.mouse_motion.y));
		ev.mouse_motion.speed_x = input->get_mouse_speed().x;
		ev.mouse_motion.speed_y = input->get_mouse_speed().y;
		ev.mouse_motion.button_mask = 1; // pressed

		queue_event(ev);
	};
};
开发者ID:allkhor,项目名称:godot,代码行数:44,代码来源:os_iphone.cpp



注:本文中的GLOBAL_DEF函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ GLOBAL_LOCK函数代码示例发布时间:2022-05-30
下一篇:
C++ GLOBAL函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap