08-16-2023, 02:52 PM
(08-16-2023, 11:53 AM)OldMoses Wrote: I feel your pain. Working with vector types just screams having a way to directly functionalize their manipulation. I resort to the somewhat clumsy approach of passing a variable back from a sub. The main issue being keeping track of which variable is the desired result. I use the first parameter as a return. Then I have to decide if I want to preserve original operands or overwrite them. At least it can be done in a fairly concise manner.Yep, I do the same sort of thing. It would be much nicer using a function instead of a subroutine though.,
I imagine that since there are no rules against multi-dimensional (4+ element) vectors, there is simply no point in trying to satisfy all possibilities. So we'll just have to do the typical hacks.
Code: (Select All)
SUB AddVector (vin AS TYPE_VECTOR, vout AS TYPE_VECTOR)
'| Add vin to vout. vout will contain the passed back result.
'|
'| AddVector MouseVector, WindowLocation
vout.x = vout.x + vin.x
vout.y = vout.y + vin.y
END SUB