mirror of
https://github.com/godotengine/godot.git
synced 2026-01-05 06:11:29 +03:00
Improve set_radial_initial_angle by removing loops
Replace two while loops with fposmodp. Document radial_initial_angle wrapping. Add testcases for set_radial_initial_angle()
This commit is contained in:
@@ -608,11 +608,10 @@ int TextureProgressBar::get_fill_mode() {
|
||||
}
|
||||
|
||||
void TextureProgressBar::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(!Math::is_finite(p_angle), "Angle is non-finite.");
|
||||
|
||||
if (p_angle < 0.0 || p_angle > 360.0) {
|
||||
p_angle = Math::fposmodp(p_angle, 360.0f);
|
||||
}
|
||||
|
||||
if (rad_init_angle == p_angle) {
|
||||
|
||||
Reference in New Issue
Block a user