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

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 )