當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。