本文整理汇总了C++中HBoxContainer::add_constant_override方法的典型用法代码示例。如果您正苦于以下问题:C++ HBoxContainer::add_constant_override方法的具体用法?C++ HBoxContainer::add_constant_override怎么用?C++ HBoxContainer::add_constant_override使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HBoxContainer
的用法示例。
在下文中一共展示了HBoxContainer::add_constant_override方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: memnew
EditorAssetLibraryItemDescription::EditorAssetLibraryItemDescription() {
VBoxContainer *vbox = memnew( VBoxContainer );
add_child(vbox);
set_child_rect(vbox);
HBoxContainer *hbox = memnew( HBoxContainer);
vbox->add_child(hbox);
vbox->add_constant_override("separation",15);
VBoxContainer *desc_vbox = memnew( VBoxContainer );
hbox->add_child(desc_vbox);
hbox->add_constant_override("separation",15);
item = memnew( EditorAssetLibraryItem );
desc_vbox->add_child(item);
desc_vbox->set_custom_minimum_size(Size2(300,0));
PanelContainer * desc_bg = memnew( PanelContainer );
desc_vbox->add_child(desc_bg);
desc_bg->set_v_size_flags(SIZE_EXPAND_FILL);
description = memnew( RichTextLabel );
description->connect("meta_clicked",this,"_link_click");
//desc_vbox->add_child(description);
desc_bg->add_child(description);
desc_bg->add_style_override("panel",get_stylebox("normal","TextEdit"));
preview = memnew( TextureFrame );
preview->set_custom_minimum_size(Size2(640,345));
hbox->add_child(preview);
PanelContainer * previews_bg = memnew( PanelContainer );
vbox->add_child(previews_bg);
previews_bg->set_custom_minimum_size(Size2(0,85));
previews_bg->add_style_override("panel",get_stylebox("normal","TextEdit"));
previews = memnew( ScrollContainer );
previews_bg->add_child(previews);
previews->set_enable_v_scroll(false);
previews->set_enable_h_scroll(true);
preview_hb = memnew( HBoxContainer );
preview_hb->set_v_size_flags(SIZE_EXPAND_FILL);
previews->add_child(preview_hb);
get_ok()->set_text("Install");
get_cancel()->set_text("Close");
}
示例2: memnew
EditorAssetLibraryItemDescription::EditorAssetLibraryItemDescription() {
VBoxContainer *vbox = memnew(VBoxContainer);
add_child(vbox);
HBoxContainer *hbox = memnew(HBoxContainer);
vbox->add_child(hbox);
vbox->add_constant_override("separation", 15 * EDSCALE);
VBoxContainer *desc_vbox = memnew(VBoxContainer);
hbox->add_child(desc_vbox);
hbox->add_constant_override("separation", 15 * EDSCALE);
item = memnew(EditorAssetLibraryItem);
desc_vbox->add_child(item);
desc_vbox->set_custom_minimum_size(Size2(300 * EDSCALE, 0));
desc_bg = memnew(PanelContainer);
desc_vbox->add_child(desc_bg);
desc_bg->set_v_size_flags(SIZE_EXPAND_FILL);
description = memnew(RichTextLabel);
description->connect("meta_clicked", this, "_link_click");
desc_bg->add_child(description);
preview = memnew(TextureRect);
preview->set_custom_minimum_size(Size2(640 * EDSCALE, 345 * EDSCALE));
hbox->add_child(preview);
previews_bg = memnew(PanelContainer);
vbox->add_child(previews_bg);
previews_bg->set_custom_minimum_size(Size2(0, 101 * EDSCALE));
previews = memnew(ScrollContainer);
previews_bg->add_child(previews);
previews->set_enable_v_scroll(false);
previews->set_enable_h_scroll(true);
preview_hb = memnew(HBoxContainer);
preview_hb->set_v_size_flags(SIZE_EXPAND_FILL);
previews->add_child(preview_hb);
get_ok()->set_text(TTR("Download"));
get_cancel()->set_text(TTR("Close"));
}
示例3: _make_pages
HBoxContainer* EditorAddonLibrary::_make_pages(int p_page,int p_max_page,int p_page_len,int p_total_items,int p_current_items) {
HBoxContainer * hbc = memnew( HBoxContainer );
//do the mario
int from = p_page-5;
if (from<0)
from=0;
int to = from+10;
if (to>p_max_page)
to=p_max_page;
Color gray = Color(0.65,0.65,0.65);
hbc->add_spacer();
hbc->add_constant_override("separation",10);
LinkButton *first = memnew( LinkButton );
first->set_text("first");
first->add_color_override("font_color", gray );
first->set_underline_mode(LinkButton::UNDERLINE_MODE_ON_HOVER);
first->connect("pressed",this,"_search",varray(0));
hbc->add_child(first);
if (p_page>0) {
LinkButton *prev = memnew( LinkButton );
prev->set_text("prev");
prev->add_color_override("font_color", gray );
prev->set_underline_mode(LinkButton::UNDERLINE_MODE_ON_HOVER);
prev->connect("pressed",this,"_search",varray(p_page-1));
hbc->add_child(prev);
}
for(int i=from;i<=to;i++) {
if (i==p_page) {
Label *current = memnew(Label);
current->set_text(itos(i));
hbc->add_child(current);
} else {
LinkButton *current = memnew( LinkButton );
current->add_color_override("font_color", gray );
current->set_underline_mode(LinkButton::UNDERLINE_MODE_ON_HOVER);
current->set_text(itos(i));
current->connect("pressed",this,"_search",varray(i));
hbc->add_child(current);
}
}
if (p_page<p_max_page) {
LinkButton *next = memnew( LinkButton );
next->set_text("next");
next->add_color_override("font_color", gray );
next->set_underline_mode(LinkButton::UNDERLINE_MODE_ON_HOVER);
next->connect("pressed",this,"_search",varray(p_page+1));
hbc->add_child(next);
}
LinkButton *last = memnew( LinkButton );
last->set_text("last");
last->add_color_override("font_color", gray );
last->set_underline_mode(LinkButton::UNDERLINE_MODE_ON_HOVER);
hbc->add_child(last);
last->connect("pressed",this,"_search",varray(p_max_page));
Label *totals = memnew( Label );
totals->set_text("( "+itos(from*p_page_len)+" - "+itos(from*p_page_len+p_current_items-1)+" / "+itos(p_total_items)+" )");
hbc->add_child(totals);
hbc->add_spacer();
return hbc;
}
示例4: memnew
EditorAbout::EditorAbout() {
set_title(TTR("Thanks from the Godot community!"));
get_ok()->set_text(TTR("Thanks!"));
set_hide_on_ok(true);
set_resizable(true);
VBoxContainer *vbc = memnew(VBoxContainer);
HBoxContainer *hbc = memnew(HBoxContainer);
hbc->set_h_size_flags(Control::SIZE_EXPAND_FILL);
hbc->set_alignment(BoxContainer::ALIGN_CENTER);
hbc->add_constant_override("separation", 30 * EDSCALE);
add_child(vbc);
vbc->add_child(hbc);
_logo = memnew(TextureRect);
hbc->add_child(_logo);
String hash = String(VERSION_HASH);
if (hash.length() != 0)
hash = "." + hash.left(7);
Label *about_text = memnew(Label);
about_text->set_v_size_flags(Control::SIZE_SHRINK_CENTER);
about_text->set_text(VERSION_FULL_NAME + hash + String::utf8("\n\u00A9 2007-2017 Juan Linietsky, Ariel Manzur.\n\u00A9 2014-2017 ") +
TTR("Godot Engine contributors") + "\n");
hbc->add_child(about_text);
TabContainer *tc = memnew(TabContainer);
tc->set_custom_minimum_size(Size2(630, 240) * EDSCALE);
tc->set_v_size_flags(Control::SIZE_EXPAND_FILL);
vbc->add_child(tc);
// Authors
List<String> dev_sections;
dev_sections.push_back(TTR("Project Founders"));
dev_sections.push_back(TTR("Lead Developer"));
dev_sections.push_back(TTR("Project Manager"));
dev_sections.push_back(TTR("Developers"));
const char **dev_src[] = { dev_founders, dev_lead, dev_manager, dev_names };
tc->add_child(_populate_list(TTR("Authors"), dev_sections, dev_src));
// Donors
List<String> donor_sections;
donor_sections.push_back(TTR("Platinum Sponsors"));
donor_sections.push_back(TTR("Gold Sponsors"));
donor_sections.push_back(TTR("Mini Sponsors"));
donor_sections.push_back(TTR("Gold Donors"));
donor_sections.push_back(TTR("Silver Donors"));
donor_sections.push_back(TTR("Bronze Donors"));
const char **donor_src[] = { donor_s_plat, donor_s_gold, donor_s_mini, donor_gold, donor_silver, donor_bronze };
tc->add_child(_populate_list(TTR("Donors"), donor_sections, donor_src));
// License
TextEdit *license = memnew(TextEdit);
license->set_name(TTR("License"));
license->set_h_size_flags(Control::SIZE_EXPAND_FILL);
license->set_v_size_flags(Control::SIZE_EXPAND_FILL);
license->set_wrap(true);
license->set_readonly(true);
license->set_text(String::utf8(about_license));
tc->add_child(license);
// Thirdparty License
VBoxContainer *license_thirdparty = memnew(VBoxContainer);
license_thirdparty->set_name(TTR("Thirdparty License"));
license_thirdparty->set_h_size_flags(Control::SIZE_EXPAND_FILL);
tc->add_child(license_thirdparty);
Label *tpl_label = memnew(Label);
tpl_label->set_h_size_flags(Control::SIZE_EXPAND_FILL);
tpl_label->set_autowrap(true);
tpl_label->set_text(TTR("Godot Engine relies on a number of thirdparty free and open source libraries, all compatible with the terms of its MIT license. The following is an exhaustive list of all such thirdparty components with their respective copyright statements and license terms."));
license_thirdparty->add_child(tpl_label);
HSplitContainer *tpl_hbc = memnew(HSplitContainer);
tpl_hbc->set_h_size_flags(Control::SIZE_EXPAND_FILL);
tpl_hbc->set_v_size_flags(Control::SIZE_EXPAND_FILL);
tpl_hbc->set_split_offset(240 * EDSCALE);
license_thirdparty->add_child(tpl_hbc);
_tpl_tree = memnew(Tree);
_tpl_tree->set_hide_root(true);
TreeItem *root = _tpl_tree->create_item();
TreeItem *tpl_ti_all = _tpl_tree->create_item(root);
tpl_ti_all->set_text(0, TTR("All Components"));
TreeItem *tpl_ti_tp = _tpl_tree->create_item(root);
tpl_ti_tp->set_text(0, TTR("Components"));
tpl_ti_tp->set_selectable(0, false);
TreeItem *tpl_ti_lc = _tpl_tree->create_item(root);
tpl_ti_lc->set_text(0, TTR("Licenses"));
tpl_ti_lc->set_selectable(0, false);
int read_idx = 0;
String long_text = "";
for (int i = 0; i < THIRDPARTY_COUNT; i++) {
//.........这里部分代码省略.........
示例5: _load_recent_projects
//.........这里部分代码省略.........
ProjectItem &item = E->get();
String project = item.project;
String path = item.path;
String conf = item.conf;
bool is_favorite = item.favorite;
Ref<ConfigFile> cf = memnew( ConfigFile );
Error err = cf->load(conf);
ERR_CONTINUE(err!=OK);
String project_name=TTR("Unnamed Project");
if (cf->has_section_key("application","name")) {
project_name = static_cast<String>(cf->get_value("application","name")).xml_unescape();
}
if (filter_option==ProjectListFilter::FILTER_NAME && search_term!="" && project_name.findn(search_term)==-1)
continue;
Ref<Texture> icon;
if (cf->has_section_key("application","icon")) {
String appicon = cf->get_value("application","icon");
if (appicon!="") {
Image img;
Error err = img.load(appicon.replace_first("res://",path+"/"));
if (err==OK) {
img.resize(64,64);
Ref<ImageTexture> it = memnew( ImageTexture );
it->create_from_image(img);
icon=it;
}
}
}
if (icon.is_null()) {
icon=get_icon("DefaultProjectIcon","EditorIcons");
}
String main_scene;
if (cf->has_section_key("application","main_scene")) {
main_scene = cf->get_value("application","main_scene");
}
selected_list_copy.erase(project);
HBoxContainer *hb = memnew( HBoxContainer );
hb->set_meta("name",project);
hb->set_meta("main_scene",main_scene);
hb->set_meta("favorite",is_favorite);
hb->connect("draw",this,"_panel_draw",varray(hb));
hb->connect("input_event",this,"_panel_input",varray(hb));
hb->add_constant_override("separation",10*EDSCALE);
VBoxContainer *favorite_box = memnew( VBoxContainer );
TextureButton *favorite = memnew( TextureButton );
favorite->set_normal_texture(favorite_icon);
if (!is_favorite)
favorite->set_opacity(0.2);
favorite->set_v_size_flags(SIZE_EXPAND);
favorite->connect("pressed",this,"_favorite_pressed",varray(hb));
favorite_box->add_child(favorite);
hb->add_child(favorite_box);
TextureFrame *tf = memnew( TextureFrame );
tf->set_texture(icon);
hb->add_child(tf);
VBoxContainer *vb = memnew(VBoxContainer);
hb->add_child(vb);
Control *ec = memnew( Control );
ec->set_custom_minimum_size(Size2(0,1));
vb->add_child(ec);
Label *title = memnew( Label(project_name) );
title->add_font_override("font", gui_base->get_font("large","Fonts"));
title->add_color_override("font_color",font_color);
vb->add_child(title);
Label *fpath = memnew( Label(path) );
vb->add_child(fpath);
fpath->set_opacity(0.5);
fpath->add_color_override("font_color",font_color);
scroll_childs->add_child(hb);
}
for (Map<String,String>::Element *E = selected_list_copy.front();E;E = E->next()) {
String key = E->key();
selected_list.erase(key);
}
scroll->set_v_scroll(0);
_update_project_buttons();
EditorSettings::get_singleton()->save();
tabs->set_current_tab(0);
}