diff options
| -rw-r--r-- | API.md | 8 | ||||
| -rw-r--r-- | ReiLua_API.lua | 7 | ||||
| -rw-r--r-- | apiScanner.lua | 172 | ||||
| -rw-r--r-- | changelog | 3 | ||||
| -rw-r--r-- | devnotes | 4 | ||||
| -rw-r--r-- | include/text.h | 1 | ||||
| -rw-r--r-- | src/lua_core.c | 2 | ||||
| -rw-r--r-- | src/text.c | 16 |
8 files changed, 210 insertions, 3 deletions
@@ -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 --- diff --git a/ReiLua_API.lua b/ReiLua_API.lua index 0b6f9b5..12d7b72 100644 --- a/ReiLua_API.lua +++ b/ReiLua_API.lua @@ -4039,6 +4039,13 @@ function RL.TextInsert( text, insert, position ) end ---@return any splits 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 ---Draw a line in 3D world space diff --git a/apiScanner.lua b/apiScanner.lua new file mode 100644 index 0000000..709e766 --- /dev/null +++ b/apiScanner.lua @@ -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 @@ -6,12 +6,15 @@ KEY CHANGES: - ADDED: LoadImageFromData. - 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. DETAILED CHANGES: - ADDED: GetBufferElementSize and GetBufferLength. - FIXED: Compress_data example. - FIXED: GuiGetFont return lightuserdata. - 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 @@ -2,9 +2,6 @@ Current { } Backlog { - * Godot scene importer lib. - * Script to find unimplemented raylib functions. Should have list for fuctions that will not - get implemented. * Raygui lib * Check if could remove flickering from changing draw order by making queue for order changing and only change them after everything is drawn. @@ -22,6 +19,7 @@ Backlog { * Improve Dungeon crawler example by generating custom mesh instead of drawing 3D quads. * Platformer example physics update for true framerate independence. * Android support + * Godot scene importer lib. * Git submodules for raylib and lua. Should maybe find windows compatible lua repo for this. } diff --git a/include/text.h b/include/text.h index b1cc549..b921e9c 100644 --- a/include/text.h +++ b/include/text.h @@ -56,3 +56,4 @@ int ltextCodepointToUTF8( lua_State* L ); /* Text strings management functions (no UTF-8 strings, only byte chars) */ int ltextTextInsert( lua_State* L ); int ltextTextSplit( lua_State* L ); +int ltextTextFindIndex( lua_State* L ); diff --git a/src/lua_core.c b/src/lua_core.c index 1fb4969..fffce5a 100644 --- a/src/lua_core.c +++ b/src/lua_core.c @@ -1771,6 +1771,7 @@ void luaRegister() { /* Text strings management functions (no UTF-8 strings, only byte chars) */ assingGlobalFunction( "TextInsert", ltextTextInsert ); assingGlobalFunction( "TextSplit", ltextTextSplit ); + assingGlobalFunction( "TextFindIndex", ltextTextFindIndex ); /* Audio. */ /* Audio device management functions. */ @@ -1815,6 +1816,7 @@ void luaRegister() { assingGlobalFunction( "StopMusicStream", laudioStopMusicStream ); assingGlobalFunction( "PauseMusicStream", laudioPauseMusicStream ); assingGlobalFunction( "ResumeMusicStream", laudioResumeMusicStream ); + assingGlobalFunction( "SeekMusicStream", laudioSeekMusicStream ); assingGlobalFunction( "SetMusicVolume", laudioSetMusicVolume ); assingGlobalFunction( "SetMusicPitch", laudioSetMusicPitch ); assingGlobalFunction( "SetMusicPan", laudioSetMusicPan ); @@ -1197,3 +1197,19 @@ int ltextTextSplit( lua_State* L ) { 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; +} |
