Added various missing functions.

This commit is contained in:
jussi
2024-02-25 14:06:59 +02:00
parent 631cea6aa7
commit 47ed28b006
21 changed files with 697 additions and 178 deletions

94
API.md
View File

@@ -4494,6 +4494,14 @@ Detect if a key has been pressed once
---
> pressed = RL.IsKeyPressedRepeat( int key )
Check if a key has been pressed again (Only PLATFORM_DESKTOP)
- Success return bool
---
> pressed = RL.IsKeyDown( int key )
Detect if a key is being pressed
@@ -4584,6 +4592,22 @@ Detect if a gamepad button has been released once
---
> notPressed = RL.IsGamepadButtonUp( int gamepad, int button )
Check if a gamepad button is NOT being pressed
- Success return bool
---
> button = RL.GetGamepadButtonPressed()
Get the last gamepad button pressed
- Success return int
---
> count = RL.GetGamepadAxisCount( int gamepad )
Return gamepad axis count for a gamepad
@@ -4680,12 +4704,20 @@ Set mouse scaling
> movement = RL.GetMouseWheelMove()
Returns mouse wheel movement Y
Get mouse wheel movement for X or Y, whichever is larger
- Success return float
---
> movement = RL.GetMouseWheelMoveV()
Get mouse wheel movement for both X and Y
- Success return Vector2
---
> RL.SetMouseCursor( int cursor )
Set mouse cursor
@@ -5705,7 +5737,15 @@ Create an image from another image piece
---
> image = RL.ImageText( Font font, string text, float fontSize, float spacing, Color tint )
> image = RL.ImageText( string text, int fontSize, Color tint )
Create an image from text (default font)
- Success return Image
---
> image = RL.ImageTextEx( Font font, string text, float fontSize, float spacing, Color tint )
Create an image from text (custom sprite font)
@@ -5977,6 +6017,12 @@ Draw a source image within a destination image (Tint applied to source)
---
> RL.ImageDrawText( Image dst, string text, Vector2 position, float fontSize, Color tint )
Draw text (using default font) within an image (destination)
---
> RL.ImageDrawTextEx( Image dst, Font font, string text, Vector2 position, float fontSize, float spacing, Color tint )
Draw text (Custom sprite font) within an image (Destination)
@@ -6150,6 +6196,12 @@ Draw a Texture2D
---
> RL.DrawTextureEx( Texture texture, Vector2 position, float rotation, float scale, Color tint )
Draw a Texture2D with extended parameters
---
> RL.DrawTextureRec( Texture texture, Rectangle source, Vector2 position, Color tint )
Draw a part of a texture defined by a rectangle
@@ -6476,7 +6528,15 @@ Set vertical line spacing when drawing with line-breaks
---
> size = RL.MeasureText( Font font, string text, float fontSize, float spacing )
> width = RL.MeasureText( string text, int fontSize )
Measure string width for default font
- Success return int
---
> size = RL.MeasureTextEx( Font font, string text, float fontSize, float spacing )
Measure string size for Font
@@ -6748,6 +6808,12 @@ Draw a color-filled triangle (Vertex in counter-clockwise order!)
---
> RL.DrawTriangleStrip3D( Vector3{} points, Color color )
Draw a triangle strip defined by points
---
> RL.DrawCube( Vector3 position, Vector3 size, Color color )
Draw cube
@@ -7146,6 +7212,14 @@ Generate sphere mesh (Standard sphere)
---
> mesh = RL.GenMeshHemiSphere( float radius, int rings, int slices )
Generate half-sphere mesh (no bottom cap)
- Success return Mesh
---
> mesh = RL.GenMeshCylinder( float radius, float height, int slices )
Generate cylinder mesh
@@ -7595,6 +7669,12 @@ Checks if a sound is ready
---
> RL.UpdateSound( Sound sound, Buffer data, int sampleCount )
Update sound buffer with new data
---
> RL.UnloadWave( Wave wave )
Unload wave data
@@ -7689,6 +7769,14 @@ Convert wave data to desired format
---
> samples = RL.LoadWaveSamples( Wave wave )
Load samples data from wave as a 32bit float data array
- Success return float{}
---
> wave = RL.WaveCopy( Wave wave )
Copy a wave to a new wave

View File

@@ -41,27 +41,34 @@ Example of basic "main.lua" file that will show basic windows with text.
```Lua
local textColor = RL.BLACK
local textPos = { 192, 200 }
local textSize = 20
local text = "Congrats! You created your first window!"
function RL.init()
RL.SetWindowTitle( "First window" )
RL.SetWindowState( RL.FLAG_VSYNC_HINT )
end
function RL.update( delta )
if RL.IsKeyPressed( RL.KEY_ENTER ) then
textColor = BLUE
textPos = { 230, 230 }
local winSize = RL.GetScreenSize()
textSize = RL.MeasureText( text, textSize )
textColor = RL.BLUE
textPos = { winSize[1] / 2 - textSize[1] / 2, winSize[2] / 2 - textSize[2] / 2 }
end
if RL.IsKeyPressed( RL.KEY_SPACE ) then
textColor = RL.BLACK
textColor = RL.RED
textPos = { 192, 200 }
end
end
function RL.draw()
RL.ClearBackground( RL.RAYWHITE )
RL.DrawText( RL.GetFontDefault(), "Congrats! You created your first window!", textPos, 20, 2, textColor )
RL.DrawText( text, textPos, textSize, textColor )
end
```
Application folder structure should be...

View File

