Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide feature parity for Vector2i with Godot #978

Merged
merged 1 commit into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading