diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2020-12-15 13:34:32 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-15 13:34:32 +0100 |
commit | 7e3424e3abe31d6c1b0c7c3a9bb5900f51297e87 (patch) | |
tree | bcb14d86ed739ade0a2b81356cda98593e480257 /scene/gui | |
parent | f9d922b057cf3ab0085520e9b39db963de952ca4 (diff) | |
parent | 57dcc831522079c7bee14b012d6eb7208f578857 (diff) |
Merge pull request #44377 from Calinou/rename-textureprogressbar
Rename the TextureProgress node to TextureProgressBar
Diffstat (limited to 'scene/gui')
-rw-r--r-- | scene/gui/texture_progress_bar.cpp (renamed from scene/gui/texture_progress.cpp) | 114 | ||||
-rw-r--r-- | scene/gui/texture_progress_bar.h (renamed from scene/gui/texture_progress.h) | 16 |
2 files changed, 65 insertions, 65 deletions
diff --git a/scene/gui/texture_progress.cpp b/scene/gui/texture_progress_bar.cpp index e0d98d1c22..b5115690ac 100644 --- a/scene/gui/texture_progress.cpp +++ b/scene/gui/texture_progress_bar.cpp @@ -1,5 +1,5 @@ /*************************************************************************/ -/* texture_progress.cpp */ +/* texture_progress_bar.cpp */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,21 +28,21 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#include "texture_progress.h" +#include "texture_progress_bar.h" #include "core/config/engine.h" -void TextureProgress::set_under_texture(const Ref<Texture2D> &p_texture) { +void TextureProgressBar::set_under_texture(const Ref<Texture2D> &p_texture) { under = p_texture; update(); minimum_size_changed(); } -Ref<Texture2D> TextureProgress::get_under_texture() const { +Ref<Texture2D> TextureProgressBar::get_under_texture() const { return under; } -void TextureProgress::set_over_texture(const Ref<Texture2D> &p_texture) { +void TextureProgressBar::set_over_texture(const Ref<Texture2D> &p_texture) { over = p_texture; update(); if (under.is_null()) { @@ -50,33 +50,33 @@ void TextureProgress::set_over_texture(const Ref<Texture2D> &p_texture) { } } -Ref<Texture2D> TextureProgress::get_over_texture() const { +Ref<Texture2D> TextureProgressBar::get_over_texture() const { return over; } -void TextureProgress::set_stretch_margin(Margin p_margin, int p_size) { +void TextureProgressBar::set_stretch_margin(Margin p_margin, int p_size) { ERR_FAIL_INDEX((int)p_margin, 4); stretch_margin[p_margin] = p_size; update(); minimum_size_changed(); } -int TextureProgress::get_stretch_margin(Margin p_margin) const { +int TextureProgressBar::get_stretch_margin(Margin p_margin) const { ERR_FAIL_INDEX_V((int)p_margin, 4, 0); return stretch_margin[p_margin]; } -void TextureProgress::set_nine_patch_stretch(bool p_stretch) { +void TextureProgressBar::set_nine_patch_stretch(bool p_stretch) { nine_patch_stretch = p_stretch; update(); minimum_size_changed(); } -bool TextureProgress::get_nine_patch_stretch() const { +bool TextureProgressBar::get_nine_patch_stretch() const { return nine_patch_stretch; } -Size2 TextureProgress::get_minimum_size() const { +Size2 TextureProgressBar::get_minimum_size() const { if (nine_patch_stretch) { return Size2(stretch_margin[MARGIN_LEFT] + stretch_margin[MARGIN_RIGHT], stretch_margin[MARGIN_TOP] + stretch_margin[MARGIN_BOTTOM]); } else if (under.is_valid()) { @@ -90,44 +90,44 @@ Size2 TextureProgress::get_minimum_size() const { return Size2(1, 1); } -void TextureProgress::set_progress_texture(const Ref<Texture2D> &p_texture) { +void TextureProgressBar::set_progress_texture(const Ref<Texture2D> &p_texture) { progress = p_texture; update(); minimum_size_changed(); } -Ref<Texture2D> TextureProgress::get_progress_texture() const { +Ref<Texture2D> TextureProgressBar::get_progress_texture() const { return progress; } -void TextureProgress::set_tint_under(const Color &p_tint) { +void TextureProgressBar::set_tint_under(const Color &p_tint) { tint_under = p_tint; update(); } -Color TextureProgress::get_tint_under() const { +Color TextureProgressBar::get_tint_under() const { return tint_under; } -void TextureProgress::set_tint_progress(const Color &p_tint) { +void TextureProgressBar::set_tint_progress(const Color &p_tint) { tint_progress = p_tint; update(); } -Color TextureProgress::get_tint_progress() const { +Color TextureProgressBar::get_tint_progress() const { return tint_progress; } -void TextureProgress::set_tint_over(const Color &p_tint) { +void TextureProgressBar::set_tint_over(const Color &p_tint) { tint_over = p_tint; update(); } -Color TextureProgress::get_tint_over() const { +Color TextureProgressBar::get_tint_over() const { return tint_over; } -Point2 TextureProgress::unit_val_to_uv(float val) { +Point2 TextureProgressBar::unit_val_to_uv(float val) { if (progress.is_null()) { return Point2(); } @@ -191,7 +191,7 @@ Point2 TextureProgress::unit_val_to_uv(float val) { return (p + t1 * dir); } -Point2 TextureProgress::get_relative_center() { +Point2 TextureProgressBar::get_relative_center() { if (progress.is_null()) { return Point2(); } @@ -204,7 +204,7 @@ Point2 TextureProgress::get_relative_center() { return p; } -void TextureProgress::draw_nine_patch_stretched(const Ref<Texture2D> &p_texture, FillMode p_mode, double p_ratio, const Color &p_modulate) { +void TextureProgressBar::draw_nine_patch_stretched(const Ref<Texture2D> &p_texture, FillMode p_mode, double p_ratio, const Color &p_modulate) { Vector2 texture_size = p_texture->get_size(); Vector2 topleft = Vector2(stretch_margin[MARGIN_LEFT], stretch_margin[MARGIN_TOP]); Vector2 bottomright = Vector2(stretch_margin[MARGIN_RIGHT], stretch_margin[MARGIN_BOTTOM]); @@ -306,7 +306,7 @@ void TextureProgress::draw_nine_patch_stretched(const Ref<Texture2D> &p_texture, RS::get_singleton()->canvas_item_add_nine_patch(ci, dst_rect, src_rect, p_texture->get_rid(), topleft, bottomright, RS::NINE_PATCH_STRETCH, RS::NINE_PATCH_STRETCH, true, p_modulate); } -void TextureProgress::_notification(int p_what) { +void TextureProgressBar::_notification(int p_what) { const float corners[12] = { -0.125, -0.375, -0.625, -0.875, 0.125, 0.375, 0.625, 0.875, 1.125, 1.375, 1.625, 1.875 }; switch (p_what) { case NOTIFICATION_DRAW: { @@ -428,17 +428,17 @@ void TextureProgress::_notification(int p_what) { } } -void TextureProgress::set_fill_mode(int p_fill) { +void TextureProgressBar::set_fill_mode(int p_fill) { ERR_FAIL_INDEX(p_fill, 9); mode = (FillMode)p_fill; update(); } -int TextureProgress::get_fill_mode() { +int TextureProgressBar::get_fill_mode() { return mode; } -void TextureProgress::set_radial_initial_angle(float p_angle) { +void TextureProgressBar::set_radial_initial_angle(float p_angle) { while (p_angle > 360) { p_angle -= 360; } @@ -449,64 +449,64 @@ void TextureProgress::set_radial_initial_angle(float p_angle) { update(); } -float TextureProgress::get_radial_initial_angle() { +float TextureProgressBar::get_radial_initial_angle() { return rad_init_angle; } -void TextureProgress::set_fill_degrees(float p_angle) { +void TextureProgressBar::set_fill_degrees(float p_angle) { rad_max_degrees = CLAMP(p_angle, 0, 360); update(); } -float TextureProgress::get_fill_degrees() { +float TextureProgressBar::get_fill_degrees() { return rad_max_degrees; } -void TextureProgress::set_radial_center_offset(const Point2 &p_off) { +void TextureProgressBar::set_radial_center_offset(const Point2 &p_off) { rad_center_off = p_off; update(); } -Point2 TextureProgress::get_radial_center_offset() { +Point2 TextureProgressBar::get_radial_center_offset() { return rad_center_off; } -void TextureProgress::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_under_texture", "tex"), &TextureProgress::set_under_texture); - ClassDB::bind_method(D_METHOD("get_under_texture"), &TextureProgress::get_under_texture); +void TextureProgressBar::_bind_methods() { + ClassDB::bind_method(D_METHOD("set_under_texture", "tex"), &TextureProgressBar::set_under_texture); + ClassDB::bind_method(D_METHOD("get_under_texture"), &TextureProgressBar::get_under_texture); - ClassDB::bind_method(D_METHOD("set_progress_texture", "tex"), &TextureProgress::set_progress_texture); - ClassDB::bind_method(D_METHOD("get_progress_texture"), &TextureProgress::get_progress_texture); + ClassDB::bind_method(D_METHOD("set_progress_texture", "tex"), &TextureProgressBar::set_progress_texture); + ClassDB::bind_method(D_METHOD("get_progress_texture"), &TextureProgressBar::get_progress_texture); - ClassDB::bind_method(D_METHOD("set_over_texture", "tex"), &TextureProgress::set_over_texture); - ClassDB::bind_method(D_METHOD("get_over_texture"), &TextureProgress::get_over_texture); + ClassDB::bind_method(D_METHOD("set_over_texture", "tex"), &TextureProgressBar::set_over_texture); + ClassDB::bind_method(D_METHOD("get_over_texture"), &TextureProgressBar::get_over_texture); - ClassDB::bind_method(D_METHOD("set_fill_mode", "mode"), &TextureProgress::set_fill_mode); - ClassDB::bind_method(D_METHOD("get_fill_mode"), &TextureProgress::get_fill_mode); + ClassDB::bind_method(D_METHOD("set_fill_mode", "mode"), &TextureProgressBar::set_fill_mode); + ClassDB::bind_method(D_METHOD("get_fill_mode"), &TextureProgressBar::get_fill_mode); - ClassDB::bind_method(D_METHOD("set_tint_under", "tint"), &TextureProgress::set_tint_under); - ClassDB::bind_method(D_METHOD("get_tint_under"), &TextureProgress::get_tint_under); + ClassDB::bind_method(D_METHOD("set_tint_under", "tint"), &TextureProgressBar::set_tint_under); + ClassDB::bind_method(D_METHOD("get_tint_under"), &TextureProgressBar::get_tint_under); - ClassDB::bind_method(D_METHOD("set_tint_progress", "tint"), &TextureProgress::set_tint_progress); - ClassDB::bind_method(D_METHOD("get_tint_progress"), &TextureProgress::get_tint_progress); + ClassDB::bind_method(D_METHOD("set_tint_progress", "tint"), &TextureProgressBar::set_tint_progress); + ClassDB::bind_method(D_METHOD("get_tint_progress"), &TextureProgressBar::get_tint_progress); - ClassDB::bind_method(D_METHOD("set_tint_over", "tint"), &TextureProgress::set_tint_over); - ClassDB::bind_method(D_METHOD("get_tint_over"), &TextureProgress::get_tint_over); + ClassDB::bind_method(D_METHOD("set_tint_over", "tint"), &TextureProgressBar::set_tint_over); + ClassDB::bind_method(D_METHOD("get_tint_over"), &TextureProgressBar::get_tint_over); - ClassDB::bind_method(D_METHOD("set_radial_initial_angle", "mode"), &TextureProgress::set_radial_initial_angle); - ClassDB::bind_method(D_METHOD("get_radial_initial_angle"), &TextureProgress::get_radial_initial_angle); + ClassDB::bind_method(D_METHOD("set_radial_initial_angle", "mode"), &TextureProgressBar::set_radial_initial_angle); + ClassDB::bind_method(D_METHOD("get_radial_initial_angle"), &TextureProgressBar::get_radial_initial_angle); - ClassDB::bind_method(D_METHOD("set_radial_center_offset", "mode"), &TextureProgress::set_radial_center_offset); - ClassDB::bind_method(D_METHOD("get_radial_center_offset"), &TextureProgress::get_radial_center_offset); + ClassDB::bind_method(D_METHOD("set_radial_center_offset", "mode"), &TextureProgressBar::set_radial_center_offset); + ClassDB::bind_method(D_METHOD("get_radial_center_offset"), &TextureProgressBar::get_radial_center_offset); - ClassDB::bind_method(D_METHOD("set_fill_degrees", "mode"), &TextureProgress::set_fill_degrees); - ClassDB::bind_method(D_METHOD("get_fill_degrees"), &TextureProgress::get_fill_degrees); + ClassDB::bind_method(D_METHOD("set_fill_degrees", "mode"), &TextureProgressBar::set_fill_degrees); + ClassDB::bind_method(D_METHOD("get_fill_degrees"), &TextureProgressBar::get_fill_degrees); - ClassDB::bind_method(D_METHOD("set_stretch_margin", "margin", "value"), &TextureProgress::set_stretch_margin); - ClassDB::bind_method(D_METHOD("get_stretch_margin", "margin"), &TextureProgress::get_stretch_margin); + ClassDB::bind_method(D_METHOD("set_stretch_margin", "margin", "value"), &TextureProgressBar::set_stretch_margin); + ClassDB::bind_method(D_METHOD("get_stretch_margin", "margin"), &TextureProgressBar::get_stretch_margin); - ClassDB::bind_method(D_METHOD("set_nine_patch_stretch", "stretch"), &TextureProgress::set_nine_patch_stretch); - ClassDB::bind_method(D_METHOD("get_nine_patch_stretch"), &TextureProgress::get_nine_patch_stretch); + ClassDB::bind_method(D_METHOD("set_nine_patch_stretch", "stretch"), &TextureProgressBar::set_nine_patch_stretch); + ClassDB::bind_method(D_METHOD("get_nine_patch_stretch"), &TextureProgressBar::get_nine_patch_stretch); ADD_GROUP("Textures", "texture_"); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "texture_under", PROPERTY_HINT_RESOURCE_TYPE, "Texture2D"), "set_under_texture", "get_under_texture"); @@ -539,7 +539,7 @@ void TextureProgress::_bind_methods() { BIND_ENUM_CONSTANT(FILL_CLOCKWISE_AND_COUNTER_CLOCKWISE); } -TextureProgress::TextureProgress() { +TextureProgressBar::TextureProgressBar() { mode = FILL_LEFT_TO_RIGHT; rad_init_angle = 0; rad_center_off = Point2(); diff --git a/scene/gui/texture_progress.h b/scene/gui/texture_progress_bar.h index 5e29fca21f..342e719a59 100644 --- a/scene/gui/texture_progress.h +++ b/scene/gui/texture_progress_bar.h @@ -1,5 +1,5 @@ /*************************************************************************/ -/* texture_progress.h */ +/* texture_progress_bar.h */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,13 +28,13 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef TEXTURE_PROGRESS_H -#define TEXTURE_PROGRESS_H +#ifndef TEXTURE_PROGRESS_BAR_H +#define TEXTURE_PROGRESS_BAR_H #include "scene/gui/range.h" -class TextureProgress : public Range { - GDCLASS(TextureProgress, Range); +class TextureProgressBar : public Range { + GDCLASS(TextureProgressBar, Range); Ref<Texture2D> under; Ref<Texture2D> progress; @@ -95,7 +95,7 @@ public: Size2 get_minimum_size() const override; - TextureProgress(); + TextureProgressBar(); private: FillMode mode; @@ -111,6 +111,6 @@ private: void draw_nine_patch_stretched(const Ref<Texture2D> &p_texture, FillMode p_mode, double p_ratio, const Color &p_modulate); }; -VARIANT_ENUM_CAST(TextureProgress::FillMode); +VARIANT_ENUM_CAST(TextureProgressBar::FillMode); -#endif // TEXTURE_PROGRESS_H +#endif // TEXTURE_PROGRESS_BAR_H |