@@ -1963,6 +1963,12 @@ function RL.DecodeDataBase64( data ) end
---@return any pressed
function RL.IsKeyPressed( key ) end
---Check if a key has been pressed again (Only PLATFORM_DESKTOP)
---- Success return bool
---@param key integer
---@return any pressed
function RL.IsKeyPressedRepeat( key ) end
---Detect if a key is being pressed
---- Success return bool
---@param key integer
@@ -2031,6 +2037,18 @@ function RL.IsGamepadButtonDown( gamepad, button ) end
---@return any released
function RL.IsGamepadButtonReleased( gamepad, button ) end
---Check if a gamepad button is NOT being pressed
---- Success return bool
---@param gamepad integer
---@param button integer
---@return any notPressed
function RL.IsGamepadButtonUp( gamepad, button ) end
---Get the last gamepad button pressed
---- Success return int
---@return any button
function RL.GetGamepadButtonPressed() end
---Return gamepad axis count for a gamepad
---- Success return int
---@param gamepad integer
@@ -2101,11 +2119,16 @@ function RL.SetMouseOffset( offset ) end
---@return any RL.SetMouseScale
function RL.SetMouseScale( scale ) end
---Returns mouse wheel movement Y
---Get mouse wheel movement for X or Y, whichever is larger
---- Success return float
---@return any movement
function RL.GetMouseWheelMove() end
---Get mouse wheel movement for both X and Y
---- Success return Vector2
---@return any movement
function RL.GetMouseWheelMoveV() end
---Set mouse cursor
---@param cursor integer
---@return any RL.SetMouseCursor
@@ -3106,6 +3129,14 @@ function RL.ImageCopy( image ) end
---@return any image
function RL.ImageFromImage( image, rec ) end
---Create an image from text (default font)
---- Success return Image
---@param text string
---@param fontSize integer
---@param tint table
---@return any image
function RL.ImageText( text, fontSize, tint ) end
---Create an image from text (custom sprite font)
---- Success return Image
---@param font any
@@ -3114,7 +3145,7 @@ function RL.ImageFromImage( image, rec ) end
---@param spacing number
---@param tint table
---@return any image
function RL.ImageText( font, text, fontSize, spacing, tint ) end
function RL.ImageTextEx( font, text, fontSize, spacing, tint ) end
---Convert image data to desired format
---@param image any
@@ -3372,6 +3403,15 @@ function RL.ImageDrawRectangleLines( dst, rec, thick, color ) end
---@return any RL.ImageDraw
function RL.ImageDraw( dst, src, srcRec, dstRec, tint ) end
---Draw text (using default font) within an image (destination)
---@param dst any
---@param text string
---@param position table
---@param fontSize number
---@param tint table
---@return any RL.ImageDrawText
function RL.ImageDrawText( dst, text, position, fontSize, tint ) end
---Draw text (Custom sprite font) within an image (Destination)
---@param dst any
---@param font any
@@ -3517,6 +3557,15 @@ function RL.GetTextureFormat( texture ) end
---@return any RL.DrawTexture
function RL.DrawTexture( texture, position, tint ) end
---Draw a Texture2D with extended parameters
---@param texture any
---@param position table
---@param rotation number
---@param scale number
---@param tint table
---@return any RL.DrawTextureEx
function RL.DrawTextureEx( texture, position, rotation, scale, tint ) end
---Draw a part of a texture defined by a rectangle
---@param texture any
---@param source table
@@ -3844,6 +3893,13 @@ function RL.DrawTextBoxedTinted( font, text, rec, fontSize, spacing, wordWrap, t
---@return any size
function RL.SetTextLineSpacing( spacing ) end
---Measure string width for default font
---- Success return int
---@param text string
---@param fontSize integer
---@return any width
function RL.MeasureText( text, fontSize ) end
---Measure string size for Font
---- Success return Vector2
---@param font any
@@ -3851,7 +3907,7 @@ function RL.SetTextLineSpacing( spacing ) end
---@param fontSize number
---@param spacing number
---@return any size
function RL.MeasureText( font, text, fontSize, spacing ) end
function RL.MeasureTextEx( font, text, fontSize, spacing ) end
---Get glyph index position in font for a codepoint (unicode character), fallback to '?' if not found
---- Success return int
@@ -4078,6 +4134,12 @@ function RL.DrawCircle3D( center, radius, rotationAxis, rotationAngle, color )
---@return any RL.DrawTriangle3D
function RL.DrawTriangle3D( v1, v2, v3, color ) end
---Draw a triangle strip defined by points
---@param points table
---@param color table
---@return any RL.DrawTriangleStrip3D
function RL.DrawTriangleStrip3D( points, color ) end
---Draw cube
---@param position table
---@param size table
@@ -4505,6 +4567,14 @@ function RL.GenMeshCube( size ) end
---@return any mesh
function RL.GenMeshSphere( radius, rings, slices ) end
---Generate half-sphere mesh (no bottom cap)
---- Success return Mesh
---@param radius number
---@param rings integer
---@param slices integer
---@return any mesh
function RL.GenMeshHemiSphere( radius, rings, slices ) end
---Generate cylinder mesh
---- Success return Mesh
---@param radius number
@@ -4894,6 +4964,13 @@ function RL.LoadSoundAlias( source ) end
---@return any isReady
function RL.IsSoundReady( sound ) end
---Update sound buffer with new data
---@param sound any
---@param data any
---@param sampleCount integer
---@return any RL.UpdateSound
function RL.UpdateSound( sound, data, sampleCount ) end
---Unload wave data
---@param wave any
---@return any RL.UnloadWave
@@ -4977,6 +5054,12 @@ function RL.SetSoundPan( sound, pan ) end
---@return any RL.WaveFormat
function RL.WaveFormat( wave, sampleRate, sampleSize, channels ) end
---Load samples data from wave as a 32bit float data array
---- Success return float{}
---@param wave any
---@return any samples
function RL.LoadWaveSamples( wave ) end
---Copy a wave to a new wave
---- Success return Wave
---@param wave any

View File

@@ -2,79 +2,69 @@ local raylib = {
prefix = "RLAPI",
file = "raylib.h",
blacklist = {
InitWindow = true, -- Handled internally.
WindowShouldClose = true, -- Handled internally.
GetScreenWidth = true, -- Replaced by GetScreenSize.
GetScreenHeight = true, -- Replaced by GetScreenSize.
GetRenderWidth = true, -- Replaced by GetRenderSize.
GetRenderHeight = true, -- Replaced by GetRenderSize.
GetMonitorWidth = true, -- Replaced by GetMonitorSize.
GetMonitorHeight = true, -- Replaced by GetMonitorSize.
GetMonitorPhysicalWidth = true, -- Replaced by GetMonitorPhysicalSize.
GetMonitorPhysicalHeight = true, -- Replaced by GetMonitorPhysicalSize.
UnloadRandomSequence = true, -- Handled internally.
MemAlloc = true, -- Buffer should be used instead.
MemRealloc = true, -- Buffer should be used instead.
MemFree = true, -- Buffer should be used instead.
SetTraceLogCallback = true, -- Handled internally.
SetLoadFileDataCallback = true, -- Not seen necessary.
SetSaveFileDataCallback = true, -- Not seen necessary.
SetLoadFileTextCallback = true, -- Not seen necessary.
SetSaveFileTextCallback = true, -- Not seen necessary.
UnloadFileData = true, -- Handled internally.
UnloadFileText = true, -- Handled internally.
UnloadDirectoryFiles = true, -- Handled internally.
UnloadDroppedFiles = true, -- Handled internally.
GetMouseX = true, -- Replaced by GetMousePosition.
GetMouseY = true, -- Replaced by GetMousePosition.
GetTouchX = true, -- Replaced by GetTouchPosition.
GetTouchY = true, -- Replaced by GetTouchPosition.
UpdateCamera = true, -- Replaced by UpdateCamera3D.
UpdateCameraPro = true, -- Replaced by UpdateCameraPro3D.
DrawPixelV = true, -- Replaced by DrawPixel.
DrawLineV = true, -- Replaced by DrawLine.
DrawCircleV = true, -- Replaced by DrawCircle.
DrawCircleLinesV = true, -- Replaced by DrawCircleLines.
DrawRectangleV = true, -- Replaced by DrawRectangle.
DrawRectangleRec = true, -- Replaced by DrawRectangle.
ImageTextEx = true, -- Replaced by ImageText.
UnloadImageColors = true, -- Handled internally.
UnloadImagePalette = true, -- Handled internally.
ImageDrawPixelV = true, -- Replaced by ImageDrawPixel.
ImageDrawLineV = true, -- Replaced by ImageDrawLine.
ImageDrawCircleV = true, -- Replaced by ImageDrawCircle.
ImageDrawCircleLinesV = true, -- Replaced by ImageDrawCircleLines.
ImageDrawRectangleV = true, -- Replaced by ImageDrawRectangle.
ImageDrawRectangleRec = true, -- Replaced by ImageDrawRectangle.
DrawTextureV = true, -- Replaced by DrawTexture.
UnloadFontData = true, -- Handled internally.
MeasureTextEx = true, -- Replaced by MeasureText.
UnloadUTF8 = true, -- Handled internally.
UnloadCodepoints = true, -- Handled internally.
TextCopy = true, -- Can be replaced by Lua equivalent.
TextIsEqual = true, -- Can be replaced by Lua equivalent.
TextLength = true, -- Can be replaced by Lua equivalent.
TextSubtext = true, -- Can be replaced by Lua equivalent.
TextJoin = true, -- Can be replaced by Lua equivalent.
TextAppend = true, -- Can be replaced by Lua equivalent.
TextToUpper = true, -- Can be replaced by Lua equivalent.
TextToLower = true, -- Can be replaced by Lua equivalent.
TextToInteger = true, -- Can be replaced by Lua equivalent.
DrawCubeV = true, -- Replaced by DrawCube.
DrawCubeWiresV = true, -- Replaced by DrawCubeWires.
UploadMesh = true, -- Handled internally.
UpdateMeshBuffer = true, -- Handled internally.
UnloadWaveSamples = true, -- Handled internally.
InitWindow = "Handled internally",
WindowShouldClose = "Handled internally",
GetScreenWidth = "Replaced by GetScreenSize",
GetScreenHeight = "Replaced by GetScreenSize",
GetRenderWidth = "Replaced by GetRenderSize",
GetRenderHeight = "Replaced by GetRenderSize",
GetMonitorWidth = "Replaced by GetMonitorSize",
GetMonitorHeight = "Replaced by GetMonitorSize",
GetMonitorPhysicalWidth = "Replaced by GetMonitorPhysicalSize",
GetMonitorPhysicalHeight = "Replaced by GetMonitorPhysicalSize",
UnloadRandomSequence = "Handled internally",
MemAlloc = "Buffer should be used instead",
MemRealloc = "Buffer should be used instead",
MemFree = "Buffer should be used instead",
SetTraceLogCallback = "Handled internally",
SetLoadFileDataCallback = "Not seen necessary",
SetSaveFileDataCallback = "Not seen necessary",
SetLoadFileTextCallback = "Not seen necessary",
SetSaveFileTextCallback = "Not seen necessary",
UnloadFileData = "Handled internally",
UnloadFileText = "Handled internally",
UnloadDirectoryFiles = "Handled internally",
UnloadDroppedFiles = "Handled internally",
GetMouseX = "Replaced by GetMousePosition",
GetMouseY = "Replaced by GetMousePosition",
GetTouchX = "Replaced by GetTouchPosition",
GetTouchY = "Replaced by GetTouchPosition",
UpdateCamera = "Replaced by UpdateCamera3D",
UpdateCameraPro = "Replaced by UpdateCameraPro3D",
DrawPixelV = "Replaced by DrawPixel",
DrawLineV = "Replaced by DrawLine",
DrawLineEx = "Replaced by DrawLine",
DrawCircleV = "Replaced by DrawCircle",
DrawCircleLinesV = "Replaced by DrawCircleLines",
DrawRectangleV = "Replaced by DrawRectangle",
DrawRectangleRec = "Replaced by DrawRectangle",
UnloadImageColors = "Handled internally",
UnloadImagePalette = "Handled internally",
ImageDrawPixelV = "Replaced by ImageDrawPixel",
ImageDrawLineV = "Replaced by ImageDrawLine",
ImageDrawCircleV = "Replaced by ImageDrawCircle",
ImageDrawCircleLinesV = "Replaced by ImageDrawCircleLines",
ImageDrawRectangleV = "Replaced by ImageDrawRectangle",
ImageDrawRectangleRec = "Replaced by ImageDrawRectangle",
DrawTextureV = "Replaced by DrawTexture",
UnloadFontData = "Handled internally",
UnloadUTF8 = "Handled internally",
UnloadCodepoints = "Handled internally",
TextCopy = "Can be replaced by Lua equivalent",
TextIsEqual = "Can be replaced by Lua equivalent",
TextLength = "Can be replaced by Lua equivalent",
TextJoin = "Can be replaced by Lua equivalent",
TextAppend = "Can be replaced by Lua equivalent",
TextToUpper = "Can be replaced by Lua equivalent",
TextToLower = "Can be replaced by Lua equivalent",
TextToInteger = "Can be replaced by Lua equivalent",
DrawCubeV = "Replaced by DrawCube",
DrawCubeWiresV = "Replaced by DrawCubeWires",
UploadMesh = "Handled internally",
UpdateMeshBuffer = "Handled internally",
UnloadWaveSamples = "Handled internally",
},
info = {
IsKeyPressedRepeat = "Will be added",
IsGamepadButtonUp = "Will be added",
GetGamepadButtonPressed = "Will be added",
GetMouseWheelMoveV = "Will be added",
DrawLineEx = "Will be added",
ImageDrawText = "Could be added",
DrawTextureEx = "Will be added",
DrawTriangleStrip3D = "Will be added",
GenMeshHemiSphere = "Will be added",
GenMeshCubicmap = "Will be added",
UpdateSound = "Will be added",
@@ -85,12 +75,12 @@ local rlgl = {
prefix = "RLAPI",
file = "rlgl.h",
blacklist = {
rlVertex2i = true, -- Most likely not needed.
rlglInit = true, -- Handled internally.
rlglClose = true, -- Handled internally.
rlLoadExtensions = true, -- Handled internally.
rlLoadDrawCube = true, -- Most likely not needed.
rlLoadDrawQuad = true, -- Most likely not needed.
rlVertex2i = "Most likely not needed",
rlglInit = "Handled internally",
rlglClose = "Handled internally",
rlLoadExtensions = "Handled internally",
rlLoadDrawCube = "Most likely not needed",
rlLoadDrawQuad = "Most likely not needed",
},
info = {
rlEnableStatePointer = "Available for GRAPHICS_API_OPENGL_11",
@@ -109,8 +99,8 @@ local raymath = {
prefix = "RMAPI",
file = "raymath.h",
blacklist = {
Vector3ToFloatV = true, -- Can be replaced by Lua equivalent.
MatrixToFloatV = true, -- Can be replaced by Lua equivalent.
Vector3ToFloatV = "Can be replaced by Lua equivalent",
MatrixToFloatV = "Can be replaced by Lua equivalent",
},
info = {
Vector3Project = "Will be added",
@@ -121,10 +111,10 @@ local easings = {
prefix = "EASEDEF",
file = "easings.h",
blacklist = {
EaseLinearNone = true, -- "Replaced by EaseLinear"
EaseLinearIn = true, -- "Replaced by EaseLinear"
EaseLinearOut = true, -- "Replaced by EaseLinear"
EaseLinearInOut = true, -- "Replaced by EaseLinear"
EaseLinearNone = "Replaced by EaseLinear",
EaseLinearIn = "Replaced by EaseLinear",
EaseLinearOut = "Replaced by EaseLinear",
EaseLinearInOut = "Replaced by EaseLinear",
},
info = {
},
@@ -139,7 +129,27 @@ local headers = {
easings,
}
if RL.arg[4] == "--help" then
print( "You can get blacklisted functions with argument '--blacklist'. Give additional argument to find specific function." )
return
end
for _, header in ipairs( headers ) do
if RL.arg[4] == "--blacklist" then
if RL.arg[5] == nil then
print( "\nFunctions blacklisted from '"..header.file.."':\n" )
for func, info in pairs( header.blacklist ) do
print( func.."\t\""..info.."\"" )
end
else
for func, info in pairs( header.blacklist ) do
if func:lower() == RL.arg[5]:lower() then
print( "\nFunction '"..func.."' blacklisted from '"..header.file.."'\t\""..info.."\"\n" )
end
end
end
else
local file = io.open( filePrefix..header.file, "r" )
if file ~= nil then
@@ -168,3 +178,4 @@ for _, header in ipairs( headers ) do
until line == nil
end
end
end

View File

@@ -7,6 +7,8 @@ KEY CHANGES:
- CHANGE: Process renamed to update to be more inline with naming of raylib and common convention.
- ADDED: Raygui lib tooltip.
- ADDED: apiScanner.lua for searching unimplemented functions from raylib.
- ADDED & CHANGE: ImageText. ImageTextEx is now equivalent to raylib function and old ImageText.
- ADDED & CHANGE: MeasureText. MeasureTextEx is now equivalent to raylib function and old MeasureText.
DETAILED CHANGES:
- ADDED: GetBufferElementSize and GetBufferLength.
@@ -18,6 +20,16 @@ DETAILED CHANGES:
- ADDED: rlEnableStatePointer and rlDisableStatePointer for GRAPHICS_API_OPENGL_11.
- ADDED: rlBlitFramebuffer and rlEnablePointMode.
- ADDED: Vector3Project and Vector3Reject.
- ADDED: IsKeyPressedRepeat, IsGamepadButtonUp, GetGamepadButtonPressed and GetMouseWheelMoveV.
- ADDED: ImageDrawText.
- ADDED: DrawTextureEx.
- ADDED: DrawTriangleStrip3D.
- ADDED: GenMeshHemiSphere.
- FIXED: GenMeshCubicmap was not assigned.
- ADDED: UpdateSound and LoadWaveSamples.
- ADDED: TextSubtext, TextReplace and TextToPascal.
- ADDED: Custom frame control functions.
- REMOVED: GetPixelColor. Deviates too much from raylib function.
------------------------------------------------------------------------
Release: ReiLua version 0.7.0 Using Raylib 5.0 and Forked Raygui 4.0
@@ -112,7 +124,7 @@ KEY CHANGES:
- ADDED: Global variable descriptions for API.
- CHANGED: Organized functions by putting them in the same order as in Raylib.
- ADDED: Matrix library.
- Removed: GC_UNLOAD build time define and replaced with flag to change it at runtime.
- REMOVED: GC_UNLOAD build time define and replaced with flag to change it at runtime.
- ADDED: Quaternion library.
- ADDED: Shader buffer storage object management (ssbo).
- ADDED: Rest of rlgl texture management functions.

View File

@@ -31,7 +31,7 @@ function RL.init()
RL.ImageDraw( image, catCopy, src, { 600, 200, src[3], src[4] }, RL.WHITE )
textImage = RL.ImageText( RL.GetFontDefault(), "Cat", 10, 4, RL.WHITE )
textImage = RL.ImageTextEx( RL.GetFontDefault(), "Cat", 10, 4, RL.WHITE )
local imageSize = RL.GetImageSize( textImage )
RL.ImageDraw( image, textImage, { 0, 0, imageSize[1], imageSize[2] }, { 250, 40, imageSize[1], imageSize[2] }, RL.WHITE )

View File

@@ -127,6 +127,6 @@ function RL.draw()
-- Draw score.
RL.DrawText( tostring( playerLeft.score ), { 50, 10 }, 40, RL.WHITE )
local rightTextSize = Vec2:new( RL.MeasureText( RL.GetFontDefault(), tostring( playerRight.score ), 40, 2 ) )
local rightTextSize = Vec2:new( RL.MeasureTextEx( RL.GetFontDefault(), tostring( playerRight.score ), 40, 2 ) )
RL.DrawText( tostring( playerRight.score ), { winSize.x - 50 - rightTextSize.x, 10 }, 40, RL.WHITE )
end

View File

@@ -243,7 +243,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.MeasureTextEx( self.font, self.text, self.fontSize, self.spacing ) )
self.bounds.width = textSize.x
self.bounds.height = textSize.y

View File

@@ -1852,7 +1852,7 @@ function Raygui:_addLastProperty( property )
end
function Raygui:drawTooltip()
local textSize = Vec2:new( RL.MeasureText(
local textSize = Vec2:new( RL.MeasureTextEx(
self.defaultFont,
self.tooltip.text,
RL.GuiGetStyle( RL.DEFAULT, RL.TEXT_SIZE ),

View File

@@ -1,5 +1,6 @@
local textColor = RL.BLACK
local textPos = { 192, 200 }
local textSize = 20
local text = "Congrats! You created your first window!"
function RL.init()
@@ -9,9 +10,9 @@ end
function RL.update( delta )
if RL.IsKeyPressed( RL.KEY_ENTER ) then
local textSize = RL.MeasureText( RL.GetFontDefault(), text, 20, 2 )
local winSize = RL.GetScreenSize()
textSize = RL.MeasureText( text, textSize )
textColor = RL.BLUE
textPos = { winSize[1] / 2 - textSize[1] / 2, winSize[2] / 2 - textSize[2] / 2 }
end
@@ -24,5 +25,5 @@ end
function RL.draw()
RL.ClearBackground( RL.RAYWHITE )
RL.DrawText( text, textPos, 20, textColor )
RL.DrawText( text, textPos, textSize, textColor )
end

View File

@@ -14,6 +14,7 @@ int laudioIsWaveReady( lua_State* L );
int laudioLoadSoundFromWave( lua_State* L );
int laudioLoadSoundAlias( lua_State* L );
int laudioIsSoundReady( lua_State* L );
int laudioUpdateSound( lua_State* L );
int laudioUnloadWave( lua_State* L );
int laudioUnloadSound( lua_State* L );
int laudioUnloadSoundAlias( lua_State* L );
@@ -29,6 +30,7 @@ int laudioSetSoundVolume( lua_State* L );
int laudioSetSoundPitch( lua_State* L );
int laudioSetSoundPan( lua_State* L );
int laudioWaveFormat( lua_State* L );
int laudioLoadWaveSamples( lua_State* L );
int laudioWaveCopy( lua_State* L );
int laudioWaveCrop( lua_State* L );
/* Music management functions. */

View File

@@ -91,9 +91,13 @@ int lcoreGetWorldToScreen2D( lua_State* L );
int lcoreGetScreenToWorld2D( lua_State* L );
/* Timing-related functions. */
int lcoreSetTargetFPS( lua_State* L );
int lcoreGetFPS( lua_State* L );
int lcoreGetFrameTime( lua_State* L );
int lcoreGetTime( lua_State* L );
int lcoreGetFPS( lua_State* L );
/* Custom frame control functions. */
int lcoreSwapScreenBuffer( lua_State* L );
int lcorePollInputEvents( lua_State* L );
int lcoreWaitTime( lua_State* L );
/* Random values generation functions. */
int lcoreSetRandomSeed( lua_State* L );
int lcoreGetRandomValue( lua_State* L );
@@ -141,6 +145,7 @@ int lcoreEncodeDataBase64( lua_State* L );
int lcoreDecodeDataBase64( lua_State* L );
/* Input-related functions: keyboard. */
int lcoreIsKeyPressed( lua_State* L );
int lcoreIsKeyPressedRepeat( lua_State* L );
int lcoreIsKeyDown( lua_State* L );
int lcoreIsKeyReleased( lua_State* L );
int lcoreIsKeyUp( lua_State* L );
@@ -155,6 +160,8 @@ int lcoreGetGamepadName( lua_State* L );
int lcoreIsGamepadButtonPressed( lua_State* L );
int lcoreIsGamepadButtonDown( lua_State* L );
int lcoreIsGamepadButtonReleased( lua_State* L );
int lcoreIsGamepadButtonUp( lua_State* L );
int lcoreGetGamepadButtonPressed( lua_State* L );
int lcoreGetGamepadAxisCount( lua_State* L );
int lcoreGetGamepadAxisMovement( lua_State* L );
int lcoreSetGamepadMappings( lua_State* L );
@@ -169,6 +176,7 @@ int lcoreSetMousePosition( lua_State* L );
int lcoreSetMouseOffset( lua_State* L );
int lcoreSetMouseScale( lua_State* L );
int lcoreGetMouseWheelMove( lua_State* L );
int lcoreGetMouseWheelMoveV( lua_State* L );
int lcoreSetMouseCursor( lua_State* L );
/* Input-related functions: touch. */
int lcoreGetTouchPosition( lua_State* L );

View File

@@ -11,6 +11,7 @@ int lmodelsDrawLine3D( lua_State* L );
int lmodelsDrawPoint3D( lua_State* L );
int lmodelsDrawCircle3D( lua_State* L );
int lmodelsDrawTriangle3D( lua_State* L );
int lmodelsDrawTriangleStrip3D( lua_State* L );
int lmodelsDrawCube( lua_State* L );
int lmodelsDrawCubeWires( lua_State* L );
int lmodelsDrawSphere( lua_State* L );
@@ -69,6 +70,7 @@ int lmodelsGenMeshPoly( lua_State* L );
int lmodelsGenMeshPlane( lua_State* L );
int lmodelsGenMeshCube( lua_State* L );
int lmodelsGenMeshSphere( lua_State* L );
int lmodelsGenMeshHemiSphere( lua_State* L );
int lmodelsGenMeshCylinder( lua_State* L );
int lmodelsGenMeshCone( lua_State* L );
int lmodelsGenMeshTorus( lua_State* L );

View File

@@ -25,6 +25,7 @@ int ltextDrawTextBoxedTinted( lua_State* L );
/* Text font info functions. */
int ltextSetTextLineSpacing( lua_State* L );
int ltextMeasureText( lua_State* L );
int ltextMeasureTextEx( lua_State* L );
int ltextGetGlyphIndex( lua_State* L );
int ltextGetGlyphInfo( lua_State* L );
int ltextGetGlyphInfoByIndex( lua_State* L );
@@ -54,6 +55,9 @@ int ltextGetCodepointNext( lua_State* L );
int ltextGetCodepointPrevious( lua_State* L );
int ltextCodepointToUTF8( lua_State* L );
/* Text strings management functions (no UTF-8 strings, only byte chars) */
int ltextTextSubtext( lua_State* L );
int ltextTextReplace( lua_State* L );
int ltextTextInsert( lua_State* L );
int ltextTextSplit( lua_State* L );
int ltextTextFindIndex( lua_State* L );
int ltextTextToPascal( lua_State* L );

View File

@@ -28,6 +28,7 @@ int ltexturesGenImageText( lua_State* L );
int ltexturesImageCopy( lua_State* L );
int ltexturesImageFromImage( lua_State* L );
int ltexturesImageText( lua_State* L );
int ltexturesImageTextEx( lua_State* L );
int ltexturesImageFormat( lua_State* L );
int ltexturesImageToPOT( lua_State* L );
int ltexturesImageCrop( lua_State* L );
@@ -70,6 +71,7 @@ int ltexturesImageDrawCircleLines( lua_State* L );
int ltexturesImageDrawRectangle( lua_State* L );
int ltexturesImageDrawRectangleLines( lua_State* L );
int ltexturesImageDraw( lua_State* L );
int ltexturesImageDrawText( lua_State* L );
int ltexturesImageDrawTextEx( lua_State* L );
/* Texture loading functions. */
int ltexturesGetTextureDefault( lua_State* L );
@@ -95,6 +97,7 @@ int ltexturesGetTextureMipmaps( lua_State* L );
int ltexturesGetTextureFormat( lua_State* L );
/* Texture drawing functions. */
int ltexturesDrawTexture( lua_State* L );
int ltexturesDrawTextureEx( lua_State* L );
int ltexturesDrawTextureRec( lua_State* L );
int ltexturesDrawTexturePro( lua_State* L );
int ltexturesDrawTextureNPatch( lua_State* L );
@@ -116,5 +119,4 @@ int ltexturesColorContrast( lua_State* L );
int ltexturesColorAlpha( lua_State* L );
int ltexturesColorAlphaBlend( lua_State* L );
int ltexturesGetColor( lua_State* L );
int ltexturesGetPixelColor( lua_State* L );
int ltexturesGetPixelDataSize( lua_State* L );

View File

@@ -188,6 +188,21 @@ int laudioIsSoundReady( lua_State* L ) {
return 1;
}
/*
> RL.UpdateSound( Sound sound, Buffer data, int sampleCount )
Update sound buffer with new data
*/
int laudioUpdateSound( lua_State* L ) {
Sound* sound = uluaGetSound( L, 1 );
Buffer* buffer = uluaGetBuffer( L, 2 );
int sampleCount = luaL_checkinteger( L, 3 );
UpdateSound( *sound, buffer->data, sampleCount );
return 0;
}
/*
> RL.UnloadWave( Wave wave )
@@ -386,6 +401,29 @@ int laudioWaveFormat( lua_State* L ) {
return 0;
}
/*
> samples = RL.LoadWaveSamples( Wave wave )
Load samples data from wave as a 32bit float data array
- Success return float{}
*/
int laudioLoadWaveSamples( lua_State* L ) {
Wave* wave = uluaGetWave( L, 1 );
float* samples = LoadWaveSamples( *wave );
lua_createtable( L, wave->frameCount * wave->channels, 0 );
for ( int i = 0; i < wave->frameCount * wave->channels; ++i ) {
lua_pushnumber( L, samples[i] );
lua_rawseti( L, -2, i+1 );
}
UnloadWaveSamples( samples );
return 1;
}
/*
> wave = RL.WaveCopy( Wave wave )

View File

@@ -1220,19 +1220,6 @@ int lcoreSetTargetFPS( lua_State* L ) {
return 0;
}
/*
> FPS = RL.GetFPS()
Get current FPS
- Success return int
*/
int lcoreGetFPS( lua_State* L ) {
lua_pushinteger( L, GetFPS() );
return 1;
}
/*
> delta = RL.GetFrameTime()
@@ -1259,6 +1246,58 @@ int lcoreGetTime( lua_State* L ) {
return 1;
}
/*
> FPS = RL.GetFPS()
Get current FPS
- Success return int
*/
int lcoreGetFPS( lua_State* L ) {
lua_pushinteger( L, GetFPS() );
return 1;
}
/*
## Core - Custom frame control functions
*/
/*
> RL.SwapScreenBuffer()
Swap back buffer with front buffer (screen drawing)
*/
int lcoreSwapScreenBuffer( lua_State* L ) {
SwapScreenBuffer();
return 0;
}
/*
> RL.PollInputEvents()
Register all input events
*/
int lcorePollInputEvents( lua_State* L ) {
PollInputEvents();
return 0;
}
/*
> RL.WaitTime( number seconds )
Wait for some time (halt program execution)
*/
int lcoreWaitTime( lua_State* L ) {
double seconds = luaL_checknumber( L, 1 );
WaitTime( seconds );
return 0;
}
/*
## Core - Random values generation functions
*/
@@ -1907,6 +1946,21 @@ int lcoreIsKeyPressed( lua_State* L ) {
return 1;
}
/*
> pressed = RL.IsKeyPressedRepeat( int key )
Check if a key has been pressed again (Only PLATFORM_DESKTOP)
- Success return bool
*/
int lcoreIsKeyPressedRepeat( lua_State* L ) {
int key = luaL_checkinteger( L, 1 );
lua_pushboolean( L, IsKeyPressedRepeat( key ) );
return 1;
}
/*
> pressed = RL.IsKeyDown( int key )
@@ -2073,6 +2127,35 @@ int lcoreIsGamepadButtonReleased( lua_State* L ) {
return 1;
}
/*
> notPressed = RL.IsGamepadButtonUp( int gamepad, int button )
Check if a gamepad button is NOT being pressed
- Success return bool
*/
int lcoreIsGamepadButtonUp( lua_State* L ) {
int gamepad = luaL_checkinteger( L, 1 );
int button = luaL_checkinteger( L, 2 );
lua_pushboolean( L, IsGamepadButtonUp( gamepad, button ) );
return 1;
}
/*
> button = RL.GetGamepadButtonPressed()
Get the last gamepad button pressed
- Success return int
*/
int lcoreGetGamepadButtonPressed( lua_State* L ) {
lua_pushinteger( L, GetGamepadButtonPressed() );
return 1;
}
/*
> count = RL.GetGamepadAxisCount( int gamepad )
@@ -2251,7 +2334,7 @@ int lcoreSetMouseScale( lua_State* L ) {
/*
> movement = RL.GetMouseWheelMove()
Returns mouse wheel movement Y
Get mouse wheel movement for X or Y, whichever is larger
- Success return float
*/
@@ -2261,6 +2344,19 @@ int lcoreGetMouseWheelMove( lua_State* L ) {
return 1;
}
/*
> movement = RL.GetMouseWheelMoveV()
Get mouse wheel movement for both X and Y
- Success return Vector2
*/
int lcoreGetMouseWheelMoveV( lua_State* L ) {
uluaPushVector2( L, GetMouseWheelMoveV() );
return 1;
}
/*
> RL.SetMouseCursor( int cursor )

View File

@@ -1285,9 +1285,13 @@ void luaRegister() {
assingGlobalFunction( "GetScreenToWorld2D", lcoreGetScreenToWorld2D );
/* Timing-related functions. */
assingGlobalFunction( "SetTargetFPS", lcoreSetTargetFPS );
assingGlobalFunction( "GetFPS", lcoreGetFPS );
assingGlobalFunction( "GetFrameTime", lcoreGetFrameTime );
assingGlobalFunction( "GetTime", lcoreGetTime );
assingGlobalFunction( "GetFPS", lcoreGetFPS );
/* Custom frame control functions. */
assingGlobalFunction( "SwapScreenBuffer", lcoreSwapScreenBuffer );
assingGlobalFunction( "PollInputEvents", lcorePollInputEvents );
assingGlobalFunction( "WaitTime", lcoreWaitTime );
/* Random values generation functions. */
assingGlobalFunction( "SetRandomSeed", lcoreSetRandomSeed );
assingGlobalFunction( "GetRandomValue", lcoreGetRandomValue );
@@ -1335,6 +1339,7 @@ void luaRegister() {
assingGlobalFunction( "DecodeDataBase64", lcoreDecodeDataBase64 );
/* Input-related functions: keyboard. */
assingGlobalFunction( "IsKeyPressed", lcoreIsKeyPressed );
assingGlobalFunction( "IsKeyPressedRepeat", lcoreIsKeyPressedRepeat );
assingGlobalFunction( "IsKeyDown", lcoreIsKeyDown );
assingGlobalFunction( "IsKeyReleased", lcoreIsKeyReleased );
assingGlobalFunction( "IsKeyUp", lcoreIsKeyUp );
@@ -1347,6 +1352,8 @@ void luaRegister() {
assingGlobalFunction( "IsGamepadButtonPressed", lcoreIsGamepadButtonPressed );
assingGlobalFunction( "IsGamepadButtonDown", lcoreIsGamepadButtonDown );
assingGlobalFunction( "IsGamepadButtonReleased", lcoreIsGamepadButtonReleased );
assingGlobalFunction( "IsGamepadButtonUp", lcoreIsGamepadButtonUp );
assingGlobalFunction( "GetGamepadButtonPressed", lcoreGetGamepadButtonPressed );
assingGlobalFunction( "GetGamepadAxisCount", lcoreGetGamepadAxisCount );
assingGlobalFunction( "GetGamepadAxisMovement", lcoreGetGamepadAxisMovement );
assingGlobalFunction( "SetGamepadMappings", lcoreSetGamepadMappings );
@@ -1361,6 +1368,7 @@ void luaRegister() {
assingGlobalFunction( "SetMouseOffset", lcoreSetMouseOffset );
assingGlobalFunction( "SetMouseScale", lcoreSetMouseScale );
assingGlobalFunction( "GetMouseWheelMove", lcoreGetMouseWheelMove );
assingGlobalFunction( "GetMouseWheelMoveV", lcoreGetMouseWheelMoveV );
assingGlobalFunction( "SetMouseCursor", lcoreSetMouseCursor );
/* Input-related functions: touch */
assingGlobalFunction( "GetTouchPosition", lcoreGetTouchPosition );
@@ -1513,6 +1521,7 @@ void luaRegister() {
assingGlobalFunction( "ImageCopy", ltexturesImageCopy );
assingGlobalFunction( "ImageFromImage", ltexturesImageFromImage );
assingGlobalFunction( "ImageText", ltexturesImageText );
assingGlobalFunction( "ImageTextEx", ltexturesImageTextEx );
assingGlobalFunction( "ImageFormat", ltexturesImageFormat );
assingGlobalFunction( "ImageToPOT", ltexturesImageToPOT );
assingGlobalFunction( "ImageCrop", ltexturesImageCrop );
@@ -1555,6 +1564,7 @@ void luaRegister() {
assingGlobalFunction( "ImageDrawRectangle", ltexturesImageDrawRectangle );
assingGlobalFunction( "ImageDrawRectangleLines", ltexturesImageDrawRectangleLines );
assingGlobalFunction( "ImageDraw", ltexturesImageDraw );
assingGlobalFunction( "ImageDrawText", ltexturesImageDrawText );
assingGlobalFunction( "ImageDrawTextEx", ltexturesImageDrawTextEx );
/* Texture loading functions. */
assingGlobalFunction( "GetTextureDefault", ltexturesGetTextureDefault );
@@ -1580,6 +1590,7 @@ void luaRegister() {
assingGlobalFunction( "GetTextureFormat", ltexturesGetTextureFormat );
/* Texture drawing functions. */
assingGlobalFunction( "DrawTexture", ltexturesDrawTexture );
assingGlobalFunction( "DrawTextureEx", ltexturesDrawTextureEx );
assingGlobalFunction( "DrawTextureRec", ltexturesDrawTextureRec );
assingGlobalFunction( "DrawTexturePro", ltexturesDrawTexturePro );
assingGlobalFunction( "DrawTextureNPatch", ltexturesDrawTextureNPatch );
@@ -1601,7 +1612,6 @@ void luaRegister() {
assingGlobalFunction( "ColorAlpha", ltexturesColorAlpha );
assingGlobalFunction( "ColorAlphaBlend", ltexturesColorAlphaBlend );
assingGlobalFunction( "GetColor", ltexturesGetColor );
assingGlobalFunction( "GetPixelColor", ltexturesGetPixelColor );
assingGlobalFunction( "GetPixelDataSize", ltexturesGetPixelDataSize );
/* Models. */
@@ -1610,6 +1620,7 @@ void luaRegister() {
assingGlobalFunction( "DrawPoint3D", lmodelsDrawPoint3D );
assingGlobalFunction( "DrawCircle3D", lmodelsDrawCircle3D );
assingGlobalFunction( "DrawTriangle3D", lmodelsDrawTriangle3D );
assingGlobalFunction( "DrawTriangleStrip3D", lmodelsDrawTriangleStrip3D );
assingGlobalFunction( "DrawCube", lmodelsDrawCube );
assingGlobalFunction( "DrawCubeWires", lmodelsDrawCubeWires );
assingGlobalFunction( "DrawSphere", lmodelsDrawSphere );
@@ -1668,11 +1679,13 @@ void luaRegister() {
assingGlobalFunction( "GenMeshPlane", lmodelsGenMeshPlane );
assingGlobalFunction( "GenMeshCube", lmodelsGenMeshCube );
assingGlobalFunction( "GenMeshSphere", lmodelsGenMeshSphere );
assingGlobalFunction( "GenMeshHemiSphere", lmodelsGenMeshHemiSphere );
assingGlobalFunction( "GenMeshCylinder", lmodelsGenMeshCylinder );
assingGlobalFunction( "GenMeshCone", lmodelsGenMeshCone );
assingGlobalFunction( "GenMeshTorus", lmodelsGenMeshTorus );
assingGlobalFunction( "GenMeshKnot", lmodelsGenMeshKnot );
assingGlobalFunction( "GenMeshHeightmap", lmodelsGenMeshHeightmap );
assingGlobalFunction( "GenMeshCubicmap", lmodelsGenMeshCubicmap );
assingGlobalFunction( "GenMeshCustom", lmodelsGenMeshCustom );
/* Material management functions. */
assingGlobalFunction( "LoadMaterials", lmodelsLoadMaterials );
@@ -1740,6 +1753,7 @@ void luaRegister() {
/* Text font info functions. */
assingGlobalFunction( "SetTextLineSpacing", ltextSetTextLineSpacing );
assingGlobalFunction( "MeasureText", ltextMeasureText );
assingGlobalFunction( "MeasureTextEx", ltextMeasureTextEx );
assingGlobalFunction( "GetGlyphIndex", ltextGetGlyphIndex );
assingGlobalFunction( "GetGlyphInfo", ltextGetGlyphInfo );
assingGlobalFunction( "GetGlyphInfoByIndex", ltextGetGlyphInfoByIndex );
@@ -1769,9 +1783,12 @@ void luaRegister() {
assingGlobalFunction( "GetCodepointPrevious", ltextGetCodepointPrevious );
assingGlobalFunction( "CodepointToUTF8", ltextCodepointToUTF8 );
/* Text strings management functions (no UTF-8 strings, only byte chars) */
assingGlobalFunction( "TextSubtext", ltextTextSubtext );
assingGlobalFunction( "TextReplace", ltextTextReplace );
assingGlobalFunction( "TextInsert", ltextTextInsert );
assingGlobalFunction( "TextSplit", ltextTextSplit );
assingGlobalFunction( "TextFindIndex", ltextTextFindIndex );
assingGlobalFunction( "TextToPascal", ltextTextToPascal );
/* Audio. */
/* Audio device management functions. */
@@ -1788,6 +1805,7 @@ void luaRegister() {
assingGlobalFunction( "LoadSoundFromWave", laudioLoadSoundFromWave );
assingGlobalFunction( "LoadSoundAlias", laudioLoadSoundAlias );
assingGlobalFunction( "IsSoundReady", laudioIsSoundReady );
assingGlobalFunction( "UpdateSound", laudioUpdateSound );
assingGlobalFunction( "UnloadWave", laudioUnloadWave );
assingGlobalFunction( "UnloadSound", laudioUnloadSound );
assingGlobalFunction( "UnloadSoundAlias", laudioUnloadSoundAlias );
@@ -1803,6 +1821,7 @@ void luaRegister() {
assingGlobalFunction( "SetSoundPitch", laudioSetSoundPitch );
assingGlobalFunction( "SetSoundPan", laudioSetSoundPan );
assingGlobalFunction( "WaveFormat", laudioWaveFormat );
assingGlobalFunction( "LoadWaveSamples", laudioLoadWaveSamples );
assingGlobalFunction( "WaveCopy", laudioWaveCopy );
assingGlobalFunction( "WaveCrop", laudioWaveCrop );
/* Music management functions. */

View File

@@ -172,6 +172,32 @@ int lmodelsDrawTriangle3D( lua_State* L ) {
return 0;
}
/*
> RL.DrawTriangleStrip3D( Vector3{} points, Color color )
Draw a triangle strip defined by points
*/
int lmodelsDrawTriangleStrip3D( lua_State* L ) {
int pointCount = uluaGetTableLen( L, 1 );
Color color = uluaGetColor( L, 2 );
Vector3 points[ pointCount ];
int t = 1, i = 0;
lua_pushnil( L );
while ( lua_next( L, t ) != 0 ) {
if ( lua_istable( L, -1 ) ) {
points[i] = uluaGetVector3( L, lua_gettop( L ) );
}
i++;
lua_pop( L, 1 );
}
DrawTriangleStrip3D( points, pointCount, color );
return 0;
}
/*
> RL.DrawCube( Vector3 position, Vector3 size, Color color )
@@ -1304,6 +1330,23 @@ int lmodelsGenMeshSphere( lua_State* L ) {
return 1;
}
/*
> mesh = RL.GenMeshHemiSphere( float radius, int rings, int slices )
Generate half-sphere mesh (no bottom cap)
- Success return Mesh
*/
int lmodelsGenMeshHemiSphere( lua_State* L ) {
float radius = luaL_checknumber( L, 1 );
int rings = luaL_checkinteger( L, 2 );
int slices = luaL_checkinteger( L, 3 );
uluaPushMesh( L, GenMeshHemiSphere( radius, rings, slices ) );
return 1;
}
/*
> mesh = RL.GenMeshCylinder( float radius, float height, int slices )

View File

@@ -663,18 +663,35 @@ int ltextSetTextLineSpacing( lua_State* L ) {
}
/*
> size = RL.MeasureText( Font font, string text, float fontSize, float spacing )
> width = RL.MeasureText( string text, int fontSize )
Measure string width for default font
- Success return int
*/
int ltextMeasureText( lua_State* L ) {
const char* text = luaL_checkstring( L, 1 );
int fontSize = luaL_checkinteger( L, 2 );
lua_pushinteger( L, MeasureText( text, fontSize ) );
return 1;
}
/*
> size = RL.MeasureTextEx( Font font, string text, float fontSize, float spacing )
Measure string size for Font
- Success return Vector2
*/
int ltextMeasureText( lua_State* L ) {
int ltextMeasureTextEx( lua_State* L ) {
Font* font = uluaGetFont( L, 1 );
const char* text = luaL_checkstring( L, 2 );
float fontSize = luaL_checknumber( L, 3 );
float spacing = luaL_checknumber( L, 4 );
uluaPushVector2( L, MeasureTextEx( *font, luaL_checkstring( L, 2 ), fontSize, spacing ) );
uluaPushVector2( L, MeasureTextEx( *font, text, fontSize, spacing ) );
return 1;
}
@@ -1143,6 +1160,43 @@ int ltextCodepointToUTF8( lua_State* L ) {
## Text - Text strings management functions (no UTF-8 strings, only byte chars)
*/
/*
> text = RL.TextSubtext( string text, int position, int length )
Get a piece of a text string
- Success return string
*/
int ltextTextSubtext( lua_State* L ) {
const char* text = luaL_checkstring( L, 1 );
int position = luaL_checkinteger( L, 2 );
int length = luaL_checkinteger( L, 3 );
lua_pushstring( L, TextSubtext( text, position, length ) );
return 1;
}
/*
> text = RL.TextReplace( string text, string replace, string by )
Replace text string
- Success return string
*/
int ltextTextReplace( lua_State* L ) {
char* text = (char*)luaL_checkstring( L, 1 );
const char* replace = luaL_checkstring( L, 2 );
const char* by = luaL_checkstring( L, 3 );
char* result = TextReplace( text, replace, by );
lua_pushstring( L, result );
free( result );
return 1;
}
/*
> text = RL.TextInsert( string text, string insert, int position )
@@ -1213,3 +1267,18 @@ int ltextTextFindIndex( lua_State* L ) {
return 1;
}
/*
> text = RL.TextToPascal( string text )
Get Pascal case notation version of provided string
- Success return string
*/
int ltextTextToPascal( lua_State* L ) {
const char* text = luaL_checkstring( L, 1 );
lua_pushstring( L, TextToPascal( text ) );
return 1;
}

View File

@@ -433,19 +433,37 @@ int ltexturesImageFromImage( lua_State* L ) {
}
/*
> image = RL.ImageText( Font font, string text, float fontSize, float spacing, Color tint )
> image = RL.ImageText( string text, int fontSize, Color tint )
Create an image from text (default font)
- Success return Image
*/
int ltexturesImageText( lua_State* L ) {
const char* text = luaL_checkstring( L, 1 );
int fontSize = luaL_checkinteger( L, 2 );
Color tint = uluaGetColor( L, 3 );
uluaPushImage( L, ImageText( text, fontSize, tint ) );
return 1;
}
/*
> image = RL.ImageTextEx( Font font, string text, float fontSize, float spacing, Color tint )
Create an image from text (custom sprite font)
- Success return Image
*/
int ltexturesImageText( lua_State* L ) {
int ltexturesImageTextEx( lua_State* L ) {
Font* font = uluaGetFont( L, 1 );
float fontSize = lua_tonumber( L, 3 );
float spacing = lua_tonumber( L, 4 );
const char* text = luaL_checkstring( L, 2 );
float fontSize = luaL_checknumber( L, 3 );
float spacing = luaL_checknumber( L, 4 );
Color tint = uluaGetColor( L, 5 );
uluaPushImage( L, ImageTextEx( *font, luaL_checkstring( L, 2 ), fontSize, spacing, tint ) );
uluaPushImage( L, ImageTextEx( *font, text, fontSize, spacing, tint ) );
return 1;
}
@@ -499,7 +517,7 @@ Crop image depending on alpha value
*/
int ltexturesImageAlphaCrop( lua_State* L ) {
Image* image = uluaGetImage( L, 1 );
float threshold = lua_tonumber( L, 2 );
float threshold = luaL_checknumber( L, 2 );
ImageAlphaCrop( image, threshold );
@@ -514,7 +532,7 @@ Clear alpha channel to desired color
int ltexturesImageAlphaClear( lua_State* L ) {
Image* image = uluaGetImage( L, 1 );
Color color = uluaGetColor( L, 2 );
float threshold = lua_tonumber( L, 3 );
float threshold = luaL_checknumber( L, 3 );
ImageAlphaClear( image, color, threshold );
@@ -1063,6 +1081,23 @@ int ltexturesImageDraw( lua_State* L ) {
return 0;
}
/*
> RL.ImageDrawText( Image dst, string text, Vector2 position, float fontSize, Color tint )
Draw text (using default font) within an image (destination)
*/
int ltexturesImageDrawText( lua_State* L ) {
Image* image = uluaGetImage( L, 1 );
const char* text = luaL_checkstring( L, 2 );
Vector2 position = uluaGetVector2( L, 3 );
float fontSize = luaL_checknumber( L, 4 );
Color tint = uluaGetColor( L, 5 );
ImageDrawText( image, text, position.x, position.y, fontSize, tint );
return 0;
}
/*
> RL.ImageDrawTextEx( Image dst, Font font, string text, Vector2 position, float fontSize, float spacing, Color tint )
@@ -1071,12 +1106,13 @@ Draw text (Custom sprite font) within an image (Destination)
int ltexturesImageDrawTextEx( lua_State* L ) {
Image* image = uluaGetImage( L, 1 );
Font* font = uluaGetFont( L, 2 );
const char* text = luaL_checkstring( L, 3 );
Vector2 position = uluaGetVector2( L, 4 );
float fontSize = luaL_checknumber( L, 5 );
float spacing = luaL_checknumber( L, 6 );
Color tint = uluaGetColor( L, 7 );
ImageDrawTextEx( image, *font, luaL_checkstring( L, 3 ), position, fontSize, spacing, tint );
ImageDrawTextEx( image, *font, text, position, fontSize, spacing, tint );
return 0;
}
@@ -1487,10 +1523,26 @@ Draw a Texture2D
*/
int ltexturesDrawTexture( lua_State* L ) {
Texture* texture = uluaGetTexture( L, 1 );
Vector2 pos = uluaGetVector2( L, 2 );
Vector2 position = uluaGetVector2( L, 2 );
Color color = uluaGetColor( L, 3 );
DrawTexture( *texture, pos.x, pos.y, color );
DrawTexture( *texture, position.x, position.y, color );
return 0;
}
/*
> RL.DrawTextureEx( Texture texture, Vector2 position, float rotation, float scale, Color tint )
Draw a Texture2D with extended parameters
*/
int ltexturesDrawTextureEx( lua_State* L ) {
Texture* texture = uluaGetTexture( L, 1 );
Vector2 position = uluaGetVector2( L, 2 );
float rotation = luaL_checknumber( L, 3 );
float scale = luaL_checknumber( L, 4 );
Color color = uluaGetColor( L, 5 );
DrawTextureEx( *texture, position, rotation, scale, color );
return 0;
}
@@ -1502,10 +1554,10 @@ Draw a part of a texture defined by a rectangle
int ltexturesDrawTextureRec( lua_State* L ) {
Texture* texture = uluaGetTexture( L, 1 );
Rectangle srcRect = uluaGetRectangle( L, 2 );
Vector2 pos = uluaGetVector2( L, 3 );
Vector2 position = uluaGetVector2( L, 3 );
Color tint = uluaGetColor( L, 4 );
DrawTextureRec( *texture, srcRect, pos, tint );
DrawTextureRec( *texture, srcRect, position, tint );
return 0;
}
@@ -1519,10 +1571,10 @@ int ltexturesDrawTexturePro( lua_State* L ) {
Rectangle srcRect = uluaGetRectangle( L, 2 );
Rectangle dstRect = uluaGetRectangle( L, 3 );
Vector2 origin = uluaGetVector2( L, 4 );
float rot = luaL_checknumber( L, 5 );
float rotation = luaL_checknumber( L, 5 );
Color color = uluaGetColor( L, 6 );
DrawTexturePro( *texture, srcRect, dstRect, origin, rot, color );
DrawTexturePro( *texture, srcRect, dstRect, origin, rotation, color );
return 0;
}
@@ -2005,24 +2057,6 @@ int ltexturesGetColor( lua_State* L ) {
return 1;
}
/*
> color = RL.GetPixelColor( Texture texture, Vector2 position )
Get pixel color from source texture
- Success return Color
*/
int ltexturesGetPixelColor( lua_State* L ) {
Texture* texture = uluaGetTexture( L, 1 );
Vector2 pos = uluaGetVector2( L, 2 );
Image srcImage = LoadImageFromTexture( *texture );
uluaPushColor( L, GetImageColor( srcImage, pos.x, pos.y ) );
UnloadImage( srcImage );
return 1;
}
/*
> size = RL.GetPixelDataSize( int width, int height, int format )