Object lib serialization.

This commit is contained in:
jussi
2024-05-22 00:11:40 +03:00
parent c95c797da6
commit cb1bc03681
10 changed files with 198 additions and 8 deletions

View File

@@ -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