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

Construct Vector2 & Vector2i from a single int/float value. #148

Open
wants to merge 1 commit into
base: blazium-dev
Choose a base branch
from

Conversation

WhalesState
Copy link

@WhalesState WhalesState commented Nov 25, 2024

GDScript Example:

print(Vector2() == Vector2(0, 0) and Vector2(0) == Vector2(0, 0)) # prints "true"
print(Vector2(12) == Vector2(12.0, 12.0)) # prints "true"

print(Vector2i() == Vector2i(0, 0) and Vector2i(0) == Vector2i(0, 0)) # prints "true"
print(Vector2i(12.5) == Vector2i(12, 12)) # prints "true"

C++ Example:

print_line(Vector2(0) == Vector2(0, 0)); // prints "true"
print_line(Vector2(12) == Vector2(12.0, 12.0)); // prints "true"

print_line(Vector2i(0) == Vector2i(0, 0)); // prints "true"
print_line(Vector2i(12.5) == Vector2i(12, 12)); // prints "true"

@WhalesState WhalesState force-pushed the vector2-from-int branch 6 times, most recently from 7095b6c to 8eef1fc Compare November 25, 2024 04:43
@WhalesState WhalesState marked this pull request as draft November 25, 2024 17:36
@WhalesState WhalesState force-pushed the vector2-from-int branch 8 times, most recently from 9f9b630 to 5b9fe9a Compare November 26, 2024 08:14
@Ughuuu
Copy link

Ughuuu commented Nov 26, 2024

Nice PR but I would not change the godot sourcecode with this just yet, as it introduces a lot of changes that will generate long term merge conflicts. You can add your change most likely to godot and godot-cpp, but no need to update the godot codebase with this. Eg. the file core/input/input.cpp doesn't need to update to this new constructor, as it's internal implementation.

@WhalesState
Copy link
Author

WhalesState commented Nov 26, 2024

Will keep this as a draft, until I do some local tests if it works fine with current godot GDExtensions, then i will split it into two PRs to make it easier to be reviewed.

@WhalesState WhalesState marked this pull request as ready for review November 28, 2024 11:18
@WhalesState WhalesState changed the title Construct Vector2 & Vector2i from int or float. Construct Vector2 & Vector2i from a single int/float value. Nov 28, 2024
@jss2a98aj jss2a98aj added the enhancement New feature or request label Dec 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants