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


C++ CanvasItem::_queue_sort_children方法代码示例

本文整理汇总了C++中CanvasItem::_queue_sort_children方法的典型用法代码示例。如果您正苦于以下问题:C++ CanvasItem::_queue_sort_children方法的具体用法?C++ CanvasItem::_queue_sort_children怎么用?C++ CanvasItem::_queue_sort_children使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CanvasItem的用法示例。


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

示例1: _notification

void CanvasItem::_notification(int p_what) {


	switch(p_what) {
		case NOTIFICATION_ENTER_TREE: {

			first_draw=true;
			pending_children_sort=false;
			if (get_parent()) {
				CanvasItem *ci = get_parent()->cast_to<CanvasItem>();
				if (ci)
					C=ci->children_items.push_back(this);
			}
			_enter_canvas();
			if (!block_transform_notify && !xform_change.in_list()) {
				get_tree()->xform_change_list.add(&xform_change);
			}
		} break;
		case NOTIFICATION_MOVED_IN_PARENT: {


			if (group!="") {
				get_tree()->call_group(SceneTree::GROUP_CALL_UNIQUE,group,"_raise_self");
			} else {
				CanvasItem *p = get_parent_item();
				ERR_FAIL_COND(!p);
				p->_queue_sort_children();
			}


		} break;
		case NOTIFICATION_EXIT_TREE: {
			if (xform_change.in_list())
				get_tree()->xform_change_list.remove(&xform_change);
			_exit_canvas();
			if (C) {
				get_parent()->cast_to<CanvasItem>()->children_items.erase(C);
				C=NULL;
			}
			global_invalid=true;
		} break;
		case NOTIFICATION_DRAW: {

		} break;
		case NOTIFICATION_TRANSFORM_CHANGED: {


		} break;
		case NOTIFICATION_VISIBILITY_CHANGED: {

			emit_signal(SceneStringNames::get_singleton()->visibility_changed);
		} break;

	}
}
开发者ID:Scrik,项目名称:godot,代码行数:55,代码来源:canvas_item.cpp

示例2: _enter_canvas

void CanvasItem::_enter_canvas() {

	if ((!get_parent() || !get_parent()->cast_to<CanvasItem>()) || toplevel) {

		Node *n = this;
		Viewport *viewport=NULL;
		canvas_layer=NULL;

		while(n) {

			if (n->cast_to<Viewport>()) {

				viewport = n->cast_to<Viewport>();
				break;
			}
			if (!canvas_layer && n->cast_to<CanvasLayer>()) {

				canvas_layer = n->cast_to<CanvasLayer>();
			}
			n=n->get_parent();
		}

		RID canvas;
		if (canvas_layer)
			canvas=canvas_layer->get_world_2d()->get_canvas();
		else
			canvas=viewport->find_world_2d()->get_canvas();

		VisualServer::get_singleton()->canvas_item_set_parent(canvas_item,canvas);

		group = "root_canvas"+itos(canvas.get_id());

		add_to_group(group);
		get_tree()->call_group(SceneTree::GROUP_CALL_UNIQUE,group,"_raise_self");

	} else {

		CanvasItem *parent = get_parent_item();
		VisualServer::get_singleton()->canvas_item_set_parent(canvas_item,parent->get_canvas_item());
		parent->_queue_sort_children();
	}

	pending_update=false;
	update();

	notification(NOTIFICATION_ENTER_CANVAS);

}
开发者ID:AMG194,项目名称:godot,代码行数:48,代码来源:canvas_item.cpp


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