Reformat structure string operators
The order of numbers is not changed except for Transform2D. All logic is done inside of their structures (and not in Variant). For the number of decimals printed, they now use String::num_real which works best with real_t, except for Color which is fixed at 4 decimals (this is a reliable number of float digits when converting from 16-bpc so it seems like a good choice)
This commit is contained in:
parent
6b0183ec89
commit
554c776e08
27 changed files with 90 additions and 117 deletions
|
|
@ -193,6 +193,10 @@ bool Vector2::is_equal_approx(const Vector2 &p_v) const {
|
|||
return Math::is_equal_approx(x, p_v.x) && Math::is_equal_approx(y, p_v.y);
|
||||
}
|
||||
|
||||
Vector2::operator String() const {
|
||||
return "(" + String::num_real(x, false) + ", " + String::num_real(y, false) + ")";
|
||||
}
|
||||
|
||||
/* Vector2i */
|
||||
|
||||
Vector2i Vector2i::clamp(const Vector2i &p_min, const Vector2i &p_max) const {
|
||||
|
|
@ -269,3 +273,7 @@ bool Vector2i::operator==(const Vector2i &p_vec2) const {
|
|||
bool Vector2i::operator!=(const Vector2i &p_vec2) const {
|
||||
return x != p_vec2.x || y != p_vec2.y;
|
||||
}
|
||||
|
||||
Vector2i::operator String() const {
|
||||
return "(" + itos(x) + ", " + itos(y) + ")";
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue