Api Scanner.

This commit is contained in:
jussi
2024-02-24 17:27:34 +02:00
parent 04d2a7df47
commit 9f1bec39f9
8 changed files with 210 additions and 3 deletions

8
API.md
View File

@@ -6712,6 +6712,14 @@ Split text into multiple strings
--- ---
> index = RL.TextFindIndex( string text, string find )
Find first text occurrence within a string
- Success return int
---
## Models - Basic geometric 3D shapes drawing functions ## Models - Basic geometric 3D shapes drawing functions
--- ---

View File

@@ -4039,6 +4039,13 @@ function RL.TextInsert( text, insert, position ) end
---@return any splits ---@return any splits
function RL.TextSplit( text, delimiter ) end function RL.TextSplit( text, delimiter ) end
---Find first text occurrence within a string
---- Success return int
---@param text string
---@param find string
---@return any index
function RL.TextFindIndex( text, find ) end
-- Models - Basic geometric 3D shapes drawing functions -- Models - Basic geometric 3D shapes drawing functions
---Draw a line in 3D world space ---Draw a line in 3D world space

172
apiScanner.lua Normal file
View File

@@ -0,0 +1,172 @@
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.
},
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",
LoadWaveSamples = "Will be added",
}
}
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.
},
info = {
rlBlitFramebuffer = "Will be added",
rlEnablePointMode = "Will be added",
rlEnableStatePointer = "Should probably be added for GRAPHICS_API_OPENGL_11",
rlDisableStatePointer = "Should probably be added for GRAPHICS_API_OPENGL_11",
},
}
local raygui = {
prefix = "RAYGUIAPI",
file = "raygui.h",
blacklist = {
},
info = {
},
}
local raymath = {
prefix = "RMAPI",
file = "raymath.h",
blacklist = {
Vector3ToFloatV = true, -- Can be replaced by Lua equivalent.
MatrixToFloatV = true, -- Can be replaced by Lua equivalent.
},
info = {
Vector3Project = "Will be added",
Vector3Reject = "Will be added",
},
}
local easings = {
prefix = "EASEDEF",
file = "easings.h",
blacklist = {
},
info = {
EaseLinearNone = "Will be added",
EaseLinearIn = "Will be added",
EaseLinearOut = "Will be added",
EaseLinearInOut = "Will be added",
},
}
local filePrefix = "../include/"
local headers = {
raylib,
rlgl,
raygui,
raymath,
easings,
}
for _, header in ipairs( headers ) do
local file = io.open( filePrefix..header.file, "r" )
if file ~= nil then
local line = ""
print( "\nFunctions not implemented from '"..header.file.."':\n" )
repeat
line = file:read( "*l" )
if line ~= nil and line:sub( 1, #header.prefix ) == header.prefix then
local splits = RL.TextSplit( line:sub( 1, RL.TextFindIndex( line, "(" ) ), " " )
local func = splits[ #splits ]
func = func:gsub( "*", "" )
if RL[ func ] == nil and not header.blacklist[ func ] then
local output = func
if header.info[ func ] ~= nil then
output = output.."\t\""..header.info[ func ].."\""
end
print( output )
end
end
until line == nil
end
end

View File

@@ -6,12 +6,15 @@ KEY CHANGES:
- ADDED: LoadImageFromData. - ADDED: LoadImageFromData.
- CHANGE: Process renamed to update to be more inline with naming of raylib and common convention. - CHANGE: Process renamed to update to be more inline with naming of raylib and common convention.
- ADDED: Raygui lib tooltip. - ADDED: Raygui lib tooltip.
- ADDED: apiScanner.lua for searching unimplemented functions from raylib.
DETAILED CHANGES: DETAILED CHANGES:
- ADDED: GetBufferElementSize and GetBufferLength. - ADDED: GetBufferElementSize and GetBufferLength.
- FIXED: Compress_data example. - FIXED: Compress_data example.
- FIXED: GuiGetFont return lightuserdata. - FIXED: GuiGetFont return lightuserdata.
- FIXED: GuiSetStyle, GuiLoadStyle and GuiLoadStyleDefault sets state->guiDefaultFont to GuiGetFont. - FIXED: GuiSetStyle, GuiLoadStyle and GuiLoadStyleDefault sets state->guiDefaultFont to GuiGetFont.
- ADDED: TextFindIndex.
- FIXED: SeekMusicStream was not assigned.
------------------------------------------------------------------------ ------------------------------------------------------------------------
Release: ReiLua version 0.7.0 Using Raylib 5.0 and Forked Raygui 4.0 Release: ReiLua version 0.7.0 Using Raylib 5.0 and Forked Raygui 4.0

View File

@@ -2,9 +2,6 @@ Current {
} }
Backlog { Backlog {
* Godot scene importer lib.
* Script to find unimplemented raylib functions. Should have list for fuctions that will not
get implemented.
* Raygui lib * Raygui lib
* Check if could remove flickering from changing draw order by making queue for order changing and only * Check if could remove flickering from changing draw order by making queue for order changing and only
change them after everything is drawn. change them after everything is drawn.
@@ -22,6 +19,7 @@ Backlog {
* Improve Dungeon crawler example by generating custom mesh instead of drawing 3D quads. * Improve Dungeon crawler example by generating custom mesh instead of drawing 3D quads.
* Platformer example physics update for true framerate independence. * Platformer example physics update for true framerate independence.
* Android support * Android support
* Godot scene importer lib.
* Git submodules for raylib and lua. Should maybe find windows compatible lua repo for this. * Git submodules for raylib and lua. Should maybe find windows compatible lua repo for this.
} }

View File

@@ -56,3 +56,4 @@ int ltextCodepointToUTF8( lua_State* L );
/* Text strings management functions (no UTF-8 strings, only byte chars) */ /* Text strings management functions (no UTF-8 strings, only byte chars) */
int ltextTextInsert( lua_State* L ); int ltextTextInsert( lua_State* L );
int ltextTextSplit( lua_State* L ); int ltextTextSplit( lua_State* L );
int ltextTextFindIndex( lua_State* L );

View File

@@ -1771,6 +1771,7 @@ void luaRegister() {
/* Text strings management functions (no UTF-8 strings, only byte chars) */ /* Text strings management functions (no UTF-8 strings, only byte chars) */
assingGlobalFunction( "TextInsert", ltextTextInsert ); assingGlobalFunction( "TextInsert", ltextTextInsert );
assingGlobalFunction( "TextSplit", ltextTextSplit ); assingGlobalFunction( "TextSplit", ltextTextSplit );
assingGlobalFunction( "TextFindIndex", ltextTextFindIndex );
/* Audio. */ /* Audio. */
/* Audio device management functions. */ /* Audio device management functions. */
@@ -1815,6 +1816,7 @@ void luaRegister() {
assingGlobalFunction( "StopMusicStream", laudioStopMusicStream ); assingGlobalFunction( "StopMusicStream", laudioStopMusicStream );
assingGlobalFunction( "PauseMusicStream", laudioPauseMusicStream ); assingGlobalFunction( "PauseMusicStream", laudioPauseMusicStream );
assingGlobalFunction( "ResumeMusicStream", laudioResumeMusicStream ); assingGlobalFunction( "ResumeMusicStream", laudioResumeMusicStream );
assingGlobalFunction( "SeekMusicStream", laudioSeekMusicStream );
assingGlobalFunction( "SetMusicVolume", laudioSetMusicVolume ); assingGlobalFunction( "SetMusicVolume", laudioSetMusicVolume );
assingGlobalFunction( "SetMusicPitch", laudioSetMusicPitch ); assingGlobalFunction( "SetMusicPitch", laudioSetMusicPitch );
assingGlobalFunction( "SetMusicPan", laudioSetMusicPan ); assingGlobalFunction( "SetMusicPan", laudioSetMusicPan );

View File

@@ -1197,3 +1197,19 @@ int ltextTextSplit( lua_State* L ) {
return 1; return 1;
} }
/*
> index = RL.TextFindIndex( string text, string find )
Find first text occurrence within a string
- Success return int
*/
int ltextTextFindIndex( lua_State* L ) {
const char* text = luaL_checkstring( L, 1 );
const char* find = luaL_checkstring( L, 2 );
lua_pushinteger( L, TextFindIndex( text, find ) );
return 1;
}