godot-nim / gdext-nim

Nim for Godot GDExtension. A pure library and a CLI tool.
MIT License
49 stars 5 forks source link

Accessing parts of vectors #109

Closed xix-xeaon closed 2 weeks ago

xix-xeaon commented 3 weeks ago

It confused me a lot trying to do v.x etc until I found the swizzling operator .* and realized that that's the only way of accessing the parts (besides v[0] of course). I'd like to add the following for x, y, z and w to geometrics/typedef.nim (I can create a PR):

template x[N: static int, T](v: array[N, T]): T = v[0]
template `x=`[N, T](v: var array[N, T], val: T) = v[0] = val
panno8M commented 3 weeks ago

Certainly this is needed, hope you create a PR.

panno8M commented 2 weeks ago

Speaking of which, since you have write access, you can clone gdext-nim directly and push the branch.

You can also create a PR from a fork, but it is easier to create one from a checked out topic branch.

xix-xeaon commented 2 weeks ago

There was some kind of authorization issue when I tried to publish a new branch for this repository from GitHub Desktop, so I forked and branched instead.

xix-xeaon commented 2 weeks ago

Implemented in #116.