diff options
Diffstat (limited to 'examples/resources/lib/vector2.lua')
| -rw-r--r-- | examples/resources/lib/vector2.lua | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/examples/resources/lib/vector2.lua b/examples/resources/lib/vector2.lua index 68adc2b..8616a51 100644 --- a/examples/resources/lib/vector2.lua +++ b/examples/resources/lib/vector2.lua @@ -67,7 +67,6 @@ function Vector2:newV( v ) return object end - function Vector2:set( x, y ) self.x = x or 0 self.y = y or self.x @@ -82,6 +81,10 @@ function Vector2:setV( v ) self.y = v.y end +function Vector2:serialize() + return "Vector2:new("..self.x..","..self.y..")" +end + function Vector2:arr() return { self.x, self.y } end @@ -106,6 +109,10 @@ function Vector2:max( v2 ) return Vector2:new( math.max( self.x, v2.x ), math.max( self.y, v2.y ) ) end +function Vector2:round() + return Vector2:new( RL.Round( self.x ), RL.Round( self.y ) ) +end + function Vector2:floor() return Vector2:new( math.floor( self.x ), math.floor( self.y ) ) end |
