当前位置: 首页>>代码示例>>C++>>正文


C++ ERR_PRINTS函数代码示例

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


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

示例1: CFStringCreateWithCString

Error MIDIDriverCoreMidi::open() {

	CFStringRef name = CFStringCreateWithCString(NULL, "Godot", kCFStringEncodingASCII);
	OSStatus result = MIDIClientCreate(name, NULL, NULL, &client);
	CFRelease(name);
	if (result != noErr) {
		ERR_PRINTS("MIDIClientCreate failed, code: " + itos(result));
		return ERR_CANT_OPEN;
	}

	result = MIDIInputPortCreate(client, CFSTR("Godot Input"), MIDIDriverCoreMidi::read, (void *)this, &port_in);
	if (result != noErr) {
		ERR_PRINTS("MIDIInputPortCreate failed, code: " + itos(result));
		return ERR_CANT_OPEN;
	}

	int sources = MIDIGetNumberOfSources();
	for (int i = 0; i < sources; i++) {

		MIDIEndpointRef source = MIDIGetSource(i);
		if (source) {
			MIDIPortConnectSource(port_in, source, (void *)this);
			connected_sources.insert(i, source);
		}
	}

	return OK;
}
开发者ID:ISylvox,项目名称:godot,代码行数:28,代码来源:midi_driver_coremidi.cpp

示例2: ERR_FAIL_COND

void MultiplayerAPI::rsetp(Node *p_node, int p_peer_id, bool p_unreliable, const StringName &p_property, const Variant &p_value) {

	ERR_FAIL_COND(!p_node->is_inside_tree());
	ERR_FAIL_COND(!network_peer.is_valid());

	int node_id = network_peer->get_unique_id();
	bool is_master = p_node->is_network_master();
	bool skip_rset = false;

	if (p_peer_id == 0 || p_peer_id == node_id || (p_peer_id < 0 && p_peer_id != -node_id)) {
		//check that send mode can use local call

		bool set_local = false;

		const Map<StringName, RPCMode>::Element *E = p_node->get_node_rset_mode(p_property);
		if (E) {

			set_local = _should_call_local(E->get(), is_master, skip_rset);
		}

		if (set_local) {
			bool valid;
			p_node->set(p_property, p_value, &valid);

			if (!valid) {
				String error = "rset() aborted in local set, property not found:  - " + String(p_property);
				ERR_PRINTS(error);
				return;
			}
		} else if (p_node->get_script_instance()) {
			//attempt with script
			RPCMode rpc_mode = p_node->get_script_instance()->get_rset_mode(p_property);

			set_local = _should_call_local(rpc_mode, is_master, skip_rset);

			if (set_local) {

				bool valid = p_node->get_script_instance()->set(p_property, p_value);

				if (!valid) {
					String error = "rset() aborted in local script set, property not found:  - " + String(p_property);
					ERR_PRINTS(error);
					return;
				}
			}
		}
	}

	if (skip_rset)
		return;

	const Variant *vptr = &p_value;

	_send_rpc(p_node, p_peer_id, p_unreliable, true, p_property, &vptr, 1);
}
开发者ID:laverneth,项目名称:godot,代码行数:55,代码来源:multiplayer_api.cpp

示例3: ERR_PRINTS

