diff options
-rw-r--r-- | drivers/gles2/rasterizer_gles2.cpp | 7 | ||||
-rw-r--r-- | scene/gui/tab_container.cpp | 33 | ||||
-rw-r--r-- | scene/gui/tab_container.h | 2 |
3 files changed, 40 insertions, 2 deletions
diff --git a/drivers/gles2/rasterizer_gles2.cpp b/drivers/gles2/rasterizer_gles2.cpp index 0072ca9c86..ccbba2f51c 100644 --- a/drivers/gles2/rasterizer_gles2.cpp +++ b/drivers/gles2/rasterizer_gles2.cpp @@ -8188,14 +8188,17 @@ void RasterizerGLES2::canvas_draw_polygon(int p_vertex_count, const int* p_indic } if (p_indices) { - - static const int _max_draw_poly_indices = 8*1024; // change this size if needed!!! +#ifdef GLEW_ENABLED + glDrawElements(GL_TRIANGLES, p_vertex_count, GL_UNSIGNED_INT, p_indices ); +#else + static const int _max_draw_poly_indices = 16*1024; // change this size if needed!!! ERR_FAIL_COND(p_vertex_count > _max_draw_poly_indices); static uint16_t _draw_poly_indices[_max_draw_poly_indices]; for (int i=0; i<p_vertex_count; i++) { _draw_poly_indices[i] = p_indices[i]; }; glDrawElements(GL_TRIANGLES, p_vertex_count, GL_UNSIGNED_SHORT, _draw_poly_indices ); +#endif //glDrawElements(GL_TRIANGLES, p_vertex_count, GL_UNSIGNED_INT, p_indices ); } else { glDrawArrays(GL_TRIANGLES,0,p_vertex_count); diff --git a/scene/gui/tab_container.cpp b/scene/gui/tab_container.cpp index 2d6f3cd27a..12a8a83f26 100644 --- a/scene/gui/tab_container.cpp +++ b/scene/gui/tab_container.cpp @@ -602,6 +602,39 @@ void TabContainer::get_translatable_strings(List<String> *p_strings) const { } +Size2 TabContainer::get_minimum_size() const { + + Size2 ms; + + for(int i=0;i<get_child_count();i++) { + + Control *c = get_child(i)->cast_to<Control>(); + if (!c) + continue; + if (c->is_set_as_toplevel()) + continue; + + if (!c->has_meta("_tab_name")) + continue; + + if (!c->is_visible()) + continue; + + Size2 cms = c->get_minimum_size(); + ms.x=MAX(ms.x,cms.x); + ms.y=MAX(ms.y,cms.y); + } + + Ref<StyleBox> tab_bg = get_stylebox("tab_bg"); + Ref<StyleBox> tab_fg = get_stylebox("tab_fg"); + Ref<Font> font = get_font("font"); + + ms.y+=MAX(tab_bg->get_minimum_size().y,tab_fg->get_minimum_size().y); + ms.y+=font->get_height(); + + return ms; +} + void TabContainer::_bind_methods() { ObjectTypeDB::bind_method(_MD("_input_event"),&TabContainer::_input_event); diff --git a/scene/gui/tab_container.h b/scene/gui/tab_container.h index d5b6a2b503..df7b03e040 100644 --- a/scene/gui/tab_container.h +++ b/scene/gui/tab_container.h @@ -85,6 +85,8 @@ public: void set_current_tab(int p_current); int get_current_tab() const; + virtual Size2 get_minimum_size() const; + virtual void get_translatable_strings(List<String> *p_strings) const; TabContainer(); |