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

No implementation for adding Vectors ?? #56

Closed
n8an opened this issue Oct 9, 2023 · 2 comments
Closed

No implementation for adding Vectors ?? #56

n8an opened this issue Oct 9, 2023 · 2 comments

Comments

@n8an
Copy link

n8an commented Oct 9, 2023

I have initialized Vector2 using .init() ;
I tried adding it to another Vector2 using + ;
This results in an error.

I have used Raylib before with rust and it has Vector2 + Vector2 implemented.

Is it not implemented for ZIG because it is impossible or by design?
Or am I missing something?

P.S. currently because of this I resorted to manually adding Vector2.x + Vector2.x and Vector2.y + Vector2.y.
P.S.S. Also rust raylib has a lot of useful methods for Vector2 implemented aka .dot product, .lerp, and so on.
Are these not implemented also in zig raylib? Or did I miss something?

@Not-Nik
Copy link
Owner

Not-Nik commented Oct 10, 2023

Zig doesn't allow operator overloading. The functions for Vector operations are there, just not yet integrated as member functions. You can call as you would normally in C.

@Not-Nik Not-Nik closed this as not planned Won't fix, can't repro, duplicate, stale Oct 10, 2023
@n8an
Copy link
Author

n8an commented Oct 10, 2023

Ok I understand now the issue with using +-/* operators.

Now when it comes to Vector(and other) structs having their methods in them and so on.
By "not yet integrated" do you mean that this is possible in future?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants