diff options
| -rw-r--r-- | API.md | 78 | ||||
| -rw-r--r-- | README.md | 3 | ||||
| -rw-r--r-- | ReiLua_API.lua | 62 | ||||
| -rw-r--r-- | apiScanner.lua | 3 | ||||
| -rw-r--r-- | changelog | 1 | ||||
| -rw-r--r-- | devnotes | 1 | ||||
| -rw-r--r-- | examples/dungeon_crawler/main.lua | 7 | ||||
| -rw-r--r-- | include/core.h | 2 | ||||
| -rw-r--r-- | src/core.c | 22 | ||||
| -rw-r--r-- | src/lua_core.c | 2 |
10 files changed, 146 insertions, 35 deletions
@@ -3824,6 +3824,18 @@ Get clipboard text content --- +> RL.EnableEventWaiting() + +Enable waiting for events on EndDrawing(), no automatic event polling + +--- + +> RL.DisableEventWaiting() + +Disable waiting for events on EndDrawing(), automatic events polling + +--- + ## Core - Cursor-related functions --- @@ -4134,6 +4146,22 @@ Set target FPS (maximum) --- +> delta = RL.GetFrameTime() + +Get time in seconds for last frame drawn (Delta time) + +- Success return float + +--- + +> time = RL.GetTime() + +Get elapsed time in seconds since InitWindow() + +- Success return float + +--- + > FPS = RL.GetFPS() Get current FPS @@ -4142,19 +4170,25 @@ Get current FPS --- -> delta = RL.GetFrameTime() +## Core - Custom frame control functions -Get time in seconds for last frame drawn (Delta time) +--- -- Success return float +> RL.SwapScreenBuffer() + +Swap back buffer with front buffer (screen drawing) --- -> time = RL.GetTime() +> RL.PollInputEvents() -Get elapsed time in seconds since InitWindow() +Register all input events -- Success return float +--- + +> RL.WaitTime( number seconds ) + +Wait for some time (halt program execution) --- @@ -6354,14 +6388,6 @@ Get Color structure from hexadecimal value --- -> color = RL.GetPixelColor( Texture texture, Vector2 position ) - -Get pixel color from source texture - -- Success return Color - ---- - > size = RL.GetPixelDataSize( int width, int height, int format ) Get pixel data size in bytes for certain format @@ -6756,6 +6782,22 @@ Encode one codepoint into UTF-8 byte array --- +> text = RL.TextSubtext( string text, int position, int length ) + +Get a piece of a text string + +- Success return string + +--- + +> text = RL.TextReplace( string text, string replace, string by ) + +Replace text string + +- Success return string + +--- + > text = RL.TextInsert( string text, string insert, int position ) Insert text in a specific position, moves all text forward @@ -6780,6 +6822,14 @@ Find first text occurrence within a string --- +> text = RL.TextToPascal( string text ) + +Get Pascal case notation version of provided string + +- Success return string + +--- + ## Models - Basic geometric 3D shapes drawing functions --- @@ -66,9 +66,8 @@ end function RL.draw() RL.ClearBackground( RL.RAYWHITE ) - RL.DrawText( text, textPos, textSize, textColor ) + RL.DrawText( text, textPos, textSize, textColor ) end - ``` Application folder structure should be... diff --git a/ReiLua_API.lua b/ReiLua_API.lua index 66f3132..4447bd4 100644 --- a/ReiLua_API.lua +++ b/ReiLua_API.lua @@ -1441,6 +1441,14 @@ function RL.SetClipboardText( text ) end ---@return any text function RL.GetClipboardText() end +---Enable waiting for events on EndDrawing(), no automatic event polling +---@return any RL.EnableEventWaiting +function RL.EnableEventWaiting() end + +---Disable waiting for events on EndDrawing(), automatic events polling +---@return any RL.DisableEventWaiting +function RL.DisableEventWaiting() end + -- Core - Cursor-related functions ---Shows cursor @@ -1693,11 +1701,6 @@ function RL.GetScreenToWorld2D( position, camera ) end ---@return any RL.SetTargetFPS function RL.SetTargetFPS( fps ) end ----Get current FPS ----- Success return int ----@return any FPS -function RL.GetFPS() end - ---Get time in seconds for last frame drawn (Delta time) ---- Success return float ---@return any delta @@ -1708,6 +1711,26 @@ function RL.GetFrameTime() end ---@return any time function RL.GetTime() end +---Get current FPS +---- Success return int +---@return any FPS +function RL.GetFPS() end + +-- Core - Custom frame control functions + +---Swap back buffer with front buffer (screen drawing) +---@return any RL.SwapScreenBuffer +function RL.SwapScreenBuffer() end + +---Register all input events +---@return any RL.PollInputEvents +function RL.PollInputEvents() end + +---Wait for some time (halt program execution) +---@param seconds any +---@return any RL.WaitTime +function RL.WaitTime( seconds ) end + -- Core - Random values generation functions ---Set the seed for the random number generator @@ -3707,13 +3730,6 @@ function RL.ColorAlphaBlend( dst, src, tint ) end ---@return any color function RL.GetColor( hexValue ) end ----Get pixel color from source texture ----- Success return Color ----@param texture any ----@param position table ----@return any color -function RL.GetPixelColor( texture, position ) end - ---Get pixel data size in bytes for certain format ---- Success return int ---@param width integer @@ -4080,6 +4096,22 @@ function RL.CodepointToUTF8( codepoint ) end -- Text - Text strings management functions (no UTF-8 strings, only byte chars) +---Get a piece of a text string +---- Success return string +---@param text string +---@param position integer +---@param length integer +---@return any text +function RL.TextSubtext( text, position, length ) end + +---Replace text string +---- Success return string +---@param text string +---@param replace string +---@param by string +---@return any text +function RL.TextReplace( text, replace, by ) end + ---Insert text in a specific position, moves all text forward ---- Success return string ---@param text string @@ -4102,6 +4134,12 @@ function RL.TextSplit( text, delimiter ) end ---@return any index function RL.TextFindIndex( text, find ) end +---Get Pascal case notation version of provided string +---- Success return string +---@param text string +---@return any text +function RL.TextToPascal( text ) end + -- Models - Basic geometric 3D shapes drawing functions ---Draw a line in 3D world space diff --git a/apiScanner.lua b/apiScanner.lua index ca01bed..36c6e1c 100644 --- a/apiScanner.lua +++ b/apiScanner.lua @@ -53,6 +53,7 @@ local raylib = { TextCopy = "Can be replaced by Lua equivalent", TextIsEqual = "Can be replaced by Lua equivalent", TextLength = "Can be replaced by Lua equivalent", + TextFormat = "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", @@ -63,6 +64,8 @@ local raylib = { UploadMesh = "Handled internally", UpdateMeshBuffer = "Handled internally", UnloadWaveSamples = "Handled internally", + GetPixelColor = "Not seen necessary", + SetPixelColor = "Not seen necessary", }, info = { GenMeshHemiSphere = "Will be added", @@ -30,6 +30,7 @@ DETAILED CHANGES: - ADDED: TextSubtext, TextReplace and TextToPascal. - ADDED: Custom frame control functions. - REMOVED: GetPixelColor. Deviates too much from raylib function. + - ADDED: EnableEventWaiting and DisableEventWaiting. ------------------------------------------------------------------------ Release: ReiLua version 0.7.0 Using Raylib 5.0 and Forked Raygui 4.0 @@ -20,7 +20,6 @@ Backlog { * 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. } Bugs { diff --git a/examples/dungeon_crawler/main.lua b/examples/dungeon_crawler/main.lua index f8810b1..6592092 100644 --- a/examples/dungeon_crawler/main.lua +++ b/examples/dungeon_crawler/main.lua @@ -6,7 +6,7 @@ local textureSize = { 256, 96 } local res = { 384, 216 } local winSize = RL.GetScreenSize() local winScale = 4 -local framebuffer = -1 +local framebuffer = nil local TILE_SIZE = 32 local TILE_VERTEX_COLORS = { RL.WHITE, RL.WHITE, RL.WHITE, RL.WHITE } @@ -91,11 +91,9 @@ function RL.draw() RL.UpdateCamera3D( camera, RL.CAMERA_FIRST_PERSON ) pos = RL.GetCamera3DPosition( camera ) - -- RL.BeginTextureMode( framebuffer ) RL.ClearBackground( { 100, 150, 150 } ) RL.BeginMode3D( camera ) - -- Floor and ceiling. for x = 0, 3 do for y = 0, 10 do @@ -119,7 +117,4 @@ function RL.draw() drawSprites() RL.EndMode3D() - -- RL.EndTextureMode() - - -- RL.DrawTexturePro( framebuffer, { 0, 0, res[1], -res[2] }, { 0, 0, winSize[1], winSize[2] }, { 0, 0 }, 0.0, WHITE ) end diff --git a/include/core.h b/include/core.h index e9f8d1b..939dfaf 100644 --- a/include/core.h +++ b/include/core.h @@ -44,6 +44,8 @@ int lcoreGetWindowScaleDPI( lua_State* L ); int lcoreGetMonitorName( lua_State* L ); int lcoreSetClipboardText( lua_State* L ); int lcoreGetClipboardText( lua_State* L ); +int lcoreEnableEventWaiting( lua_State* L ); +int lcoreDisableEventWaiting( lua_State* L ); /* Cursor-related functions. */ int lcoreShowCursor( lua_State* L ); int lcoreHideCursor( lua_State* L ); @@ -560,6 +560,28 @@ int lcoreGetClipboardText( lua_State* L ) { } /* +> RL.EnableEventWaiting() + +Enable waiting for events on EndDrawing(), no automatic event polling +*/ +int lcoreEnableEventWaiting( lua_State* L ) { + EnableEventWaiting(); + + return 0; +} + +/* +> RL.DisableEventWaiting() + +Disable waiting for events on EndDrawing(), automatic events polling +*/ +int lcoreDisableEventWaiting( lua_State* L ) { + DisableEventWaiting(); + + return 0; +} + +/* ## Core - Cursor-related functions */ diff --git a/src/lua_core.c b/src/lua_core.c index a6078a9..d4820bf 100644 --- a/src/lua_core.c +++ b/src/lua_core.c @@ -1238,6 +1238,8 @@ void luaRegister() { assingGlobalFunction( "GetMonitorName", lcoreGetMonitorName ); assingGlobalFunction( "SetClipboardText", lcoreSetClipboardText ); assingGlobalFunction( "GetClipboardText", lcoreGetClipboardText ); + assingGlobalFunction( "EnableEventWaiting", lcoreEnableEventWaiting ); + assingGlobalFunction( "DisableEventWaiting", lcoreDisableEventWaiting ); /* Cursor-related functions. */ assingGlobalFunction( "ShowCursor", lcoreShowCursor ); assingGlobalFunction( "HideCursor", lcoreHideCursor ); |
