Not-Nik / raylib-zig

Manually tweaked, auto-generated raylib bindings for zig. https://github.com/raysan5/raylib
MIT License
473 stars 101 forks source link

No implementation for adding Vectors ?? #56

Closed n8an closed 9 months ago

n8an commented 9 months ago

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 commented 9 months ago

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.

n8an commented 9 months ago

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?