當前位置: 首頁>>代碼示例>>C++>>正文


C++ GLOBAL_DEF函數代碼示例

本文整理匯總了C++中GLOBAL_DEF函數的典型用法代碼示例。如果您正苦於以下問題:C++ GLOBAL_DEF函數的具體用法?C++ GLOBAL_DEF怎麽用?C++ GLOBAL_DEF使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了GLOBAL_DEF函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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


注:本文中的GLOBAL_DEF函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。