本文整理汇总了C++中Size2函数的典型用法代码示例。如果您正苦于以下问题:C++ Size2函数的具体用法?C++ Size2怎么用?C++ Size2使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Size2函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Size2
Size2 ViewportContainer::get_minimum_size() const {
if (stretch)
return Size2();
Size2 ms;
for (int i = 0; i < get_child_count(); i++) {
Viewport *c = Object::cast_to<Viewport>(get_child(i));
if (!c)
continue;
Size2 minsize = c->get_size();
ms.width = MAX(ms.width, minsize.width);
ms.height = MAX(ms.height, minsize.height);
}
return ms;
}
示例2: ERR_FAIL_COND
void Font::_set_chars(const DVector<int>& p_chars) {
int len = p_chars.size();
//char 1 charsize 1 texture, 4 rect, 2 align, advance 1
ERR_FAIL_COND(len%9);
if (!len)
return; //none to do
int chars = len/9;
DVector<int>::Read r=p_chars.read();
for(int i=0;i<chars;i++) {
const int* data = &r[i*9];
add_char(data[0],data[1],Rect2(data[2],data[3],data[4],data[5]), Size2(data[6],data[7]),data[8]);
}
}
示例3: ERR_FAIL_COND
void ProjectExportDialog::_export_project_to_path(const String &p_path) {
// Save this name for use in future exports (but drop the file extension)
default_filename = p_path.get_basename().get_file();
EditorSettings::get_singleton()->set_project_metadata("export_options", "default_filename", default_filename);
Ref<EditorExportPreset> current = EditorExport::get_singleton()->get_export_preset(presets->get_current());
ERR_FAIL_COND(current.is_null());
Ref<EditorExportPlatform> platform = current->get_platform();
ERR_FAIL_COND(platform.is_null());
Error err = platform->export_project(current, export_debug->is_pressed(), p_path, 0);
if (err != OK) {
error_dialog->set_text(TTR("Export templates for this platform are missing/corrupted: ") + platform->get_name());
error_dialog->show();
error_dialog->popup_centered_minsize(Size2(300, 80));
ERR_PRINT("Failed to export project");
}
}
示例4: memnew
SampleLibraryEditorPlugin::SampleLibraryEditorPlugin(EditorNode *p_node) {
editor=p_node;
sample_library_editor = memnew( SampleLibraryEditor );
//editor->get_viewport()->add_child(sample_library_editor);
sample_library_editor->set_custom_minimum_size(Size2(0,250));
button=p_node->add_bottom_panel_item("SampleLibrary",sample_library_editor);
button->hide();
//sample_library_editor->set_area_as_parent_rect();
// sample_library_editor->set_anchor( MARGIN_TOP, Control::ANCHOR_END);
// sample_library_editor->set_margin( MARGIN_TOP, 120 );
//sample_library_editor->hide();
}
示例5: _validate_no_foreign
bool SceneTreeDock::_validate_no_foreign() {
List<Node*> selection = editor_selection->get_selected_node_list();
for (List<Node*>::Element *E=selection.front();E;E=E->next()) {
if (E->get()!=edited_scene && E->get()->get_owner()!=edited_scene) {
accept->get_ok()->set_text("Makes Sense!");
accept->set_text("Can't operate on nodes from a foreign scene!");
accept->popup_centered(Size2(300,70));;
return false;
}
}
return true;
}
示例6: _add_children_to_popup
void EditorPath::_gui_input(const InputEvent& p_event) {
if (p_event.type==InputEvent::MOUSE_BUTTON && p_event.mouse_button.button_index==BUTTON_LEFT && p_event.mouse_button.pressed) {
Object *obj = ObjectDB::get_instance(history->get_path_object( history->get_path_size()-1));
if (!obj)
return;
objects.clear();
popup->clear();
_add_children_to_popup(obj);
popup->set_pos( get_global_pos() + Vector2(0,get_size().height));
popup->set_size( Size2(get_size().width,1));
popup->popup();
}
}
示例7: if
bool ImageTexture::_get(const StringName &p_name, Variant &r_ret) const {
if (p_name == "image_data") {
} else if (p_name == "image")
r_ret = get_data();
else if (p_name == "flags")
r_ret = flags;
else if (p_name == "size")
r_ret = Size2(w, h);
else if (p_name == "storage")
r_ret = storage;
else if (p_name == "lossy_quality")
r_ret = lossy_storage_quality;
else
return false;
return true;
}
示例8: popup_import
void popup_import(const String& p_path) {
popup_centered(Size2(400, 100)*EDSCALE);
if (p_path != "") {
Ref<ResourceImportMetadata> rimd = ResourceLoader::load_import_metadata(p_path);
ERR_FAIL_COND(!rimd.is_valid());
save_path->set_text(p_path.get_base_dir());
String src = "";
for (int i = 0; i<rimd->get_source_count(); i++) {
if (i>0)
src += ",";
src += EditorImportPlugin::expand_source_path(rimd->get_source_path(i));
}
import_path->set_text(src);
}
}
示例9: memnew
StyleBoxEditor::StyleBoxEditor() {
panel = memnew( Panel );
add_child(panel);
panel->set_area_as_parent_rect();
Label *l = memnew( Label );
l->set_text(TTR("StyleBox Preview:"));
l->set_pos(Point2(5,5));
panel->add_child(l);
preview = memnew( Panel );
panel->add_child(preview);
preview->set_pos(Point2(50,50));
preview->set_size(Size2(200,100));
}
示例10: glBindFramebuffer
void RasterizerGLES2::set_boot_image(const Ref<Image> &p_image, const Color &p_color, bool p_scale) {
if (p_image.is_null() || p_image->empty())
return;
int window_w = OS::get_singleton()->get_video_mode(0).width;
int window_h = OS::get_singleton()->get_video_mode(0).height;
glBindFramebuffer(GL_FRAMEBUFFER, 0);
glViewport(0, 0, window_w, window_h);
glDisable(GL_BLEND);
glDepthMask(GL_FALSE);
if (OS::get_singleton()->get_window_per_pixel_transparency_enabled()) {
glClearColor(0.0, 0.0, 0.0, 0.0);
} else {
glClearColor(p_color.r, p_color.g, p_color.b, 1.0);
}
glClear(GL_COLOR_BUFFER_BIT);
canvas->canvas_begin();
RID texture = storage->texture_create();
storage->texture_allocate(texture, p_image->get_width(), p_image->get_height(), 0, p_image->get_format(), VS::TEXTURE_TYPE_2D, VS::TEXTURE_FLAG_FILTER);
storage->texture_set_data(texture, p_image);
Rect2 imgrect(0, 0, p_image->get_width(), p_image->get_height());
Rect2 screenrect;
screenrect = imgrect;
screenrect.position += ((Size2(window_w, window_h) - screenrect.size) / 2.0).floor();
RasterizerStorageGLES2::Texture *t = storage->texture_owner.get(texture);
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, t->tex_id);
canvas->draw_generic_textured_rect(screenrect, Rect2(0, 0, 1, 1));
glBindTexture(GL_TEXTURE_2D, 0);
canvas->canvas_end();
storage->free(texture);
end_frame(true);
}
示例11: switch
void TileSetEditor::_name_dialog_confirm(const String &name) {
switch (option) {
case MENU_OPTION_REMOVE_ITEM: {
int id = tileset->find_tile_by_name(name);
if (id < 0 && name.is_valid_integer())
id = name.to_int();
if (tileset->has_tile(id)) {
tileset->remove_tile(id);
} else {
err_dialog->set_text(TTR("Could not find tile:") + " " + name);
err_dialog->popup_centered(Size2(300, 60));
}
} break;
}
}
示例12: ERR_FAIL_COND
void BitMap::create_from_image_alpha(const Image &p_image) {
ERR_FAIL_COND(p_image.empty());
Image img = p_image;
img.convert(Image::FORMAT_LA8);
ERR_FAIL_COND(img.get_format() != Image::FORMAT_LA8);
create(Size2(img.get_width(), img.get_height()));
PoolVector<uint8_t>::Read r = img.get_data().read();
uint8_t *w = bitmask.ptr();
for (int i = 0; i < width * height; i++) {
int bbyte = i / 8;
int bbit = i % 8;
if (r[i * 2])
w[bbyte] |= (1 << bbit);
}
}
示例13: Size2
Size2 TextureButton::get_minimum_size() const {
Size2 rscale;
if (normal.is_null()) {
if (pressed.is_null()) {
if (hover.is_null())
if (click_mask.is_null())
rscale= Size2();
else
rscale= click_mask->get_size();
else
rscale= hover->get_size();
} else
rscale= pressed->get_size()*scale;
} else
rscale= normal->get_size();
return rscale*scale;
}
示例14:
void CollisionPolygon2D::set_polygon(const Vector<Point2>& p_polygon) {
polygon=p_polygon;
for(int i=0;i<polygon.size();i++) {
if (i==0)
aabb=Rect2(polygon[i],Size2());
else
aabb.expand_to(polygon[i]);
}
if (aabb==Rect2()) {
aabb=Rect2(-10,-10,20,20);
} else {
aabb.pos-=aabb.size*0.3;
aabb.size+=aabb.size*0.6;
}
_update_parent();
update();
}
示例15: popup_centered
void EditorTextureImportDialog::popup_import(const String& p_from) {
popup_centered(Size2(400,400));
if (p_from!="") {
Ref<ResourceImportMetadata> rimd = ResourceLoader::load_import_metadata(p_from);
ERR_FAIL_COND(!rimd.is_valid());
save_path->set_text(p_from.get_base_dir());
texture_options->set_format(EditorTextureImportPlugin::ImageFormat(int(rimd->get_option("format"))));
texture_options->set_flags(rimd->get_option("flags"));
texture_options->set_quality(rimd->get_option("quality"));
String src = "";
for(int i=0;i<rimd->get_source_count();i++) {
if (i>0)
src+=",";
src+=EditorImportPlugin::expand_source_path(rimd->get_source_path(i));
}
import_path->set_text(src);
}
}