1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-04 12:00:25 +00:00

Improve set_radial_initial_angle by removing loops

(cherry picked from commit 46dfd9747a)
This commit is contained in:
arkology
2024-11-19 21:12:39 +03:00
committed by lawnjelly
parent ff5ff386c5
commit f11dd599c9
2 changed files with 7 additions and 5 deletions

View File

@@ -41,6 +41,7 @@
</member>
<member name="radial_initial_angle" type="float" setter="set_radial_initial_angle" getter="get_radial_initial_angle" default="0.0">
Starting angle for the fill of [member texture_progress] if [member fill_mode] is [constant FILL_CLOCKWISE] or [constant FILL_COUNTER_CLOCKWISE]. When the node's [code]value[/code] is equal to its [code]min_value[/code], the texture doesn't show up at all. When the [code]value[/code] increases, the texture fills and tends towards [member radial_fill_degrees].
[b]Note:[/b] [member radial_initial_angle] is wrapped between [code]0[/code] and [code]360[/code] degrees (inclusive).
</member>
<member name="stretch_margin_bottom" type="int" setter="set_stretch_margin" getter="get_stretch_margin" default="0">
The height of the 9-patch's bottom row. A margin of 16 means the 9-slice's bottom corners and side will have a height of 16 pixels. You can set all 4 margin values individually to create panels with non-uniform borders.

View File

@@ -31,6 +31,7 @@
#include "texture_progress.h"
#include "core/engine.h"
#include "math.h"
void TextureProgress::set_under_texture(const Ref<Texture> &p_texture) {
under = p_texture;
@@ -577,12 +578,12 @@ int TextureProgress::get_fill_mode() {
}
void TextureProgress::set_radial_initial_angle(float p_angle) {
while (p_angle > 360) {
p_angle -= 360;
}
while (p_angle < 0) {
p_angle += 360;
ERR_FAIL_COND_MSG(!isfinite(p_angle), "Angle is non-finite.");
if (p_angle < 0.0 || p_angle > 360.0) {
p_angle = Math::fposmod(p_angle, 360.0f);
}
rad_init_angle = p_angle;
update();
}