本文整理汇总了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) {
示例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;
}
示例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;
}
示例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];
}
示例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;
}
示例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];
}
示例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];
}
示例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];
}
示例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;
}
示例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;
}
示例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];
}
示例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];
}
示例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];
}
示例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;
}
示例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];
}