All global variables and functions are not in global RL table. doc_parser creates also ReiLua_API.lua.
This commit is contained in:
@@ -10,7 +10,7 @@ Color = require( "color" )
|
||||
To
|
||||
if ((CORE.Input.Keyboard.keyPressedQueueCount < MAX_KEY_PRESSED_QUEUE) && (action == GLFW_PRESS || action == GLFW_REPEAT))
|
||||
|
||||
Now GLFW_REPEAT can be read by "RL_GetKeyPressed".
|
||||
Now GLFW_REPEAT can be read by "RL.GetKeyPressed".
|
||||
]]
|
||||
|
||||
Gui = {
|
||||
@@ -39,7 +39,7 @@ Gui = {
|
||||
RECTANGLE_ROUNDED_LINES = 8,
|
||||
},
|
||||
|
||||
mouseButton = MOUSE_BUTTON_LEFT,
|
||||
mouseButton = RL.MOUSE_BUTTON_LEFT,
|
||||
font = 0,
|
||||
fontSize = 20,
|
||||
padding = 2,
|
||||
@@ -114,12 +114,12 @@ function Gui.set2Back( cell )
|
||||
end
|
||||
|
||||
function Gui.process( mousePosition )
|
||||
local mouseWheel = RL_GetMouseWheelMove()
|
||||
local mouseWheel = RL.GetMouseWheelMove()
|
||||
|
||||
Gui._mousePos = mousePosition
|
||||
|
||||
if Gui.heldCallback ~= nil then
|
||||
if RL_IsMouseButtonDown( Gui.mouseButton ) then
|
||||
if RL.IsMouseButtonDown( Gui.mouseButton ) then
|
||||
Gui.heldCallback()
|
||||
else
|
||||
Gui.heldCallback = nil
|
||||
@@ -129,7 +129,7 @@ function Gui.process( mousePosition )
|
||||
end
|
||||
|
||||
local foundFirst = false
|
||||
|
||||
|
||||
-- Go backwards on process check so we trigger the top most ui first and stop there.
|
||||
for i = #Gui._cells, 1, -1 do
|
||||
local cell = Gui._cells[i]
|
||||
@@ -137,11 +137,11 @@ function Gui.process( mousePosition )
|
||||
if cell ~= nil then
|
||||
if not foundFirst and cell.isMouseOver ~= nil and cell:isMouseOver( mousePosition ) and not cell.disabled then
|
||||
-- On clicked.
|
||||
if RL_IsMouseButtonPressed( Gui.mouseButton ) and cell.onClicked ~= nil then
|
||||
if RL.IsMouseButtonPressed( Gui.mouseButton ) and cell.onClicked ~= nil then
|
||||
cell:onClicked()
|
||||
end
|
||||
-- On held.
|
||||
if RL_IsMouseButtonDown( Gui.mouseButton ) and cell.onHeld ~= nil then
|
||||
if RL.IsMouseButtonDown( Gui.mouseButton ) and cell.onHeld ~= nil then
|
||||
cell:onHeld()
|
||||
end
|
||||
-- Mouse wheel scrolling.
|
||||
@@ -149,19 +149,19 @@ function Gui.process( mousePosition )
|
||||
if cell._parent ~= nil and cell._parent.scrollable then
|
||||
cell = cell._parent
|
||||
end
|
||||
|
||||
|
||||
if cell.scrollable then
|
||||
local pos = Vec2:new( cell._scrollRect.x, cell._scrollRect.y )
|
||||
local scrollVec = Vec2:new( 0, cell.scrollAmount * mouseWheel )
|
||||
|
||||
if RL_IsKeyDown( KEY_LEFT_SHIFT ) then
|
||||
|
||||
if RL.IsKeyDown( RL.KEY_LEFT_SHIFT ) then
|
||||
scrollVec = Vec2:new( cell.scrollAmount * mouseWheel, 0 )
|
||||
end
|
||||
|
||||
|
||||
cell:scroll( pos - scrollVec )
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
foundFirst = true
|
||||
elseif cell.notMouseOver ~= nil then
|
||||
cell:notMouseOver()
|
||||
@@ -172,7 +172,7 @@ function Gui.process( mousePosition )
|
||||
-- Text input.
|
||||
if Gui._inputItem ~= nil then
|
||||
repeat
|
||||
local char = RL_GetCharPressed()
|
||||
local char = RL.GetCharPressed()
|
||||
|
||||
if 0 < char then
|
||||
if utf8.len( Gui._inputItem.text ) < Gui._inputItem.maxTextLen then
|
||||
@@ -183,24 +183,24 @@ function Gui.process( mousePosition )
|
||||
until char == 0
|
||||
|
||||
repeat
|
||||
local key = RL_GetKeyPressed()
|
||||
local key = RL.GetKeyPressed()
|
||||
|
||||
if 0 < key then
|
||||
if key == KEY_BACKSPACE then
|
||||
if key == RL.KEY_BACKSPACE then
|
||||
Gui._inputItem.text = util.utf8Sub( Gui._inputItem.text, 0, utf8.len( Gui._inputItem.text ) - 1 )
|
||||
elseif key == KEY_ENTER or key == KEY_KP_ENTER then
|
||||
elseif key == RL.KEY_ENTER or key == RL.KEY_KP_ENTER then
|
||||
if Gui._inputItem.allowLineBreak then
|
||||
Gui._inputItem.text = Gui._inputItem.text.."\n"
|
||||
else
|
||||
Gui.inputUnfocus()
|
||||
end
|
||||
elseif key == KEY_ESCAPE then
|
||||
elseif key == RL.KEY_ESCAPE then
|
||||
Gui.inputUnfocus()
|
||||
end
|
||||
end
|
||||
until key == 0
|
||||
|
||||
if readyToUnfocusInput and RL_IsMouseButtonPressed( Gui.mouseButton ) then
|
||||
if readyToUnfocusInput and RL.IsMouseButtonPressed( Gui.mouseButton ) then
|
||||
Gui.inputUnfocus()
|
||||
end
|
||||
|
||||
@@ -234,7 +234,7 @@ function Text:new( set )
|
||||
object.text = setProperty( set, "text", "" )
|
||||
object.fontSize = setProperty( set, "fontSize", Gui.fontSize )
|
||||
object.spacing = setProperty( set, "spacing", Gui.spacing )
|
||||
object.color = setProperty( set, "color", Color:new( BLACK ) )
|
||||
object.color = setProperty( set, "color", Color:new( RL.BLACK ) )
|
||||
object.maxTextLen = setProperty( set, "maxTextLen", nil )
|
||||
object.allowLineBreak = setProperty( set, "allowLineBreak", false )
|
||||
|
||||
@@ -253,7 +253,7 @@ function Text:set( text )
|
||||
self.text = text
|
||||
end
|
||||
|
||||
local textSize = Vec2:new( RL_MeasureText( self.font, self.text, self.fontSize, self.spacing ) )
|
||||
local textSize = Vec2:new( RL.MeasureText( self.font, self.text, self.fontSize, self.spacing ) )
|
||||
|
||||
self.bounds.width = textSize.x
|
||||
self.bounds.height = textSize.y
|
||||
@@ -264,7 +264,7 @@ function Text:draw()
|
||||
return
|
||||
end
|
||||
|
||||
RL_DrawText( self.font, self.text, { self._parent.bounds.x + self.bounds.x, self._parent.bounds.y + self.bounds.y }, self.fontSize, self.spacing, self.color )
|
||||
RL.DrawText( self.font, self.text, { self._parent.bounds.x + self.bounds.x, self._parent.bounds.y + self.bounds.y }, self.fontSize, self.spacing, self.color )
|
||||
end
|
||||
|
||||
-- Texture.
|
||||
@@ -283,7 +283,7 @@ function Texture:new( set )
|
||||
object.source = setProperty( set, "source", Rect:new( 0, 0, 0, 0 ) )
|
||||
object.origin = setProperty( set, "origin", Vec2:new( 0, 0 ) )
|
||||
object.rotation = setProperty( set, "rotation", 0 )
|
||||
object.color = setProperty( set, "color", Color:new( WHITE ) )
|
||||
object.color = setProperty( set, "color", Color:new( RL.WHITE ) )
|
||||
object.nPatchInfo = setProperty( set, "nPatchInfo", nil )
|
||||
|
||||
object.visible = setProperty( set, "visible", true )
|
||||
@@ -299,7 +299,7 @@ function Texture:set( texture )
|
||||
return
|
||||
end
|
||||
|
||||
local texSize = Vec2:new( RL_GetTextureSize( texture ) )
|
||||
local texSize = Vec2:new( RL.GetTextureSize( texture ) )
|
||||
|
||||
if self.bounds.width == 0 or self.bounds.height == 0 then
|
||||
self.bounds.width = texSize.x
|
||||
@@ -326,9 +326,9 @@ function Texture:draw()
|
||||
}
|
||||
|
||||
if self.nPatchInfo ~= nil then
|
||||
RL_DrawTextureNPatch( self.texture, self.nPatchInfo, dst, self.origin, self.rotation, self.color )
|
||||
RL.DrawTextureNPatch( self.texture, self.nPatchInfo, dst, self.origin, self.rotation, self.color )
|
||||
else
|
||||
RL_DrawTexturePro( self.texture, self.source, dst, self.origin, self.rotation, self.color )
|
||||
RL.DrawTexturePro( self.texture, self.source, dst, self.origin, self.rotation, self.color )
|
||||
end
|
||||
end
|
||||
|
||||
@@ -359,7 +359,7 @@ function Shape:new( set )
|
||||
object.roundness = setProperty( set, "roundness", 1 )
|
||||
object.segments = setProperty( set, "segments", 4 )
|
||||
|
||||
object.color = setProperty( set, "color", Color:new( WHITE ) )
|
||||
object.color = setProperty( set, "color", Color:new( RL.WHITE ) )
|
||||
|
||||
object.visible = setProperty( set, "visible", true )
|
||||
object._parent = nil
|
||||
@@ -392,23 +392,23 @@ function Shape:draw()
|
||||
local pos = Vec2:new( self._parent.bounds.x, self._parent.bounds.y )
|
||||
|
||||
if self.shape == Gui.SHAPE.LINE then
|
||||
RL_DrawLine( self.startPos + pos, self.endPos + pos, self.thickness, self.color )
|
||||
RL.DrawLine( self.startPos + pos, self.endPos + pos, self.thickness, self.color )
|
||||
elseif self.shape == Gui.SHAPE.CIRCLE then
|
||||
RL_DrawCircle( self.center + pos, self.radius, self.color )
|
||||
RL.DrawCircle( self.center + pos, self.radius, self.color )
|
||||
elseif self.shape == Gui.SHAPE.CIRCLE_LINES then
|
||||
RL_DrawCircleLines( self.center + pos, self.radius, self.color )
|
||||
RL.DrawCircleLines( self.center + pos, self.radius, self.color )
|
||||
elseif self.shape == Gui.SHAPE.ELLIPSE then
|
||||
RL_DrawEllipse( self.center + pos, self.radiusH, self.radiusV, self.color )
|
||||
RL.DrawEllipse( self.center + pos, self.radiusH, self.radiusV, self.color )
|
||||
elseif self.shape == Gui.SHAPE.ELLIPSE_LINES then
|
||||
RL_DrawEllipseLines( self.center + pos, self.radiusH, self.radiusV, self.color )
|
||||
RL.DrawEllipseLines( self.center + pos, self.radiusH, self.radiusV, self.color )
|
||||
elseif self.shape == Gui.SHAPE.RECTANGLE then
|
||||
RL_DrawRectangle( { self.bounds.x + pos.x, self.bounds.y + pos.y, self.bounds.width, self.bounds.height }, self.color )
|
||||
RL.DrawRectangle( { self.bounds.x + pos.x, self.bounds.y + pos.y, self.bounds.width, self.bounds.height }, self.color )
|
||||
elseif self.shape == Gui.SHAPE.RECTANGLE_LINES then
|
||||
RL_DrawRectangleLines( { self.bounds.x + pos.x, self.bounds.y + pos.y, self.bounds.width, self.bounds.height }, self.color )
|
||||
RL.DrawRectangleLines( { self.bounds.x + pos.x, self.bounds.y + pos.y, self.bounds.width, self.bounds.height }, self.color )
|
||||
elseif self.shape == Gui.SHAPE.RECTANGLE_ROUNDED then
|
||||
RL_DrawRectangleRounded( { self.bounds.x + pos.x, self.bounds.y + pos.y, self.bounds.width, self.bounds.height }, self.roundness, self.segments, self.color )
|
||||
RL.DrawRectangleRounded( { self.bounds.x + pos.x, self.bounds.y + pos.y, self.bounds.width, self.bounds.height }, self.roundness, self.segments, self.color )
|
||||
elseif self.shape == Gui.SHAPE.RECTANGLE_ROUNDED_LINES then
|
||||
RL_DrawRectangleRoundedLines( { self.bounds.x + pos.x, self.bounds.y + pos.y, self.bounds.width, self.bounds.height }, self.roundness, self.segments, self.thickness, self.color )
|
||||
RL.DrawRectangleRoundedLines( { self.bounds.x + pos.x, self.bounds.y + pos.y, self.bounds.width, self.bounds.height }, self.roundness, self.segments, self.thickness, self.color )
|
||||
end
|
||||
end
|
||||
|
||||
@@ -428,10 +428,10 @@ function Element:new( set )
|
||||
object.visible = setProperty( set, "visible", true )
|
||||
object.disabled = setProperty( set, "disabled", false )
|
||||
object.drawBounds = setProperty( set, "drawBounds", false )
|
||||
object.color = setProperty( set, "color", Color:new( GRAY ) )
|
||||
object.color = setProperty( set, "color", Color:new( RL.GRAY ) )
|
||||
|
||||
object.items = {}
|
||||
|
||||
|
||||
object._visibilityBounds = nil
|
||||
-- Callbacks.
|
||||
object.onMouseOver = setProperty( set, "onMouseOver", nil )
|
||||
@@ -481,10 +481,10 @@ function Element:add( item )
|
||||
end
|
||||
|
||||
function Element:isMouseOver( mousePosition )
|
||||
local over = RL_CheckCollisionPointRec( mousePosition, self.bounds )
|
||||
local over = RL.CheckCollisionPointRec( mousePosition, self.bounds )
|
||||
|
||||
if over and self._visibilityBounds ~= nil then
|
||||
over = RL_CheckCollisionPointRec( mousePosition, self._visibilityBounds )
|
||||
over = RL.CheckCollisionPointRec( mousePosition, self._visibilityBounds )
|
||||
end
|
||||
|
||||
if over and self.onMouseOver ~= nil then
|
||||
@@ -498,7 +498,7 @@ function Element:draw()
|
||||
local usedScissor = false
|
||||
|
||||
if self._visibilityBounds ~= nil then
|
||||
local rect = Rect:new( RL_GetCollisionRec( self.bounds, self._visibilityBounds ) )
|
||||
local rect = Rect:new( RL.GetCollisionRec( self.bounds, self._visibilityBounds ) )
|
||||
|
||||
-- Use scissor mode only on partyally visible.
|
||||
if rect.width == 0 and rect.height == 0 then
|
||||
@@ -506,12 +506,12 @@ function Element:draw()
|
||||
elseif math.floor( rect.width ) ~= math.floor( self.bounds.width )
|
||||
or math.floor( rect.height ) ~= math.floor( self.bounds.height ) then
|
||||
usedScissor = true
|
||||
RL_BeginScissorMode( self._visibilityBounds )
|
||||
RL.BeginScissorMode( self._visibilityBounds )
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
if self.drawBounds then
|
||||
RL_DrawRectangle( self.bounds, self.color )
|
||||
RL.DrawRectangle( self.bounds, self.color )
|
||||
end
|
||||
|
||||
for _, item in ipairs( self.items ) do
|
||||
@@ -519,7 +519,7 @@ function Element:draw()
|
||||
end
|
||||
|
||||
if usedScissor then
|
||||
RL_EndScissorMode()
|
||||
RL.EndScissorMode()
|
||||
end
|
||||
|
||||
end
|
||||
@@ -557,15 +557,15 @@ function Container:new( set )
|
||||
object.showScrollbar = setProperty( set, "showScrollbar", false )
|
||||
object.scrollbarWidth = setProperty( set, "scrollbarWidth", Gui.scrollbarWidth )
|
||||
object.scrollAmount = setProperty( set, "scrollAmount", Gui.scrollAmount ) -- When using mouse scroll.
|
||||
object.color = setProperty( set, "color", Color:new( WHITE ) )
|
||||
object.color = setProperty( set, "color", Color:new( RL.WHITE ) )
|
||||
object.drawBounds = setProperty( set, "drawBounds", false )
|
||||
object.drawScrollRect = setProperty( set, "drawScrollRect", false )
|
||||
-- For grid container. Do not set both.
|
||||
object.columns = setProperty( set, "columns", nil )
|
||||
object.rows = setProperty( set, "rows", nil )
|
||||
|
||||
|
||||
object.cells = {}
|
||||
|
||||
|
||||
object._visibilityBounds = nil -- Will give this to it's children.
|
||||
object._scrollRect = Rect:new( 0, 0, 0, 0 )
|
||||
object._VScrollbarRect = Rect:new( 0, 0, 0, 0 )
|
||||
@@ -638,10 +638,10 @@ function Container:mouseScroll( v )
|
||||
end
|
||||
|
||||
function Container:isMouseOver( mousePosition )
|
||||
local over = RL_CheckCollisionPointRec( mousePosition, self.bounds )
|
||||
local over = RL.CheckCollisionPointRec( mousePosition, self.bounds )
|
||||
|
||||
if over and self._visibilityBounds ~= nil then
|
||||
over = RL_CheckCollisionPointRec( mousePosition, self._visibilityBounds )
|
||||
over = RL.CheckCollisionPointRec( mousePosition, self._visibilityBounds )
|
||||
end
|
||||
|
||||
if over and self.onMouseOver ~= nil then
|
||||
@@ -668,7 +668,7 @@ function Container:updateScrollbar()
|
||||
self._VScrollbar.visible = false
|
||||
self._VScrollbar.disabled = true
|
||||
end
|
||||
|
||||
|
||||
if self.bounds.width < self._scrollRect.width then
|
||||
self._HScrollbar.bounds.width = self.bounds.width
|
||||
self._HScrollbar.bounds.height = self.scrollbarWidth
|
||||
@@ -701,7 +701,7 @@ function Container:update()
|
||||
self._VScrollbar = Element:new( {
|
||||
padding = 0,
|
||||
drawBounds = true,
|
||||
color = Color:new( GRAY ),
|
||||
color = Color:new( RL.GRAY ),
|
||||
onClicked = function() Gui.heldCallback = function() self:mouseScroll( Vec2:new( 0, 1 ) ) end end,
|
||||
} )
|
||||
|
||||
@@ -710,7 +710,7 @@ function Container:update()
|
||||
VAling = Gui.ALING.NONE,
|
||||
bounds = Rect:new( 0, 0, 0, 0 ),
|
||||
shape = Gui.SHAPE.RECTANGLE_ROUNDED,
|
||||
color = Color:new( LIGHTGRAY ),
|
||||
color = Color:new( RL.LIGHTGRAY ),
|
||||
} ) )
|
||||
end
|
||||
|
||||
@@ -718,7 +718,7 @@ function Container:update()
|
||||
self._HScrollbar = Element:new( {
|
||||
padding = 0,
|
||||
drawBounds = true,
|
||||
color = Color:new( GRAY ),
|
||||
color = Color:new( RL.GRAY ),
|
||||
onClicked = function() Gui.heldCallback = function() self:mouseScroll( Vec2:new( 1, 0 ) ) end end,
|
||||
} )
|
||||
|
||||
@@ -727,7 +727,7 @@ function Container:update()
|
||||
VAling = Gui.ALING.CENTER,
|
||||
bounds = Rect:new( 0, 0, 0, 0 ),
|
||||
shape = Gui.SHAPE.RECTANGLE_ROUNDED,
|
||||
color = Color:new( LIGHTGRAY ),
|
||||
color = Color:new( RL.LIGHTGRAY ),
|
||||
} ) )
|
||||
end
|
||||
end
|
||||
@@ -748,7 +748,7 @@ function Container:update()
|
||||
elseif self.HAling == Gui.ALING.RIGHT then
|
||||
pos.x = self.bounds.x + self.bounds.width - cell.bounds.width - self.spacing
|
||||
end
|
||||
|
||||
|
||||
cell.bounds.x = pos.x - self._scrollRect.x
|
||||
cell.bounds.y = pos.y - self._scrollRect.y
|
||||
|
||||
@@ -811,7 +811,7 @@ function Container:delete()
|
||||
for _, cell in ipairs( self.cells ) do
|
||||
cell:delete()
|
||||
end
|
||||
|
||||
|
||||
if self._VScrollbar ~= nil then
|
||||
Gui.delete( self._VScrollbar )
|
||||
end
|
||||
@@ -828,7 +828,7 @@ function Container:set2Top()
|
||||
for _, cell in ipairs( self.cells ) do
|
||||
cell:set2Top()
|
||||
end
|
||||
|
||||
|
||||
if self._VScrollbar ~= nil then
|
||||
Gui.set2Top( self._VScrollbar )
|
||||
end
|
||||
@@ -844,27 +844,27 @@ function Container:set2Back()
|
||||
if self._HScrollbar ~= nil then
|
||||
Gui.set2Back( self._HScrollbar )
|
||||
end
|
||||
|
||||
|
||||
for _, cell in ipairs( self.cells ) do
|
||||
cell:set2Back()
|
||||
end
|
||||
|
||||
|
||||
Gui.set2Back( self )
|
||||
end
|
||||
|
||||
function Container:draw()
|
||||
if self.drawBounds then
|
||||
RL_DrawRectangle( self.bounds, self.color )
|
||||
RL.DrawRectangle( self.bounds, self.color )
|
||||
end
|
||||
|
||||
if self.drawScrollRect then
|
||||
RL_DrawRectangleLines( {
|
||||
RL.DrawRectangleLines( {
|
||||
self.bounds.x - self._scrollRect.x,
|
||||
self.bounds.y - self._scrollRect.y,
|
||||
self._scrollRect.width,
|
||||
self._scrollRect.height,
|
||||
},
|
||||
RED )
|
||||
RL.RED )
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ function utillib.deepCopy( orig )
|
||||
for origKey, origValue in next, orig, nil do
|
||||
-- If object has clone method, use that.
|
||||
if type( origValue ) == "table" and type( origValue.clone ) == "function" then
|
||||
copy[ utillib.deepCopy( origKey ) ] = orig_value:clone()
|
||||
copy[ utillib.deepCopy( origKey ) ] = origValue:clone()
|
||||
else
|
||||
copy[ utillib.deepCopy( origKey ) ] = utillib.deepCopy( origValue )
|
||||
end
|
||||
@@ -128,9 +128,9 @@ end
|
||||
|
||||
function utillib.wrapAngleRad( angle )
|
||||
if angle < 0 then
|
||||
return math.fmod( angle, PI * 2 ) + PI * 2
|
||||
return math.fmod( angle, RL.PI * 2 ) + RL.PI * 2
|
||||
else
|
||||
return math.fmod( angle, PI * 2 )
|
||||
return math.fmod( angle, RL.PI * 2 )
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ Vector2.meta = {
|
||||
return len
|
||||
end,
|
||||
__eq = function( v1, v2 )
|
||||
return RL_Vector2Equals( v1, v2 ) == 1
|
||||
return RL.Vector2Equals( v1, v2 ) == 1
|
||||
end,
|
||||
}
|
||||
|
||||
@@ -91,79 +91,79 @@ function Vector2:max( v2 )
|
||||
end
|
||||
|
||||
function Vector2:addValue( value )
|
||||
return Vector2:new( RL_Vector2AddValue( self, value ) )
|
||||
return Vector2:new( RL.Vector2AddValue( self, value ) )
|
||||
end
|
||||
|
||||
function Vector2:subValue( value )
|
||||
return Vector2:new( RL_Vector2SubtractValue( self, value ) )
|
||||
return Vector2:new( RL.Vector2SubtractValue( self, value ) )
|
||||
end
|
||||
|
||||
function Vector2:length()
|
||||
return RL_Vector2Length( self )
|
||||
return RL.Vector2Length( self )
|
||||
end
|
||||
|
||||
function Vector2:lengthSqr()
|
||||
return RL_Vector2LengthSqr( self )
|
||||
return RL.Vector2LengthSqr( self )
|
||||
end
|
||||
|
||||
function Vector2:dot( v2 )
|
||||
return RL_Vector2DotProduct( self, v2 )
|
||||
return RL.Vector2DotProduct( self, v2 )
|
||||
end
|
||||
|
||||
function Vector2:distance( v2 )
|
||||
return RL_Vector2Distance( self, v2 )
|
||||
return RL.Vector2Distance( self, v2 )
|
||||
end
|
||||
|
||||
function Vector2:distanceSqr( v2 )
|
||||
return RL_Vector2DistanceSqr( self, v2 )
|
||||
return RL.Vector2DistanceSqr( self, v2 )
|
||||
end
|
||||
|
||||
function Vector2:angle( v2 )
|
||||
return RL_Vector2Angle( self, v2 )
|
||||
return RL.Vector2Angle( self, v2 )
|
||||
end
|
||||
|
||||
function Vector2:scale( scale )
|
||||
return Vector2:new( RL_Vector2Scale( self, scale ) )
|
||||
return Vector2:new( RL.Vector2Scale( self, scale ) )
|
||||
end
|
||||
|
||||
function Vector2:normalize()
|
||||
return Vector2:new( RL_Vector2Normalize( self ) )
|
||||
return Vector2:new( RL.Vector2Normalize( self ) )
|
||||
end
|
||||
|
||||
function Vector2:transform( mat )
|
||||
return Vector2:new( RL_Vector2Transform( self, mat ) )
|
||||
return Vector2:new( RL.Vector2Transform( self, mat ) )
|
||||
end
|
||||
|
||||
function Vector2:lerp( v2, value )
|
||||
return Vector2:new( RL_Vector2Lerp( self, v2, value ) )
|
||||
return Vector2:new( RL.Vector2Lerp( self, v2, value ) )
|
||||
end
|
||||
|
||||
function Vector2:reflect( normal )
|
||||
return Vector2:new( RL_Vector2Reflect( self, normal ) )
|
||||
return Vector2:new( RL.Vector2Reflect( self, normal ) )
|
||||
end
|
||||
|
||||
function Vector2:rotate( angle )
|
||||
return Vector2:new( RL_Vector2Rotate( self, angle ) )
|
||||
return Vector2:new( RL.Vector2Rotate( self, angle ) )
|
||||
end
|
||||
|
||||
function Vector2:moveTowards( target, maxDistance )
|
||||
return Vector2:new( RL_Vector2MoveTowards( self, target, maxDistance ) )
|
||||
return Vector2:new( RL.Vector2MoveTowards( self, target, maxDistance ) )
|
||||
end
|
||||
|
||||
function Vector2:invert()
|
||||
return Vector2:new( RL_Vector2Invert( self ) )
|
||||
return Vector2:new( RL.Vector2Invert( self ) )
|
||||
end
|
||||
|
||||
function Vector2:clamp( min, max )
|
||||
return Vector2:new( RL_Vector2Clamp( self, min, max ) )
|
||||
return Vector2:new( RL.Vector2Clamp( self, min, max ) )
|
||||
end
|
||||
|
||||
function Vector2:clampValue( min, max )
|
||||
return Vector2:new( RL_Vector2ClampValue( self, min, max ) )
|
||||
return Vector2:new( RL.Vector2ClampValue( self, min, max ) )
|
||||
end
|
||||
|
||||
function Vector2:equals( v2 )
|
||||
return RL_Vector2Equals( self, v2 )
|
||||
return RL.Vector2Equals( self, v2 )
|
||||
end
|
||||
|
||||
return Vector2
|
||||
|
||||
@@ -38,7 +38,7 @@ Vector3.meta = {
|
||||
return len
|
||||
end,
|
||||
__eq = function( v1, v2 )
|
||||
return RL_Vector3Equals( v1, v2 ) == 1
|
||||
return RL.Vector3Equals( v1, v2 ) == 1
|
||||
end,
|
||||
}
|
||||
|
||||
@@ -85,104 +85,104 @@ function Vector3:abs()
|
||||
end
|
||||
|
||||
function Vector3:min( v2 )
|
||||
return Vector3:new( RL_Vector3Min( self, v2 ) )
|
||||
return Vector3:new( RL.Vector3Min( self, v2 ) )
|
||||
end
|
||||
|
||||
function Vector3:max( v2 )
|
||||
return Vector3:new( RL_Vector3Max( self, v2 ) )
|
||||
return Vector3:new( RL.Vector3Max( self, v2 ) )
|
||||
end
|
||||
|
||||
function Vector3:addValue( value )
|
||||
return Vector3:new( RL_Vector3AddValue( self, value ) )
|
||||
return Vector3:new( RL.Vector3AddValue( self, value ) )
|
||||
end
|
||||
|
||||
function Vector3:subValue( value )
|
||||
return Vector3:new( RL_Vector3SubtractValue( self, value ) )
|
||||
return Vector3:new( RL.Vector3SubtractValue( self, value ) )
|
||||
end
|
||||
|
||||
function Vector3:scale( scalar )
|
||||
return Vector3:new( RL_Vector3Scale( self, scalar ) )
|
||||
return Vector3:new( RL.Vector3Scale( self, scalar ) )
|
||||
end
|
||||
|
||||
function Vector3:cross( v2 )
|
||||
return Vector3:new( RL_Vector3CrossProduct( self, v2 ) )
|
||||
return Vector3:new( RL.Vector3CrossProduct( self, v2 ) )
|
||||
end
|
||||
|
||||
function Vector3:perpendicular()
|
||||
return Vector3:new( RL_Vector3Perpendicular( self ) )
|
||||
return Vector3:new( RL.Vector3Perpendicular( self ) )
|
||||
end
|
||||
|
||||
function Vector3:length()
|
||||
return RL_Vector3Length( self )
|
||||
return RL.Vector3Length( self )
|
||||
end
|
||||
|
||||
function Vector3:lengthSqr()
|
||||
return RL_Vector3LengthSqr( self )
|
||||
return RL.Vector3LengthSqr( self )
|
||||
end
|
||||
|
||||
function Vector3:dot( v2 )
|
||||
return RL_Vector3DotProduct( self, v2 )
|
||||
return RL.Vector3DotProduct( self, v2 )
|
||||
end
|
||||
|
||||
function Vector3:distance( v2 )
|
||||
return RL_Vector3Distance( self, v2 )
|
||||
return RL.Vector3Distance( self, v2 )
|
||||
end
|
||||
|
||||
function Vector3:distanceSqr( v2 )
|
||||
return RL_Vector3DistanceSqr( self, v2 )
|
||||
return RL.Vector3DistanceSqr( self, v2 )
|
||||
end
|
||||
|
||||
function Vector3:angle( v2 )
|
||||
return RL_Vector3Angle( self, v2 )
|
||||
return RL.Vector3Angle( self, v2 )
|
||||
end
|
||||
|
||||
function Vector3:negate()
|
||||
return Vector3:new( RL_Vector3Negate( self ) )
|
||||
return Vector3:new( RL.Vector3Negate( self ) )
|
||||
end
|
||||
|
||||
function Vector3:normalize()
|
||||
return Vector3:new( RL_Vector3Normalize( self ) )
|
||||
return Vector3:new( RL.Vector3Normalize( self ) )
|
||||
end
|
||||
|
||||
function Vector3:orthoNormalize( v2 )
|
||||
local r1, r2 = RL_Vector3OrthoNormalize( self, v2 )
|
||||
local r1, r2 = RL.Vector3OrthoNormalize( self, v2 )
|
||||
return Vector3:new( r1[1], r1[2], r1[3] ), Vector3:new( r2[1], r2[2], r2[3] )
|
||||
end
|
||||
|
||||
function Vector3:transform( mat )
|
||||
return Vector3:new( RL_Vector3Transform( self, mat ) )
|
||||
return Vector3:new( RL.Vector3Transform( self, mat ) )
|
||||
end
|
||||
|
||||
function Vector3:rotateByQuaternion( q )
|
||||
return Vector3:new( RL_Vector3RotateByQuaternion( self, q ) )
|
||||
return Vector3:new( RL.Vector3RotateByQuaternion( self, q ) )
|
||||
end
|
||||
|
||||
function Vector3:rotateByAxisAngle( axis, angle )
|
||||
return Vector3:new( RL_Vector3RotateByAxisAngle( self, axis, angle ) )
|
||||
return Vector3:new( RL.Vector3RotateByAxisAngle( self, axis, angle ) )
|
||||
end
|
||||
|
||||
function Vector3:lerp( v2, value )
|
||||
return Vector3:new( RL_Vector3Lerp( self, v2, value ) )
|
||||
return Vector3:new( RL.Vector3Lerp( self, v2, value ) )
|
||||
end
|
||||
|
||||
function Vector3:reflect( normal )
|
||||
return Vector3:new( RL_Vector3Reflect( self, normal ) )
|
||||
return Vector3:new( RL.Vector3Reflect( self, normal ) )
|
||||
end
|
||||
|
||||
function Vector3:invert()
|
||||
return Vector3:new( RL_Vector3Invert( self ) )
|
||||
return Vector3:new( RL.Vector3Invert( self ) )
|
||||
end
|
||||
|
||||
function Vector3:clamp( min, max )
|
||||
return Vector3:new( RL_Vector3Clamp( self, min, max ) )
|
||||
return Vector3:new( RL.Vector3Clamp( self, min, max ) )
|
||||
end
|
||||
|
||||
function Vector3:clampValue( min, max )
|
||||
return Vector3:new( RL_Vector3ClampValue( self, min, max ) )
|
||||
return Vector3:new( RL.Vector3ClampValue( self, min, max ) )
|
||||
end
|
||||
|
||||
function Vector3:equals( v2 )
|
||||
return RL_Vector3Equals( self, v2 )
|
||||
return RL.Vector3Equals( self, v2 )
|
||||
end
|
||||
|
||||
return Vector3
|
||||
|
||||
Reference in New Issue
Block a user