本文整理汇总了C++中WARN_PRINT函数的典型用法代码示例。如果您正苦于以下问题:C++ WARN_PRINT函数的具体用法?C++ WARN_PRINT怎么用?C++ WARN_PRINT使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了WARN_PRINT函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: WARN_PRINT
// Two-channel sawtooth wave generator.
int AudioDriverRtAudio::callback( void *outputBuffer, void *inputBuffer, unsigned int nBufferFrames,
double streamTime, RtAudioStreamStatus status, void *userData ) {
if (status) {
if (status & RTAUDIO_INPUT_OVERFLOW) {
WARN_PRINT("RtAudio input overflow!");
}
if (status & RTAUDIO_OUTPUT_UNDERFLOW) {
WARN_PRINT("RtAudio output underflow!");
}
}
int32_t *buffer = (int32_t *) outputBuffer;
AudioDriverRtAudio *self = (AudioDriverRtAudio*)userData;
if (self->mutex->try_lock()!=OK) {
// what should i do..
for(unsigned int i=0;i<nBufferFrames;i++)
buffer[i]=0;
return 0;
}
self->audio_server_process(nBufferFrames,buffer);
self->mutex->unlock();;
return 0;
}
示例2: memset
String OS_Unix::get_executable_path() const {
#ifdef __linux__
//fix for running from a symlink
char buf[256];
memset(buf, 0, 256);
ssize_t len = readlink("/proc/self/exe", buf, sizeof(buf));
String b;
if (len > 0) {
b.parse_utf8(buf, len);
}
if (b == "") {
WARN_PRINT("Couldn't get executable path from /proc/self/exe, using argv[0]");
return OS::get_executable_path();
}
return b;
#elif defined(__OpenBSD__)
char resolved_path[MAXPATHLEN];
realpath(OS::get_executable_path().utf8().get_data(), resolved_path);
return String(resolved_path);
#elif defined(__FreeBSD__)
int mib[4] = { CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, -1 };
char buf[MAXPATHLEN];
size_t len = sizeof(buf);
if (sysctl(mib, 4, buf, &len, NULL, 0) != 0) {
WARN_PRINT("Couldn't get executable path from sysctl");
return OS::get_executable_path();
}
String b;
b.parse_utf8(buf);
return b;
#elif defined(__APPLE__)
char temp_path[1];
uint32_t buff_size = 1;
_NSGetExecutablePath(temp_path, &buff_size);
char *resolved_path = new char[buff_size + 1];
if (_NSGetExecutablePath(resolved_path, &buff_size) == 1)
WARN_PRINT("MAXPATHLEN is too small");
String path(resolved_path);
delete[] resolved_path;
return path;
#else
ERR_PRINT("Warning, don't know how to obtain executable path on this OS! Please override this function properly.");
return OS::get_executable_path();
#endif
}
示例3: ERR_FAIL_COND_V
Error GDMono::reload_scripts_domain() {
ERR_FAIL_COND_V(!runtime_initialized, ERR_BUG);
if (scripts_domain) {
Error err = _unload_scripts_domain();
if (err != OK) {
ERR_PRINT("Mono: Failed to unload scripts domain");
return err;
}
}
Error err = _load_scripts_domain();
if (err != OK) {
ERR_PRINT("Mono: Failed to load scripts domain");
return err;
}
#ifdef MONO_GLUE_ENABLED
if (!_load_api_assemblies()) {
return ERR_CANT_OPEN;
}
if (!core_api_assembly_out_of_sync && !editor_api_assembly_out_of_sync && GDMonoUtils::mono_cache.godot_api_cache_updated) {
// Everything is fine with the api assemblies, load the project assembly
_load_project_assembly();
} else {
// The assembly was successfully loaded, but the full api could not be cached.
// This is most likely an outdated assembly loaded because of an invalid version in the metadata,
// so we invalidate the version in the metadata and unload the script domain.
if (core_api_assembly_out_of_sync) {
ERR_PRINT("The loaded Core API assembly is out of sync");
metadata_set_api_assembly_invalidated(APIAssembly::API_CORE, true);
} else if (!GDMonoUtils::mono_cache.godot_api_cache_updated) {
ERR_PRINT("The loaded Core API assembly is in sync, but the cache update failed");
metadata_set_api_assembly_invalidated(APIAssembly::API_CORE, true);
}
if (editor_api_assembly_out_of_sync) {
ERR_PRINT("The loaded Editor API assembly is out of sync");
metadata_set_api_assembly_invalidated(APIAssembly::API_EDITOR, true);
}
Error err = _unload_scripts_domain();
if (err != OK) {
WARN_PRINT("Mono: Failed to unload scripts domain");
}
return ERR_CANT_RESOLVE;
}
if (!_load_project_assembly())
return ERR_CANT_OPEN;
#else
print_verbose("Mono: Glue disabled, ignoring script assemblies.");
#endif
return OK;
}
示例4: WARN_PRINT
World2D::World2D() {
canvas = VisualServer::get_singleton()->canvas_create();
space = Physics2DServer::get_singleton()->space_create();
sound_space = SpatialSound2DServer::get_singleton()->space_create();
//set space2D to be more friendly with pixels than meters, by adjusting some constants
Physics2DServer::get_singleton()->space_set_active(space,true);
Physics2DServer::get_singleton()->area_set_param(space,Physics2DServer::AREA_PARAM_GRAVITY,GLOBAL_DEF("physics_2d/default_gravity",98));
Physics2DServer::get_singleton()->area_set_param(space,Physics2DServer::AREA_PARAM_GRAVITY_VECTOR,GLOBAL_DEF("physics_2d/default_gravity_vector",Vector2(0,1)));
// TODO: Remove this deprecation warning and compatibility code for 2.2 or 3.0
if (Globals::get_singleton()->get("physics_2d/default_density") && !Globals::get_singleton()->get("physics_2d/default_linear_damp")) {
WARN_PRINT("Deprecated parameter 'physics_2d/default_density'. It was renamed to 'physics_2d/default_linear_damp', adjusting your project settings accordingly (make sure to adjust scripts that potentially rely on 'physics_2d/default_density'.");
Globals::get_singleton()->set("physics_2d/default_linear_damp", Globals::get_singleton()->get("physics_2d/default_density"));
Globals::get_singleton()->set_persisting("physics_2d/default_linear_damp", true);
Globals::get_singleton()->set_persisting("physics_2d/default_density", false);
Globals::get_singleton()->save();
}
Physics2DServer::get_singleton()->area_set_param(space,Physics2DServer::AREA_PARAM_LINEAR_DAMP,GLOBAL_DEF("physics_2d/default_linear_damp",0.1));
Physics2DServer::get_singleton()->area_set_param(space,Physics2DServer::AREA_PARAM_ANGULAR_DAMP,GLOBAL_DEF("physics_2d/default_angular_damp",1));
Physics2DServer::get_singleton()->space_set_param(space,Physics2DServer::SPACE_PARAM_CONTACT_RECYCLE_RADIUS,1.0);
Physics2DServer::get_singleton()->space_set_param(space,Physics2DServer::SPACE_PARAM_CONTACT_MAX_SEPARATION,1.5);
Physics2DServer::get_singleton()->space_set_param(space,Physics2DServer::SPACE_PARAM_BODY_MAX_ALLOWED_PENETRATION,0.3);
Physics2DServer::get_singleton()->space_set_param(space,Physics2DServer::SPACE_PARAM_BODY_LINEAR_VELOCITY_SLEEP_TRESHOLD,2);
Physics2DServer::get_singleton()->space_set_param(space,Physics2DServer::SPACE_PARAM_CONSTRAINT_DEFAULT_BIAS,0.2);
indexer = memnew( SpatialIndexer2D );
}
示例5: WARN_PRINT
void EditorFileSystem::_load_type_cache(){
GLOBAL_LOCK_FUNCTION
#if 0
//this is not good, removed for now as it interferes with metadata stored in files
String project=Globals::get_singleton()->get_resource_path();
FileAccess *f =FileAccess::open(project+"/types.cache",FileAccess::READ);
if (!f) {
WARN_PRINT("Can't open types.cache.");
return;
}
file_type_cache.clear();
while(!f->eof_reached()) {
String path=f->get_line();
if (f->eof_reached())
break;
String type=f->get_line();
file_type_cache[path]=type;
}
memdelete(f);
#endif
}
示例6: memset
String OS_Unix::get_executable_path() const {
#ifdef __linux__
//fix for running from a symlink
char buf[256];
memset(buf,0,256);
readlink("/proc/self/exe", buf, sizeof(buf));
//print_line("Exec path is:"+String(buf));
String b;
b.parse_utf8(buf);
if (b=="") {
WARN_PRINT("Couldn't get executable path from /proc/self/exe, using argv[0]");
return OS::get_executable_path();
}
return b;
#elif defined(__FreeBSD__)
char resolved_path[MAXPATHLEN];
realpath(OS::get_executable_path().utf8().get_data(), resolved_path);
return String(resolved_path);
#else
ERR_PRINT("Warning, don't know how to obtain executable path on this OS! Please override this function properly.");
return OS::get_executable_path();
#endif
}
示例7: WARN_PRINT
void ObjectDB::cleanup() {
rw_lock->write_lock();
if (instances.size()) {
WARN_PRINT("ObjectDB Instances still exist!");
if (OS::get_singleton()->is_stdout_verbose()) {
const ObjectID *K = NULL;
while ((K = instances.next(K))) {
String node_name;
if (instances[*K]->is_class("Node"))
node_name = " - Node Name: " + String(instances[*K]->call("get_name"));
if (instances[*K]->is_class("Resource"))
node_name = " - Resource Name: " + String(instances[*K]->call("get_name")) + " Path: " + String(instances[*K]->call("get_path"));
print_line("Leaked Instance: " + String(instances[*K]->get_class()) + ":" + itos(*K) + node_name);
}
}
}
instances.clear();
instance_checks.clear();
rw_lock->write_unlock();
memdelete(rw_lock);
}
示例8: ERR_FAIL_INDEX
void Generic6DOFJointBullet::set_flag(Vector3::Axis p_axis, PhysicsServer::G6DOFJointAxisFlag p_flag, bool p_value) {
ERR_FAIL_INDEX(p_axis, 3);
flags[p_axis][p_flag] = p_value;
switch (p_flag) {
case PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_LINEAR_LIMIT:
if (flags[p_axis][p_flag]) {
sixDOFConstraint->setLimit(p_axis, limits_lower[0][p_axis], limits_upper[0][p_axis]);
} else {
sixDOFConstraint->setLimit(p_axis, 0, -1); // Free
}
break;
case PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_ANGULAR_LIMIT:
if (flags[p_axis][p_flag]) {
sixDOFConstraint->setLimit(p_axis + 3, limits_lower[1][p_axis], limits_upper[1][p_axis]);
} else {
sixDOFConstraint->setLimit(p_axis + 3, 0, -1); // Free
}
break;
case PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_MOTOR:
sixDOFConstraint->getRotationalLimitMotor(p_axis)->m_enableMotor = flags[p_axis][p_flag];
break;
case PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_LINEAR_MOTOR:
sixDOFConstraint->getTranslationalLimitMotor()->m_enableMotor[p_axis] = flags[p_axis][p_flag];
break;
default:
WARN_PRINT("This flag is not supported by Bullet engine");
return;
}
}
示例9: WARN_PRINT
IP::ResolverID IP::resolve_hostname_queue_item(const String &p_hostname, IP::Type p_type) {
resolver->mutex->lock();
ResolverID id = resolver->find_empty_id();
if (id == RESOLVER_INVALID_ID) {
WARN_PRINT("Out of resolver queries");
resolver->mutex->unlock();
return id;
}
String key = _IP_ResolverPrivate::get_cache_key(p_hostname, p_type);
resolver->queue[id].hostname = p_hostname;
resolver->queue[id].type = p_type;
if (resolver->cache.has(key)) {
resolver->queue[id].response = resolver->cache[key];
resolver->queue[id].status = IP::RESOLVER_STATUS_DONE;
} else {
resolver->queue[id].response = IP_Address();
resolver->queue[id].status = IP::RESOLVER_STATUS_WAITING;
if (resolver->thread)
resolver->sem->post();
else
resolver->resolve_queues();
}
resolver->mutex->unlock();
return id;
}
示例10: just_delete_shapes
void RigidBodyBullet::KinematicUtilities::copyAllOwnerShapes() {
const Vector<CollisionObjectBullet::ShapeWrapper> &shapes_wrappers(owner->get_shapes_wrappers());
const int shapes_count = shapes_wrappers.size();
just_delete_shapes(shapes_count);
const CollisionObjectBullet::ShapeWrapper *shape_wrapper;
btVector3 owner_scale(owner->get_bt_body_scale());
for (int i = shapes_count - 1; 0 <= i; --i) {
shape_wrapper = &shapes_wrappers[i];
if (!shape_wrapper->active) {
continue;
}
shapes.write[i].transform = shape_wrapper->transform;
shapes.write[i].transform.getOrigin() *= owner_scale;
switch (shape_wrapper->shape->get_type()) {
case PhysicsServer::SHAPE_SPHERE:
case PhysicsServer::SHAPE_BOX:
case PhysicsServer::SHAPE_CAPSULE:
case PhysicsServer::SHAPE_CYLINDER:
case PhysicsServer::SHAPE_CONVEX_POLYGON:
case PhysicsServer::SHAPE_RAY: {
shapes.write[i].shape = static_cast<btConvexShape *>(shape_wrapper->shape->create_bt_shape(owner_scale * shape_wrapper->scale, safe_margin));
} break;
default:
WARN_PRINT("This shape is not supported to be kinematic!");
shapes.write[i].shape = NULL;
}
}
}
示例11: WARN_PRINT
ThreadSafe::ThreadSafe() {
mutex = Mutex::create();
if (!mutex) {
WARN_PRINT("THREAD_SAFE defined, but no default mutex type");
}
}
示例12: WARN_PRINT
int PowerJavascript::get_power_percent_left() {
if (UpdatePowerInfo()) {
return percent_left;
} else {
WARN_PRINT("Power management is not implemented on this platform, defaulting to -1");
return -1;
}
}
示例13: ERR_FAIL_COND
void NetSocketPosix::set_reuse_address_enabled(bool p_enabled) {
ERR_FAIL_COND(!is_open());
int par = p_enabled ? 1 : 0;
if (setsockopt(_sock, SOL_SOCKET, SO_REUSEADDR, SOCK_CBUF(&par), sizeof(int)) < 0) {
WARN_PRINT("Unable to set socket REUSEADDR option!");
}
}
示例14: WARN_PRINT
Resource::~Resource() {
if (path_cache != "")
ResourceCache::resources.erase(path_cache);
if (owners.size()) {
WARN_PRINT("Resource is still owned");
}
}
示例15: WARN_PRINT
int power_android::get_power_percent_left() {
if (GetPowerInfo_Android()) {
return percent_left;
} else {
WARN_PRINT("Power management is not implemented on this platform, defaulting to -1");
return -1;
}
}