diff options
Diffstat (limited to 'examples/resources/lib/vector2.lua')
| -rw-r--r-- | examples/resources/lib/vector2.lua | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/examples/resources/lib/vector2.lua b/examples/resources/lib/vector2.lua index 862718f..7e3b7fb 100644 --- a/examples/resources/lib/vector2.lua +++ b/examples/resources/lib/vector2.lua @@ -38,7 +38,8 @@ Vector2.meta = { return len end, __eq = function( v1, v2 ) - return v1.x == v2.x and v1.y == v2.y + -- return v1.x == v2.x and v1.y == v2.y + return RL_Vector2Equals( v1, v2 ) == 1 end, } @@ -114,6 +115,10 @@ function Vector2:distance( v2 ) return RL_Vector2Distance( self, v2 ) end +function Vector2:distanceSqr( v2 ) + return RL_Vector2DistanceSqr( self, v2 ) +end + function Vector2:angle( v2 ) return RL_Vector2Angle( self, v2 ) end @@ -126,6 +131,10 @@ function Vector2:normalize() return Vector2:new( RL_Vector2Normalize( self ) ) end +function Vector2:transform( mat ) + return Vector2:new( RL_Vector2Transform( self, mat ) ) +end + function Vector2:lerp( v2, value ) return Vector2:new( RL_Vector2Lerp( self, v2, value ) ) end @@ -142,4 +151,20 @@ function Vector2:moveTowards( target, maxDistance ) return Vector2:new( RL_Vector2MoveTowards( self, target, maxDistance ) ) end +function Vector2:invert() + return Vector2:new( RL_Vector2Invert( self ) ) +end + +function Vector2:clamp( min, max ) + return Vector2:new( RL_Vector2Clamp( self, min, max ) ) +end + +function Vector2:clampValue( min, max ) + return Vector2:new( RL_Vector2ClampValue( self, min, max ) ) +end + +function Vector2:equals( v2 ) + return RL_Vector2Equals( self, v2 ) +end + return Vector2 |