Error DirAccess::copy(String p_from, String p_to, int p_chmod_flags) {

	//printf("copy %s -> %s\n",p_from.ascii().get_data(),p_to.ascii().get_data());
	Error err;
	FileAccess *fsrc = FileAccess::open(p_from, FileAccess::READ, &err);

	if (err) {
		ERR_PRINTS("Failed to open " + p_from);
		return err;
	}

	FileAccess *fdst = FileAccess::open(p_to, FileAccess::WRITE, &err);
	if (err) {

		fsrc->close();
		memdelete(fsrc);
		ERR_PRINTS("Failed to open " + p_to);
		return err;
	}

	fsrc->seek_end(0);
	int size = fsrc->get_position();
	fsrc->seek(0);
	err = OK;
	while (size--) {

		if (fsrc->get_error() != OK) {
			err = fsrc->get_error();
			break;
		}
		if (fdst->get_error() != OK) {
			err = fdst->get_error();
			break;
		}

		fdst->store_8(fsrc->get_8());
	}

	if (err == OK && p_chmod_flags != -1) {
		fdst->close();
		err = FileAccess::set_unix_permissions(p_to, p_chmod_flags);
		// If running on a platform with no chmod support (i.e., Windows), don't fail
		if (err == ERR_UNAVAILABLE)
			err = OK;
	}

	memdelete(fsrc);
	memdelete(fdst);

	return err;
}
开发者ID:Paulloz,项目名称:godot,代码行数:51,代码来源:dir_access.cpp

示例4: CRASH_COND

Error GDMono::finalize_and_unload_domain(MonoDomain *p_domain) {

	CRASH_COND(p_domain == NULL);

	String domain_name = mono_domain_get_friendly_name(p_domain);

	print_verbose("Mono: Unloading domain `" + domain_name + "`...");

	if (mono_domain_get() != root_domain)
		mono_domain_set(root_domain, true);

	mono_gc_collect(mono_gc_max_generation());
	mono_domain_finalize(p_domain, 2000);
	mono_gc_collect(mono_gc_max_generation());

	_domain_assemblies_cleanup(mono_domain_get_id(p_domain));

	MonoException *exc = NULL;
	mono_domain_try_unload(p_domain, (MonoObject **)&exc);

	if (exc) {
		ERR_PRINTS("Exception thrown when unloading domain `" + domain_name + "`");
		GDMonoUtils::debug_unhandled_exception(exc);
		return FAILED;
	}

	return OK;
}
开发者ID:johnyc90,项目名称:godot,代码行数:28,代码来源:gd_mono.cpp

示例5: ERR_FAIL_COND

void MultiplayerAPI::_process_rpc(Node *p_node, const StringName &p_name, int p_from, const uint8_t *p_packet, int p_packet_len, int p_offset) {
	if (!p_node->can_call_rpc(p_name, p_from))
		return;

	ERR_FAIL_COND(p_offset >= p_packet_len);

	int argc = p_packet[p_offset];
	Vector<Variant> args;
	Vector<const Variant *> argp;
	args.resize(argc);
	argp.resize(argc);

	p_offset++;

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

		ERR_FAIL_COND(p_offset >= p_packet_len);
		int vlen;
		Error err = decode_variant(args[i], &p_packet[p_offset], p_packet_len - p_offset, &vlen);
		ERR_FAIL_COND(err != OK);
		//args[i]=p_packet[3+i];
		argp[i] = &args[i];
		p_offset += vlen;
	}

	Variant::CallError ce;

	p_node->call(p_name, (const Variant **)argp.ptr(), argc, ce);
	if (ce.error != Variant::CallError::CALL_OK) {
		String error = Variant::get_call_error_text(p_node, p_name, (const Variant **)argp.ptr(), argc, ce);
		error = "RPC - " + error;
		ERR_PRINTS(error);
	}
}
开发者ID:marcelofg55,项目名称:godot,代码行数:34,代码来源:multiplayer_api.cpp

示例6: ERR_FAIL_COND_V

Error ImageLoader::load_image(String p_file, Ref<Image> p_image, FileAccess *p_custom) {
	ERR_FAIL_COND_V(p_image.is_null(), ERR_INVALID_PARAMETER);

	FileAccess *f = p_custom;
	if (!f) {
		Error err;
		f = FileAccess::open(p_file, FileAccess::READ, &err);
		if (!f) {
			ERR_PRINTS("Error opening file: " + p_file);
			return err;
		}
	}

	String extension = p_file.get_extension();

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

		if (!loader[i]->recognize(extension))
			continue;
		Error err = loader[i]->load_image(p_image, f);

		if (err != ERR_FILE_UNRECOGNIZED) {

			if (!p_custom)
				memdelete(f);

			return err;
		}
	}

	if (!p_custom)
		memdelete(f);

	return ERR_FILE_UNRECOGNIZED;
}
开发者ID:suptoasty,项目名称:godot,代码行数:35,代码来源:image_loader.cpp

