diff options
| author | jussi | 2024-02-25 14:06:59 +0200 |
|---|---|---|
| committer | jussi | 2024-02-25 14:06:59 +0200 |
| commit | 47ed28b006db71d823cfaa24fa143ab5cfcf279b (patch) | |
| tree | adf35906662b0646a14adfa6a37260c797cd325a /src/core.c | |
| parent | 631cea6aa7510ba53d4f14b5537e1719a72976b9 (diff) | |
| download | reilua-enhanced-47ed28b006db71d823cfaa24fa143ab5cfcf279b.tar.gz reilua-enhanced-47ed28b006db71d823cfaa24fa143ab5cfcf279b.tar.bz2 reilua-enhanced-47ed28b006db71d823cfaa24fa143ab5cfcf279b.zip | |
Added various missing functions.
Diffstat (limited to 'src/core.c')
| -rw-r--r-- | src/core.c | 122 |
1 files changed, 109 insertions, 13 deletions
@@ -1221,6 +1221,32 @@ int lcoreSetTargetFPS( lua_State* L ) { } /* +> delta = RL.GetFrameTime() + +Get time in seconds for last frame drawn (Delta time) + +- Success return float +*/ +int lcoreGetFrameTime( lua_State* L ) { + lua_pushnumber( L, GetFrameTime() ); + + return 1; +} + +/* +> time = RL.GetTime() + +Get elapsed time in seconds since InitWindow() + +- Success return float +*/ +int lcoreGetTime( lua_State* L ) { + lua_pushnumber( L, GetTime() ); + + return 1; +} + +/* > FPS = RL.GetFPS() Get current FPS @@ -1234,29 +1260,42 @@ int lcoreGetFPS( lua_State* L ) { } /* -> delta = RL.GetFrameTime() +## Core - Custom frame control functions +*/ -Get time in seconds for last frame drawn (Delta time) +/* +> RL.SwapScreenBuffer() -- Success return float +Swap back buffer with front buffer (screen drawing) */ -int lcoreGetFrameTime( lua_State* L ) { - lua_pushnumber( L, GetFrameTime() ); +int lcoreSwapScreenBuffer( lua_State* L ) { + SwapScreenBuffer(); - return 1; + return 0; } /* -> time = RL.GetTime() +> RL.PollInputEvents() -Get elapsed time in seconds since InitWindow() +Register all input events +*/ +int lcorePollInputEvents( lua_State* L ) { + PollInputEvents(); -- Success return float + return 0; +} + +/* +> RL.WaitTime( number seconds ) + +Wait for some time (halt program execution) */ -int lcoreGetTime( lua_State* L ) { - lua_pushnumber( L, GetTime() ); +int lcoreWaitTime( lua_State* L ) { + double seconds = luaL_checknumber( L, 1 ); - return 1; + WaitTime( seconds ); + + return 0; } /* @@ -1908,6 +1947,21 @@ int lcoreIsKeyPressed( lua_State* L ) { } /* +> 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 ) Detect if a key is being pressed @@ -2074,6 +2128,35 @@ int lcoreIsGamepadButtonReleased( lua_State* L ) { } /* +> 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 ) Return gamepad axis count for a 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 */ @@ -2262,6 +2345,19 @@ int lcoreGetMouseWheelMove( lua_State* L ) { } /* +> 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 ) Set mouse cursor |
