08-16-2023, 02:26 AM
So many times I have wished for this:
TYPE TYPE_VECTOR
x AS SINGLE
y AS SINGLE
END TYPE
FUNCTION AddVector(v1 AS TYPE_VECTOR, v2 AS TYPE_VECTOR) AS TYPE_VECTOR
AddVector.x = v1.x + v2.x
AddVector.y = v1.y + v2.y
END FUNCTION
Or even this would be awesome
DIM v1 AS TYPE_VECTOR
DIM v2 AS TYPE_VECTOR
DIM v3 AS TYPE_VECTOR
v1.x = 10: v1.y = 20
v2.x = 15: v2.y = 15
v3 = v1 + v2
( v3.x now = 25, v3.y now = 35 )
I realize neither of these concepts are in the spirit of QB64, but just imagine.
TYPE TYPE_VECTOR
x AS SINGLE
y AS SINGLE
END TYPE
FUNCTION AddVector(v1 AS TYPE_VECTOR, v2 AS TYPE_VECTOR) AS TYPE_VECTOR
AddVector.x = v1.x + v2.x
AddVector.y = v1.y + v2.y
END FUNCTION
Or even this would be awesome
DIM v1 AS TYPE_VECTOR
DIM v2 AS TYPE_VECTOR
DIM v3 AS TYPE_VECTOR
v1.x = 10: v1.y = 20
v2.x = 15: v2.y = 15
v3 = v1 + v2
( v3.x now = 25, v3.y now = 35 )
I realize neither of these concepts are in the spirit of QB64, but just imagine.