示例7: point_global_transform

void SoftBody::_update_cache_pin_points_datas() {
	if (pinned_points_cache_dirty) {
		pinned_points_cache_dirty = false;

		PoolVector<PinnedPoint>::Write w = pinned_points_indices.write();
		for (int i = pinned_points_indices.size() - 1; 0 <= i; --i) {

			if (!w[i].spatial_attachment_path.is_empty()) {
				w[i].spatial_attachment = Object::cast_to<Spatial>(get_node(w[i].spatial_attachment_path));
				if (w[i].spatial_attachment) {

					Transform point_global_transform(get_global_transform());
					point_global_transform.translate(PhysicsServer::get_singleton()->soft_body_get_point_offset(physics_rid, w[i].point_index));

					// Local transform relative to spatial attachment node
					w[i].vertex_offset_transform = w[i].spatial_attachment->get_global_transform().affine_inverse() * point_global_transform;
					continue;
				} else {
					ERR_PRINTS("The node with path: " + String(w[i].spatial_attachment_path) + " was not found or is not a spatial node.");
				}
			}
			// Local transform relative to Soft body
			w[i].vertex_offset_transform.origin = PhysicsServer::get_singleton()->soft_body_get_point_offset(physics_rid, w[i].point_index);
			w[i].vertex_offset_transform.basis = Basis();
		}
	}
}
开发者ID:dataxerik,项目名称:godot,代码行数:27,代码来源:soft_body.cpp

示例8: ERR_EXPLAIN

void MultiplayerAPI::_process_rset(Node *p_node, const StringName &p_name, int p_from, const uint8_t *p_packet, int p_packet_len, int p_offset) {

	ERR_EXPLAIN("Invalid packet received. Size too small.");
	ERR_FAIL_COND(p_offset >= p_packet_len);

	// Check that remote can call the RSET on this node.
	RPCMode rset_mode = RPC_MODE_DISABLED;
	const Map<StringName, RPCMode>::Element *E = p_node->get_node_rset_mode(p_name);
	if (E) {
		rset_mode = E->get();
	} else if (p_node->get_script_instance()) {
		rset_mode = p_node->get_script_instance()->get_rset_mode(p_name);
	}

	bool can_call = _can_call_mode(p_node, rset_mode, p_from);
	ERR_EXPLAIN("RSET '" + String(p_name) + "' is not allowed on node " + p_node->get_path() + " from: " + itos(p_from) + ". Mode is " + itos((int)rset_mode) + ", master is " + itos(p_node->get_network_master()) + ".");
	ERR_FAIL_COND(!can_call);

	Variant value;
	Error err = decode_variant(value, &p_packet[p_offset], p_packet_len - p_offset, NULL, allow_object_decoding || network_peer->is_object_decoding_allowed());

	ERR_EXPLAIN("Invalid packet received. Unable to decode RSET value.");
	ERR_FAIL_COND(err != OK);

	bool valid;

	p_node->set(p_name, value, &valid);
	if (!valid) {
		String error = "Error setting remote property '" + String(p_name) + "', not found in object of type " + p_node->get_class();
		ERR_PRINTS(error);
	}
}
开发者ID:Paulloz,项目名称:godot,代码行数:32,代码来源:multiplayer_api.cpp

示例9: _draw_margins

