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


C++ ERR_FAIL_INDEX_V函数代码示例

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


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

示例1: _get_depth


//.........这里部分代码省略.........
							int closest_idx = -1;
							Vector2 closest_pos;
							real_t closest_dist = 1e10;
							for (int i = 0; i < poly.size(); i++) {

								Vector2 cp = p_camera->unproject_position(gt.xform(Vector3(poly[i].x, poly[i].y, depth)));

								real_t d = cp.distance_to(gpoint);
								if (d < closest_dist && d < grab_threshold) {
									closest_dist = d;
									closest_pos = cp;
									closest_idx = i;
								}
							}

							if (closest_idx >= 0) {

								pre_move_edit = poly;
								edited_point = closest_idx;
								edited_point_pos = poly[closest_idx];
								_polygon_draw();
								snap_ignore = false;
								return true;
							}
						}
					} else {

						snap_ignore = false;

						if (edited_point != -1) {

							//apply

							ERR_FAIL_INDEX_V(edited_point, poly.size(), false);
							poly[edited_point] = edited_point_pos;
							undo_redo->create_action(TTR("Edit Poly"));
							undo_redo->add_do_method(node, "set_polygon", poly);
							undo_redo->add_undo_method(node, "set_polygon", pre_move_edit);
							undo_redo->add_do_method(this, "_polygon_draw");
							undo_redo->add_undo_method(this, "_polygon_draw");
							undo_redo->commit_action();

							edited_point = -1;
							return true;
						}
					}
				}
				if (mb->get_button_index() == BUTTON_RIGHT && mb->is_pressed() && edited_point == -1) {

					int closest_idx = -1;
					Vector2 closest_pos;
					real_t closest_dist = 1e10;
					for (int i = 0; i < poly.size(); i++) {

						Vector2 cp = p_camera->unproject_position(gt.xform(Vector3(poly[i].x, poly[i].y, depth)));

						real_t d = cp.distance_to(gpoint);
						if (d < closest_dist && d < grab_threshold) {
							closest_dist = d;
							closest_pos = cp;
							closest_idx = i;
						}
					}

					if (closest_idx >= 0) {
开发者ID:ippan,项目名称:godot,代码行数:66,代码来源:collision_polygon_editor_plugin.cpp

示例2: ERR_FAIL_INDEX_V

float AudioEffectChorus::get_voice_cutoff_hz(int p_voice) const {

	ERR_FAIL_INDEX_V(p_voice, MAX_VOICES, 0);

	return voice[p_voice].cutoff;
}
开发者ID:KellyThomas,项目名称:godot,代码行数:6,代码来源:audio_effect_chorus.cpp

示例3: ERR_FAIL_INDEX_V

Vector<int> NavigationMesh::get_polygon(int p_idx) {

	ERR_FAIL_INDEX_V(p_idx, polygons.size(), Vector<int>());
	return polygons[p_idx].indices;
}
开发者ID:MattUV,项目名称:godot,代码行数:5,代码来源:navigation_mesh.cpp

示例4: ERR_FAIL_INDEX_V

int Camera2D::get_limit(Margin p_margin) const{

	ERR_FAIL_INDEX_V(p_margin,4,0);
	return limit[p_margin];

}
开发者ID:BenjaDev,项目名称:godot,代码行数:6,代码来源:camera_2d.cpp

示例5: ERR_FAIL_INDEX_V

NodePath EditorData::get_edited_scene_live_edit_root() {

	ERR_FAIL_INDEX_V(current_edited_scene, edited_scene.size(), String());

	return edited_scene[current_edited_scene].live_edit_root;
}
开发者ID:93i,项目名称:godot,代码行数:6,代码来源:editor_data.cpp

示例6: ERR_FAIL_INDEX_V

bool Environment::is_fx_enabled(Fx p_effect) const {

	ERR_FAIL_INDEX_V(p_effect, FX_MAX, false);
	return fx_enabled[p_effect];
}
开发者ID:allkhor,项目名称:godot,代码行数:5,代码来源:environment.cpp

示例7: ERR_FAIL_INDEX_V

String VisualScriptBuiltinFunc::get_func_name(BuiltinFunc p_func) {

	ERR_FAIL_INDEX_V(p_func, FUNC_MAX, String());
	return func_name[p_func];
}
开发者ID:codingabc,项目名称:godot,代码行数:5,代码来源:visual_script_builtin_funcs.cpp

示例8: ERR_FAIL_INDEX_V

bool VisibilityEnabler2D::is_enabler_enabled(Enabler p_enabler) const{

	ERR_FAIL_INDEX_V(p_enabler,ENABLER_MAX,false);
	return enabler[p_enabler];

}
开发者ID:lonesurvivor,项目名称:godot,代码行数:6,代码来源:visibility_notifier_2d.cpp

示例9: ERR_FAIL_INDEX_V

float Curve3D::get_point_tilt(int p_index) const {

	ERR_FAIL_INDEX_V(p_index,points.size(),0);
	return points[p_index].tilt;

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

示例10: ERR_FAIL_INDEX_V

Ref<ResourceImportMetadata> EditorData::get_edited_scene_import_metadata() const{

	ERR_FAIL_INDEX_V(current_edited_scene,edited_scene.size(),Ref<ResourceImportMetadata>());
	return edited_scene[current_edited_scene].medatata;
}
开发者ID:AMG194,项目名称:godot,代码行数:5,代码来源:editor_data.cpp

示例11: ERR_FAIL_INDEX_V

bool SpriteBase3D::get_draw_flag(DrawFlags p_flag) const{
	ERR_FAIL_INDEX_V(p_flag,FLAG_MAX,false);
	return flags[p_flag];
}
开发者ID:HiddenDark,项目名称:godot,代码行数:4,代码来源:sprite_3d.cpp

示例12: ERR_FAIL_INDEX_V

float SoundRoomParams::get_param(Params p_param) const {

    ERR_FAIL_INDEX_V(p_param,PARAM_MAX,0);
    return params[p_param];
}
开发者ID:ShadowKyogre,项目名称:godot,代码行数:5,代码来源:sound_room_params.cpp

示例13: ERR_FAIL_INDEX_V

ScriptLanguage* ScriptServer::get_language(int p_idx) {

	ERR_FAIL_INDEX_V(p_idx,_language_count,NULL);

	return _languages[p_idx];
}
开发者ID:111X,项目名称:godot,代码行数:6,代码来源:script_language.cpp

示例14: ERR_FAIL_INDEX_V

Vector<String> EditorFileSystemDirectory::get_file_deps(int p_idx) const {

	ERR_FAIL_INDEX_V(p_idx, files.size(), Vector<String>());
	return files[p_idx]->deps;
}
开发者ID:rrrfffrrr,项目名称:godot,代码行数:5,代码来源:editor_file_system.cpp

示例15: ERR_FAIL_COND_V

StringName NodePath::get_subname(int p_idx) const {

	ERR_FAIL_COND_V(!data, StringName());
	ERR_FAIL_INDEX_V(p_idx, data->subpath.size(), StringName());
	return data->subpath[p_idx];
}
开发者ID:Alex-doc,项目名称:godot,代码行数:6,代码来源:path_db.cpp


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