You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-06 12:20:30 +00:00
Improve set_radial_initial_angle by removing loops
(cherry picked from commit 46dfd9747a)
This commit is contained in:
@@ -41,6 +41,7 @@
|
|||||||
</member>
|
</member>
|
||||||
<member name="radial_initial_angle" type="float" setter="set_radial_initial_angle" getter="get_radial_initial_angle" default="0.0">
|
<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].
|
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>
|
||||||
<member name="stretch_margin_bottom" type="int" setter="set_stretch_margin" getter="get_stretch_margin" default="0">
|
<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.
|
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.
|
||||||
|
|||||||
@@ -31,6 +31,7 @@
|
|||||||
#include "texture_progress.h"
|
#include "texture_progress.h"
|
||||||
|
|
||||||
#include "core/engine.h"
|
#include "core/engine.h"
|
||||||
|
#include "math.h"
|
||||||
|
|
||||||
void TextureProgress::set_under_texture(const Ref<Texture> &p_texture) {
|
void TextureProgress::set_under_texture(const Ref<Texture> &p_texture) {
|
||||||
under = p_texture;
|
under = p_texture;
|
||||||
@@ -577,12 +578,12 @@ int TextureProgress::get_fill_mode() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void TextureProgress::set_radial_initial_angle(float p_angle) {
|
void TextureProgress::set_radial_initial_angle(float p_angle) {
|
||||||
while (p_angle > 360) {
|
ERR_FAIL_COND_MSG(!isfinite(p_angle), "Angle is non-finite.");
|
||||||
p_angle -= 360;
|
|
||||||
}
|
if (p_angle < 0.0 || p_angle > 360.0) {
|
||||||
while (p_angle < 0) {
|
p_angle = Math::fposmod(p_angle, 360.0f);
|
||||||
p_angle += 360;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
rad_init_angle = p_angle;
|
rad_init_angle = p_angle;
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user