void VisualServerRaster::draw(bool p_swap_buffers, double frame_step) {

	//needs to be done before changes is reset to 0, to not force the editor to redraw
	VS::get_singleton()->emit_signal("frame_pre_draw");

	changes = 0;

	VSG::rasterizer->begin_frame(frame_step);

	VSG::scene->update_dirty_instances(); //update scene stuff

	VSG::viewport->draw_viewports();
	VSG::scene->render_probes();
	_draw_margins();
	VSG::rasterizer->end_frame(p_swap_buffers);

	while (frame_drawn_callbacks.front()) {

		Object *obj = ObjectDB::get_instance(frame_drawn_callbacks.front()->get().object);
		if (obj) {
			Variant::CallError ce;
			const Variant *v = &frame_drawn_callbacks.front()->get().param;
			obj->call(frame_drawn_callbacks.front()->get().method, &v, 1, ce);
			if (ce.error != Variant::CallError::CALL_OK) {
				String err = Variant::get_call_error_text(obj, frame_drawn_callbacks.front()->get().method, &v, 1, ce);
				ERR_PRINTS("Error calling frame drawn function: " + err);
			}
		}

		frame_drawn_callbacks.pop_front();
	}
	VS::get_singleton()->emit_signal("frame_post_draw");
}
开发者ID:Paulloz,项目名称:godot,代码行数:33,代码来源:visual_server_raster.cpp

示例10: _draw_margins

void VisualServerRaster::draw(bool p_swap_buffers) {

	changes = 0;

	VSG::rasterizer->begin_frame();

	VSG::scene->update_dirty_instances(); //update scene stuff

	VSG::viewport->draw_viewports();
	VSG::scene->render_probes();
	_draw_margins();
	VSG::rasterizer->end_frame(p_swap_buffers);

	while (frame_drawn_callbacks.front()) {

		Object *obj = ObjectDB::get_instance(frame_drawn_callbacks.front()->get().object);
		if (obj) {
			Variant::CallError ce;
			const Variant *v = &frame_drawn_callbacks.front()->get().param;
			obj->call(frame_drawn_callbacks.front()->get().method, &v, 1, ce);
			if (ce.error != Variant::CallError::CALL_OK) {
				String err = Variant::get_call_error_text(obj, frame_drawn_callbacks.front()->get().method, &v, 1, ce);
				ERR_PRINTS("Error calling frame drawn function: " + err);
			}
		}

		frame_drawn_callbacks.pop_front();
	}

	emit_signal("frame_drawn_in_thread");
}
开发者ID:Warlaan,项目名称:godot,代码行数:31,代码来源:visual_server_raster.cpp

示例11: mono_log_callback

static void mono_log_callback(const char *log_domain, const char *log_level, const char *message, mono_bool fatal, void *user_data) {

	FileAccess *f = GDMonoLog::get_singleton()->get_log_file();

	if (GDMonoLog::get_singleton()->get_log_level_id() >= log_level_get_id(log_level)) {
		String text(message);
		text += " (in domain ";
		text += log_domain;
		if (log_level) {
			text += ", ";
			text += log_level;
		}
		text += ")\n";

		f->seek_end();
		f->store_string(text);
	}

	if (fatal) {
		ERR_PRINTS("Mono: FATAL ERROR, ABORTING! Logfile: " + GDMonoLog::get_singleton()->get_log_file_path() + "\n");
		// If we were to abort without flushing, the log wouldn't get written.
		f->flush();
		abort();
	}
}
开发者ID:UgisBrekis,项目名称:godot,代码行数:25,代码来源:gd_mono_log.cpp

示例12: mbedtls_ssl_init

