Round and pubsub lib.
This commit is contained in:
@@ -2096,7 +2096,7 @@ int lcoreGetAutomationEventListCount( lua_State* L ) {
|
||||
/*
|
||||
> event = RL.GetAutomationEvent( AutomationEventList list, int index )
|
||||
|
||||
Get automation event from automation event list
|
||||
Get automation event from automation event list. Return as lightuserdata
|
||||
|
||||
- Failure return nil
|
||||
- Success return AutomationEvent
|
||||
@@ -2106,7 +2106,7 @@ int lcoreGetAutomationEvent( lua_State* L ) {
|
||||
int index = luaL_checkinteger( L, 2 );
|
||||
|
||||
if ( 0 <= index && index < list->count ) {
|
||||
uluaPushAutomationEvent( L, list->events[ index ] );
|
||||
lua_pushlightuserdata( L, &list->events[ index ] );
|
||||
}
|
||||
else {
|
||||
TraceLog( LOG_WARNING, "GetAutomationEvent index %d out of bounds", index );
|
||||
|
||||
@@ -1893,6 +1893,7 @@ void luaRegister() {
|
||||
|
||||
/* Math. */
|
||||
/* Utils. */
|
||||
assingGlobalFunction( "Round", lmathRound );
|
||||
assingGlobalFunction( "Clamp", lmathClamp );
|
||||
assingGlobalFunction( "Lerp", lmathLerp );
|
||||
assingGlobalFunction( "Normalize", lmathNormalize );
|
||||
|
||||
15
src/rmath.c
15
src/rmath.c
@@ -15,6 +15,21 @@ inline int imax( int a, int b ) {
|
||||
## Math - Utils
|
||||
*/
|
||||
|
||||
/*
|
||||
> result = RL.Round( float value )
|
||||
|
||||
Round float value
|
||||
|
||||
- Success return float
|
||||
*/
|
||||
int lmathRound( lua_State* L ) {
|
||||
float value = luaL_checknumber( L, 1 );
|
||||
|
||||
lua_pushnumber( L, round( value ) );
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
> result = RL.Clamp( float value, float min, float max )
|
||||
|
||||
|
||||
Reference in New Issue
Block a user