Skip to content

Commit

Permalink
Merge pull request #978 from fpdotmonkey/vector2i-compatibility
Browse files Browse the repository at this point in the history
Provide feature parity for `Vector2i` with Godot
  • Loading branch information
Bromeon authored Dec 17, 2024
2 parents ff2dec6 + 435f586 commit c8ba45d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
8 changes: 8 additions & 0 deletions godot-codegen/src/special_cases/special_cases.rs
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,14 @@ pub fn is_builtin_method_exposed(builtin_ty: &TyName, godot_method_name: &str) -

// (add more builtin types below)

// Vector2i
| ("Vector2i", "clampi")
| ("Vector2i", "distance_squared_to")
| ("Vector2i", "distance_to")
| ("Vector2i", "maxi")
| ("Vector2i", "mini")
| ("Vector2i", "snappedi")

=> true, _ => false
}
}
Expand Down
4 changes: 4 additions & 0 deletions godot-core/src/builtin/vectors/vector_macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -800,6 +800,8 @@ macro_rules! impl_vector2x_fns {
/// Returns the axis of the vector's highest value. See [`Vector2Axis`] enum. If all components are equal, this method returns [`None`].
///
/// To mimic Godot's behavior, unwrap this function's result with `unwrap_or(Vector2Axis::X)`.
///
#[doc = concat!("*Godot equivalent: `", stringify!($Vector), ".max_axis_index`*")]
#[inline]
#[doc(alias = "max_axis_index")]
pub fn max_axis(self) -> Option<Vector2Axis> {
Expand All @@ -814,6 +816,8 @@ macro_rules! impl_vector2x_fns {
/// Returns the axis of the vector's lowest value. See [`Vector2Axis`] enum. If all components are equal, this method returns [`None`].
///
/// To mimic Godot's behavior, unwrap this function's result with `unwrap_or(Vector2Axis::Y)`.
///
#[doc = concat!("*Godot equivalent: `", stringify!($Vector), ".min_axis_index`*")]
#[inline]
#[doc(alias = "min_axis_index")]
pub fn min_axis(self) -> Option<Vector2Axis> {
Expand Down

0 comments on commit c8ba45d

Please sign in to comment.