Error StreamPeerMbedTLS::connect_to_stream(Ref<StreamPeer> p_base, bool p_validate_certs, const String &p_for_hostname) {

	base = p_base;
	int ret = 0;
	int authmode = p_validate_certs ? MBEDTLS_SSL_VERIFY_REQUIRED : MBEDTLS_SSL_VERIFY_NONE;

	mbedtls_ssl_init(&ssl);
	mbedtls_ssl_config_init(&conf);
	mbedtls_ctr_drbg_init(&ctr_drbg);
	mbedtls_entropy_init(&entropy);

	ret = mbedtls_ctr_drbg_seed(&ctr_drbg, mbedtls_entropy_func, &entropy, NULL, 0);
	if (ret != 0) {
		ERR_PRINTS(" failed\n  ! mbedtls_ctr_drbg_seed returned an error" + itos(ret));
		return FAILED;
	}

	mbedtls_ssl_config_defaults(&conf,
			MBEDTLS_SSL_IS_CLIENT,
			MBEDTLS_SSL_TRANSPORT_STREAM,
			MBEDTLS_SSL_PRESET_DEFAULT);

	mbedtls_ssl_conf_authmode(&conf, authmode);
	mbedtls_ssl_conf_ca_chain(&conf, &cacert, NULL);
	mbedtls_ssl_conf_rng(&conf, mbedtls_ctr_drbg_random, &ctr_drbg);
	mbedtls_ssl_conf_dbg(&conf, my_debug, stdout);
	mbedtls_ssl_setup(&ssl, &conf);
	mbedtls_ssl_set_hostname(&ssl, p_for_hostname.utf8().get_data());

	mbedtls_ssl_set_bio(&ssl, this, bio_send, bio_recv, NULL);

	while ((ret = mbedtls_ssl_handshake(&ssl)) != 0) {
		if (ret != MBEDTLS_ERR_SSL_WANT_READ && ret != MBEDTLS_ERR_SSL_WANT_WRITE) {
			ERR_PRINTS("TLS handshake error: " + itos(ret));
			_print_error(ret);
			status = STATUS_ERROR_HOSTNAME_MISMATCH;
			return FAILED;
		}
	}

	connected = true;
	status = STATUS_CONNECTED;

	return OK;
}
开发者ID:Ranakhamis,项目名称:godot,代码行数:45,代码来源:stream_peer_mbed_tls.cpp

示例13: AudioOutputUnitStart

Error AudioDriverCoreAudio::capture_start() {

	OSStatus result = AudioOutputUnitStart(input_unit);
	if (result != noErr) {
		ERR_PRINTS("AudioOutputUnitStart failed, code: " + itos(result));
	}

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

示例14: decode_uint32

Node *MultiplayerAPI::_process_get_node(int p_from, const uint8_t *p_packet, int p_packet_len) {

	uint32_t target = decode_uint32(&p_packet[1]);
	Node *node = NULL;

	if (target & 0x80000000) {
		// Use full path (not cached yet).

		int ofs = target & 0x7FFFFFFF;

		ERR_EXPLAIN("Invalid packet received. Size smaller than declared.");
		ERR_FAIL_COND_V(ofs >= p_packet_len, NULL);

		String paths;
		paths.parse_utf8((const char *)&p_packet[ofs], p_packet_len - ofs);

		NodePath np = paths;

		node = root_node->get_node(np);

		if (!node)
			ERR_PRINTS("Failed to get path from RPC: " + String(np));
	} else {
		// Use cached path.
		int id = target;

		Map<int, PathGetCache>::Element *E = path_get_cache.find(p_from);
		ERR_EXPLAIN("Invalid packet received. Requests invalid peer cache.");
		ERR_FAIL_COND_V(!E, NULL);

		Map<int, PathGetCache::NodeInfo>::Element *F = E->get().nodes.find(id);
		ERR_EXPLAIN("Invalid packet received. Unabled to find requested cached node.");
		ERR_FAIL_COND_V(!F, NULL);

		PathGetCache::NodeInfo *ni = &F->get();
		// Do proper caching later.

		node = root_node->get_node(ni->path);
		if (!node)
			ERR_PRINTS("Failed to get cached path from RPC: " + String(ni->path));
	}
	return node;
}
开发者ID:Paulloz,项目名称:godot,代码行数:43,代码来源:multiplayer_api.cpp

示例15: AudioOutputUnitStop

void AudioDriverCoreAudio::stop() {
	if (active) {
		OSStatus result = AudioOutputUnitStop(audio_unit);
		if (result != noErr) {
			ERR_PRINTS("AudioOutputUnitStop failed, code: " + itos(result));
		} else {
			active = false;
		}
	}
}
开发者ID:93i,项目名称:godot,代码行数:10,代码来源:audio_driver_coreaudio.cpp


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