本文整理汇总了C++中HBoxContainer::set_opacity方法的典型用法代码示例。如果您正苦于以下问题:C++ HBoxContainer::set_opacity方法的具体用法?C++ HBoxContainer::set_opacity怎么用?C++ HBoxContainer::set_opacity使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HBoxContainer
的用法示例。
在下文中一共展示了HBoxContainer::set_opacity方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: get_drag_data_fw
Variant SceneTreeEditor::get_drag_data_fw(const Point2& p_point,Control* p_from) {
if (!can_rename)
return Variant(); //not editable tree
Vector<Node*> selected;
Vector<Ref<Texture> > icons;
TreeItem *next=tree->get_next_selected(NULL);
while (next) {
NodePath np = next->get_metadata(0);
Node *n=get_node(np);
if (n) {
selected.push_back(n);
icons.push_back(next->get_icon(0));
}
next=tree->get_next_selected(next);
}
if (selected.empty())
return Variant();
VBoxContainer *vb = memnew( VBoxContainer );
Array objs;
int list_max = 10;
float opacity_step = 1.0f / list_max;
float opacity_item = 1.0f;
for(int i=0;i<selected.size();i++) {
if (i<list_max){
HBoxContainer *hb = memnew( HBoxContainer );
TextureFrame *tf = memnew(TextureFrame);
tf->set_texture(icons[i]);
hb->add_child(tf);
Label *label = memnew( Label( selected[i]->get_name() ) );
hb->add_child(label);
vb->add_child(hb);
hb->set_opacity(opacity_item);
opacity_item -= opacity_step;
}
NodePath p = selected[i]->get_path();
objs.push_back(p);
}
set_drag_preview(vb);
Dictionary drag_data;
drag_data["type"]="nodes";
drag_data["nodes"]=objs;
tree->set_drop_mode_flags(Tree::DROP_MODE_INBETWEEN|Tree::DROP_MODE_ON_ITEM);
emit_signal("nodes_dragged");
return drag_data;
}