Pointer variable declaration style change.
This commit is contained in:
162
src/audio.c
162
src/audio.c
@@ -12,7 +12,7 @@
|
||||
|
||||
Initialize audio device and context
|
||||
*/
|
||||
int laudioInitAudioDevice( lua_State *L ) {
|
||||
int laudioInitAudioDevice( lua_State* L ) {
|
||||
InitAudioDevice();
|
||||
|
||||
return 0;
|
||||
@@ -23,7 +23,7 @@ int laudioInitAudioDevice( lua_State *L ) {
|
||||
|
||||
Close the audio device and context
|
||||
*/
|
||||
int laudioCloseAudioDevice( lua_State *L ) {
|
||||
int laudioCloseAudioDevice( lua_State* L ) {
|
||||
CloseAudioDevice();
|
||||
|
||||
return 0;
|
||||
@@ -36,7 +36,7 @@ Check if audio device has been initialized successfully
|
||||
|
||||
- Success return bool
|
||||
*/
|
||||
int laudioIsAudioDeviceReady( lua_State *L ) {
|
||||
int laudioIsAudioDeviceReady( lua_State* L ) {
|
||||
lua_pushboolean( L, IsAudioDeviceReady() );
|
||||
|
||||
return 1;
|
||||
@@ -47,7 +47,7 @@ int laudioIsAudioDeviceReady( lua_State *L ) {
|
||||
|
||||
Set master volume (listener)
|
||||
*/
|
||||
int laudioSetMasterVolume( lua_State *L ) {
|
||||
int laudioSetMasterVolume( lua_State* L ) {
|
||||
float volume = luaL_checknumber( L, 1 );
|
||||
|
||||
SetMasterVolume( volume );
|
||||
@@ -62,7 +62,7 @@ Get master volume (listener)
|
||||
|
||||
- Success return float
|
||||
*/
|
||||
int laudioGetMasterVolume( lua_State *L ) {
|
||||
int laudioGetMasterVolume( lua_State* L ) {
|
||||
lua_pushnumber( L, GetMasterVolume() );
|
||||
|
||||
return 1;
|
||||
@@ -80,7 +80,7 @@ Load sound from file
|
||||
- Failure return nil
|
||||
- Success return Sound
|
||||
*/
|
||||
int laudioLoadSound( lua_State *L ) {
|
||||
int laudioLoadSound( lua_State* L ) {
|
||||
if ( FileExists( luaL_checkstring( L, 1 ) ) ) {
|
||||
uluaPushSound( L, LoadSound( lua_tostring( L, 1 ) ) );
|
||||
|
||||
@@ -100,7 +100,7 @@ Load wave data from file
|
||||
- Failure return nil
|
||||
- Success return Wave
|
||||
*/
|
||||
int laudioLoadWave( lua_State *L ) {
|
||||
int laudioLoadWave( lua_State* L ) {
|
||||
if ( FileExists( luaL_checkstring( L, 1 ) ) ) {
|
||||
uluaPushWave( L, LoadWave( lua_tostring( L, 1 ) ) );
|
||||
|
||||
@@ -119,7 +119,7 @@ Load wave from memory buffer, fileType refers to extension: i.e. '.wav'
|
||||
|
||||
- Success return Wave
|
||||
*/
|
||||
int laudioLoadWaveFromMemory( lua_State *L ) {
|
||||
int laudioLoadWaveFromMemory( lua_State* L ) {
|
||||
const char* fileType = luaL_checkstring( L, 1 );
|
||||
Buffer* buffer = uluaGetBuffer( L, 2 );
|
||||
|
||||
@@ -135,8 +135,8 @@ Checks if wave data is ready
|
||||
|
||||
- Success return bool
|
||||
*/
|
||||
int laudioIsWaveReady( lua_State *L ) {
|
||||
Wave *wave = uluaGetWave( L, 1 );
|
||||
int laudioIsWaveReady( lua_State* L ) {
|
||||
Wave* wave = uluaGetWave( L, 1 );
|
||||
|
||||
lua_pushboolean( L, IsWaveReady( *wave ) );
|
||||
|
||||
@@ -150,8 +150,8 @@ Load sound from wave data
|
||||
|
||||
- Success return Sound
|
||||
*/
|
||||
int laudioLoadSoundFromWave( lua_State *L ) {
|
||||
Wave *wave = uluaGetWave( L, 1 );
|
||||
int laudioLoadSoundFromWave( lua_State* L ) {
|
||||
Wave* wave = uluaGetWave( L, 1 );
|
||||
|
||||
uluaPushSound( L, LoadSoundFromWave( *wave ) );
|
||||
|
||||
@@ -165,8 +165,8 @@ Create a new sound that shares the same sample data as the source sound, does no
|
||||
|
||||
- Success return Sound
|
||||
*/
|
||||
int laudioLoadSoundAlias( lua_State *L ) {
|
||||
Sound *source = uluaGetSound( L, 1 );
|
||||
int laudioLoadSoundAlias( lua_State* L ) {
|
||||
Sound* source = uluaGetSound( L, 1 );
|
||||
|
||||
uluaPushSound( L, LoadSoundAlias( *source ) );
|
||||
|
||||
@@ -180,8 +180,8 @@ Checks if a sound is ready
|
||||
|
||||
- Success return bool
|
||||
*/
|
||||
int laudioIsSoundReady( lua_State *L ) {
|
||||
Sound *sound = uluaGetSound( L, 1 );
|
||||
int laudioIsSoundReady( lua_State* L ) {
|
||||
Sound* sound = uluaGetSound( L, 1 );
|
||||
|
||||
lua_pushboolean( L, IsSoundReady( *sound ) );
|
||||
|
||||
@@ -193,8 +193,8 @@ int laudioIsSoundReady( lua_State *L ) {
|
||||
|
||||
Unload wave data
|
||||
*/
|
||||
int laudioUnloadWave( lua_State *L ) {
|
||||
Wave *wave = uluaGetWave( L, 1 );
|
||||
int laudioUnloadWave( lua_State* L ) {
|
||||
Wave* wave = uluaGetWave( L, 1 );
|
||||
|
||||
UnloadWave( *wave );
|
||||
|
||||
@@ -206,8 +206,8 @@ int laudioUnloadWave( lua_State *L ) {
|
||||
|
||||
Unload sound
|
||||
*/
|
||||
int laudioUnloadSound( lua_State *L ) {
|
||||
Sound *sound = uluaGetSound( L, 1 );
|
||||
int laudioUnloadSound( lua_State* L ) {
|
||||
Sound* sound = uluaGetSound( L, 1 );
|
||||
|
||||
UnloadSound( *sound );
|
||||
|
||||
@@ -219,8 +219,8 @@ int laudioUnloadSound( lua_State *L ) {
|
||||
|
||||
Unload a sound alias (does not deallocate sample data)
|
||||
*/
|
||||
int laudioUnloadSoundAlias( lua_State *L ) {
|
||||
Sound *alias = uluaGetSound( L, 1 );
|
||||
int laudioUnloadSoundAlias( lua_State* L ) {
|
||||
Sound* alias = uluaGetSound( L, 1 );
|
||||
|
||||
UnloadSoundAlias( *alias );
|
||||
|
||||
@@ -234,8 +234,8 @@ Export wave data to file, returns true on success
|
||||
|
||||
- Success return bool
|
||||
*/
|
||||
int laudioExportWave( lua_State *L ) {
|
||||
Wave *wave = uluaGetWave( L, 1 );
|
||||
int laudioExportWave( lua_State* L ) {
|
||||
Wave* wave = uluaGetWave( L, 1 );
|
||||
|
||||
lua_pushboolean( L, ExportWave( *wave, luaL_checkstring( L, 2 ) ) );
|
||||
|
||||
@@ -249,8 +249,8 @@ Export wave sample data to code (.h), returns true on success
|
||||
|
||||
- Success return true
|
||||
*/
|
||||
int laudioExportWaveAsCode( lua_State *L ) {
|
||||
Wave *wave = uluaGetWave( L, 1 );
|
||||
int laudioExportWaveAsCode( lua_State* L ) {
|
||||
Wave* wave = uluaGetWave( L, 1 );
|
||||
|
||||
lua_pushboolean( L, ExportWaveAsCode( *wave, luaL_checkstring( L, 2 ) ) );
|
||||
|
||||
@@ -266,8 +266,8 @@ int laudioExportWaveAsCode( lua_State *L ) {
|
||||
|
||||
Play a sound
|
||||
*/
|
||||
int laudioPlaySound( lua_State *L ) {
|
||||
Sound *sound = uluaGetSound( L, 1 );
|
||||
int laudioPlaySound( lua_State* L ) {
|
||||
Sound* sound = uluaGetSound( L, 1 );
|
||||
|
||||
PlaySound( *sound );
|
||||
|
||||
@@ -279,8 +279,8 @@ int laudioPlaySound( lua_State *L ) {
|
||||
|
||||
Stop playing a sound
|
||||
*/
|
||||
int laudioStopSound( lua_State *L ) {
|
||||
Sound *sound = uluaGetSound( L, 1 );
|
||||
int laudioStopSound( lua_State* L ) {
|
||||
Sound* sound = uluaGetSound( L, 1 );
|
||||
|
||||
StopSound( *sound );
|
||||
|
||||
@@ -292,8 +292,8 @@ int laudioStopSound( lua_State *L ) {
|
||||
|
||||
Pause a sound
|
||||
*/
|
||||
int laudioPauseSound( lua_State *L ) {
|
||||
Sound *sound = uluaGetSound( L, 1 );
|
||||
int laudioPauseSound( lua_State* L ) {
|
||||
Sound* sound = uluaGetSound( L, 1 );
|
||||
|
||||
PauseSound( *sound );
|
||||
|
||||
@@ -305,8 +305,8 @@ int laudioPauseSound( lua_State *L ) {
|
||||
|
||||
Resume a paused sound
|
||||
*/
|
||||
int laudioResumeSound( lua_State *L ) {
|
||||
Sound *sound = uluaGetSound( L, 1 );
|
||||
int laudioResumeSound( lua_State* L ) {
|
||||
Sound* sound = uluaGetSound( L, 1 );
|
||||
|
||||
ResumeSound( *sound );
|
||||
|
||||
@@ -320,8 +320,8 @@ Check if a sound is currently playing
|
||||
|
||||
- Success return bool
|
||||
*/
|
||||
int laudioIsSoundPlaying( lua_State *L ) {
|
||||
Sound *sound = uluaGetSound( L, 1 );
|
||||
int laudioIsSoundPlaying( lua_State* L ) {
|
||||
Sound* sound = uluaGetSound( L, 1 );
|
||||
|
||||
lua_pushboolean( L, IsSoundPlaying( *sound ) );
|
||||
|
||||
@@ -333,8 +333,8 @@ int laudioIsSoundPlaying( lua_State *L ) {
|
||||
|
||||
Set volume for a sound (1.0 is max level)
|
||||
*/
|
||||
int laudioSetSoundVolume( lua_State *L ) {
|
||||
Sound *sound = uluaGetSound( L, 1 );
|
||||
int laudioSetSoundVolume( lua_State* L ) {
|
||||
Sound* sound = uluaGetSound( L, 1 );
|
||||
float volume = luaL_checknumber( L, 2 );
|
||||
|
||||
SetSoundVolume( *sound, volume );
|
||||
@@ -347,8 +347,8 @@ int laudioSetSoundVolume( lua_State *L ) {
|
||||
|
||||
Set pitch for a sound (1.0 is base level)
|
||||
*/
|
||||
int laudioSetSoundPitch( lua_State *L ) {
|
||||
Sound *sound = uluaGetSound( L, 1 );
|
||||
int laudioSetSoundPitch( lua_State* L ) {
|
||||
Sound* sound = uluaGetSound( L, 1 );
|
||||
float pitch = luaL_checknumber( L, 2 );
|
||||
|
||||
SetSoundPitch( *sound, pitch );
|
||||
@@ -361,8 +361,8 @@ int laudioSetSoundPitch( lua_State *L ) {
|
||||
|
||||
Set pan for a sound (0.5 is center)
|
||||
*/
|
||||
int laudioSetSoundPan( lua_State *L ) {
|
||||
Sound *sound = uluaGetSound( L, 1 );
|
||||
int laudioSetSoundPan( lua_State* L ) {
|
||||
Sound* sound = uluaGetSound( L, 1 );
|
||||
float pan = luaL_checknumber( L, 2 );
|
||||
|
||||
SetSoundPan( *sound, pan );
|
||||
@@ -375,8 +375,8 @@ int laudioSetSoundPan( lua_State *L ) {
|
||||
|
||||
Convert wave data to desired format
|
||||
*/
|
||||
int laudioWaveFormat( lua_State *L ) {
|
||||
Wave *wave = uluaGetWave( L, 1 );
|
||||
int laudioWaveFormat( lua_State* L ) {
|
||||
Wave* wave = uluaGetWave( L, 1 );
|
||||
int sampleRate = luaL_checkinteger( L, 2 );
|
||||
int sampleSize = luaL_checkinteger( L, 3 );
|
||||
int channels = luaL_checkinteger( L, 4 );
|
||||
@@ -393,8 +393,8 @@ Copy a wave to a new wave
|
||||
|
||||
- Success return Wave
|
||||
*/
|
||||
int laudioWaveCopy( lua_State *L ) {
|
||||
Wave *wave = uluaGetWave( L, 1 );
|
||||
int laudioWaveCopy( lua_State* L ) {
|
||||
Wave* wave = uluaGetWave( L, 1 );
|
||||
|
||||
uluaPushWave( L, WaveCopy( *wave ) );
|
||||
|
||||
@@ -406,8 +406,8 @@ int laudioWaveCopy( lua_State *L ) {
|
||||
|
||||
Crop a wave to defined samples range
|
||||
*/
|
||||
int laudioWaveCrop( lua_State *L ) {
|
||||
Wave *wave = uluaGetWave( L, 1 );
|
||||
int laudioWaveCrop( lua_State* L ) {
|
||||
Wave* wave = uluaGetWave( L, 1 );
|
||||
int initSample = luaL_checkinteger( L, 2 );
|
||||
int finalSample = luaL_checkinteger( L, 3 );
|
||||
|
||||
@@ -427,7 +427,7 @@ Load music stream from file
|
||||
|
||||
- Success return Music
|
||||
*/
|
||||
int laudioLoadMusicStream( lua_State *L ) {
|
||||
int laudioLoadMusicStream( lua_State* L ) {
|
||||
if ( FileExists( luaL_checkstring( L, 1 ) ) ) {
|
||||
uluaPushMusic( L, LoadMusicStream( lua_tostring( L, 1 ) ) );
|
||||
|
||||
@@ -462,8 +462,8 @@ Checks if a music stream is ready
|
||||
|
||||
- Success return bool
|
||||
*/
|
||||
int laudioIsMusicReady( lua_State *L ) {
|
||||
Music *music = uluaGetMusic( L, 1 );
|
||||
int laudioIsMusicReady( lua_State* L ) {
|
||||
Music* music = uluaGetMusic( L, 1 );
|
||||
|
||||
lua_pushboolean( L, IsMusicReady( *music ) );
|
||||
|
||||
@@ -475,8 +475,8 @@ int laudioIsMusicReady( lua_State *L ) {
|
||||
|
||||
Unload music stream
|
||||
*/
|
||||
int laudioUnloadMusicStream( lua_State *L ) {
|
||||
Music *music = uluaGetMusic( L, 1 );
|
||||
int laudioUnloadMusicStream( lua_State* L ) {
|
||||
Music* music = uluaGetMusic( L, 1 );
|
||||
|
||||
UnloadMusicStream( *music );
|
||||
|
||||
@@ -488,8 +488,8 @@ int laudioUnloadMusicStream( lua_State *L ) {
|
||||
|
||||
Start music playing
|
||||
*/
|
||||
int laudioPlayMusicStream( lua_State *L ) {
|
||||
Music *music = uluaGetMusic( L, 1 );
|
||||
int laudioPlayMusicStream( lua_State* L ) {
|
||||
Music* music = uluaGetMusic( L, 1 );
|
||||
|
||||
PlayMusicStream( *music );
|
||||
|
||||
@@ -503,8 +503,8 @@ Check if music is playing
|
||||
|
||||
- Success return bool
|
||||
*/
|
||||
int laudioIsMusicStreamPlaying( lua_State *L ) {
|
||||
Music *music = uluaGetMusic( L, 1 );
|
||||
int laudioIsMusicStreamPlaying( lua_State* L ) {
|
||||
Music* music = uluaGetMusic( L, 1 );
|
||||
|
||||
lua_pushboolean( L, IsMusicStreamPlaying( *music ) );
|
||||
|
||||
@@ -516,8 +516,8 @@ int laudioIsMusicStreamPlaying( lua_State *L ) {
|
||||
|
||||
Updates buffers for music streaming
|
||||
*/
|
||||
int laudioUpdateMusicStream( lua_State *L ) {
|
||||
Music *music = uluaGetMusic( L, 1 );
|
||||
int laudioUpdateMusicStream( lua_State* L ) {
|
||||
Music* music = uluaGetMusic( L, 1 );
|
||||
|
||||
UpdateMusicStream( *music );
|
||||
|
||||
@@ -529,8 +529,8 @@ int laudioUpdateMusicStream( lua_State *L ) {
|
||||
|
||||
Stop music playing
|
||||
*/
|
||||
int laudioStopMusicStream( lua_State *L ) {
|
||||
Music *music = uluaGetMusic( L, 1 );
|
||||
int laudioStopMusicStream( lua_State* L ) {
|
||||
Music* music = uluaGetMusic( L, 1 );
|
||||
|
||||
StopMusicStream( *music );
|
||||
|
||||
@@ -542,8 +542,8 @@ int laudioStopMusicStream( lua_State *L ) {
|
||||
|
||||
Pause music playing
|
||||
*/
|
||||
int laudioPauseMusicStream( lua_State *L ) {
|
||||
Music *music = uluaGetMusic( L, 1 );
|
||||
int laudioPauseMusicStream( lua_State* L ) {
|
||||
Music* music = uluaGetMusic( L, 1 );
|
||||
|
||||
PauseMusicStream( *music );
|
||||
|
||||
@@ -555,8 +555,8 @@ int laudioPauseMusicStream( lua_State *L ) {
|
||||
|
||||
Resume playing paused music
|
||||
*/
|
||||
int laudioResumeMusicStream( lua_State *L ) {
|
||||
Music *music = uluaGetMusic( L, 1 );
|
||||
int laudioResumeMusicStream( lua_State* L ) {
|
||||
Music* music = uluaGetMusic( L, 1 );
|
||||
|
||||
ResumeMusicStream( *music );
|
||||
|
||||
@@ -568,8 +568,8 @@ int laudioResumeMusicStream( lua_State *L ) {
|
||||
|
||||
Seek music to a position (in seconds)
|
||||
*/
|
||||
int laudioSeekMusicStream( lua_State *L ) {
|
||||
Music *music = uluaGetMusic( L, 1 );
|
||||
int laudioSeekMusicStream( lua_State* L ) {
|
||||
Music* music = uluaGetMusic( L, 1 );
|
||||
float position = luaL_checknumber( L, 2 );
|
||||
|
||||
SeekMusicStream( *music, position );
|
||||
@@ -582,8 +582,8 @@ int laudioSeekMusicStream( lua_State *L ) {
|
||||
|
||||
Set volume for music (1.0 is max level)
|
||||
*/
|
||||
int laudioSetMusicVolume( lua_State *L ) {
|
||||
Music *music = uluaGetMusic( L, 1 );
|
||||
int laudioSetMusicVolume( lua_State* L ) {
|
||||
Music* music = uluaGetMusic( L, 1 );
|
||||
float volume = luaL_checknumber( L, 2 );
|
||||
|
||||
SetMusicVolume( *music, volume );
|
||||
@@ -596,8 +596,8 @@ int laudioSetMusicVolume( lua_State *L ) {
|
||||
|
||||
Set pitch for a music (1.0 is base level)
|
||||
*/
|
||||
int laudioSetMusicPitch( lua_State *L ) {
|
||||
Music *music = uluaGetMusic( L, 1 );
|
||||
int laudioSetMusicPitch( lua_State* L ) {
|
||||
Music* music = uluaGetMusic( L, 1 );
|
||||
float pitch = luaL_checknumber( L, 2 );
|
||||
|
||||
SetMusicPitch( *music, pitch );
|
||||
@@ -610,8 +610,8 @@ int laudioSetMusicPitch( lua_State *L ) {
|
||||
|
||||
Set pan for a music (0.5 is center)
|
||||
*/
|
||||
int laudioSetMusicPan( lua_State *L ) {
|
||||
Music *music = uluaGetMusic( L, 1 );
|
||||
int laudioSetMusicPan( lua_State* L ) {
|
||||
Music* music = uluaGetMusic( L, 1 );
|
||||
float pan = luaL_checknumber( L, 2 );
|
||||
|
||||
SetMusicPitch( *music, pan );
|
||||
@@ -624,8 +624,8 @@ int laudioSetMusicPan( lua_State *L ) {
|
||||
|
||||
Set looping for a music
|
||||
*/
|
||||
int laudioSetMusicLooping( lua_State *L ) {
|
||||
Music *music = uluaGetMusic( L, 1 );
|
||||
int laudioSetMusicLooping( lua_State* L ) {
|
||||
Music* music = uluaGetMusic( L, 1 );
|
||||
bool looping = uluaGetBoolean( L, 2 );
|
||||
|
||||
music->looping = looping;
|
||||
@@ -640,8 +640,8 @@ Get looping of a music
|
||||
|
||||
- Success return bool
|
||||
*/
|
||||
int laudioGetMusicLooping( lua_State *L ) {
|
||||
Music *music = uluaGetMusic( L, 1 );
|
||||
int laudioGetMusicLooping( lua_State* L ) {
|
||||
Music* music = uluaGetMusic( L, 1 );
|
||||
|
||||
lua_pushboolean( L, music->looping );
|
||||
|
||||
@@ -655,8 +655,8 @@ Get music time length (in seconds)
|
||||
|
||||
- Success return float
|
||||
*/
|
||||
int laudioGetMusicTimeLength( lua_State *L ) {
|
||||
Music *music = uluaGetMusic( L, 1 );
|
||||
int laudioGetMusicTimeLength( lua_State* L ) {
|
||||
Music* music = uluaGetMusic( L, 1 );
|
||||
|
||||
lua_pushnumber( L, GetMusicTimeLength( *music ) );
|
||||
|
||||
@@ -670,8 +670,8 @@ Get current music time played (in seconds)
|
||||
|
||||
- Success return float
|
||||
*/
|
||||
int laudioGetMusicTimePlayed( lua_State *L ) {
|
||||
Music *music = uluaGetMusic( L, 1 );
|
||||
int laudioGetMusicTimePlayed( lua_State* L ) {
|
||||
Music* music = uluaGetMusic( L, 1 );
|
||||
|
||||
lua_pushnumber( L, GetMusicTimePlayed( *music ) );
|
||||
|
||||
|
||||
620
src/core.c
620
src/core.c
File diff suppressed because it is too large
Load Diff
@@ -15,7 +15,7 @@ Ease linear
|
||||
|
||||
- Success return float
|
||||
*/
|
||||
int leasingsEaseLinear( lua_State *L ) {
|
||||
int leasingsEaseLinear( lua_State* L ) {
|
||||
float t = luaL_checknumber( L, 1 );
|
||||
float b = luaL_checknumber( L, 2 );
|
||||
float c = luaL_checknumber( L, 3 );
|
||||
@@ -37,7 +37,7 @@ Ease sine in
|
||||
|
||||
- Success return float
|
||||
*/
|
||||
int leasingsEaseSineIn( lua_State *L ) {
|
||||
int leasingsEaseSineIn( lua_State* L ) {
|
||||
float t = luaL_checknumber( L, 1 );
|
||||
float b = luaL_checknumber( L, 2 );
|
||||
float c = luaL_checknumber( L, 3 );
|
||||
@@ -55,7 +55,7 @@ Ease sine out
|
||||
|
||||
- Success return float
|
||||
*/
|
||||
int leasingsEaseSineOut( lua_State *L ) {
|
||||
int leasingsEaseSineOut( lua_State* L ) {
|
||||
float t = luaL_checknumber( L, 1 );
|
||||
float b = luaL_checknumber( L, 2 );
|
||||
float c = luaL_checknumber( L, 3 );
|
||||
@@ -73,7 +73,7 @@ Ease sine in out
|
||||
|
||||
- Success return float
|
||||
*/
|
||||
int leasingsEaseSineInOut( lua_State *L ) {
|
||||
int leasingsEaseSineInOut( lua_State* L ) {
|
||||
float t = luaL_checknumber( L, 1 );
|
||||
float b = luaL_checknumber( L, 2 );
|
||||
float c = luaL_checknumber( L, 3 );
|
||||
@@ -95,7 +95,7 @@ Ease circle in
|
||||
|
||||
- Success return float
|
||||
*/
|
||||
int leasingsEaseCircIn( lua_State *L ) {
|
||||
int leasingsEaseCircIn( lua_State* L ) {
|
||||
float t = luaL_checknumber( L, 1 );
|
||||
float b = luaL_checknumber( L, 2 );
|
||||
float c = luaL_checknumber( L, 3 );
|
||||
@@ -113,7 +113,7 @@ Ease circle out
|
||||
|
||||
- Success return float
|
||||
*/
|
||||
int leasingsEaseCircOut( lua_State *L ) {
|
||||
int leasingsEaseCircOut( lua_State* L ) {
|
||||
float t = luaL_checknumber( L, 1 );
|
||||
float b = luaL_checknumber( L, 2 );
|
||||
float c = luaL_checknumber( L, 3 );
|
||||
@@ -131,7 +131,7 @@ Ease circle in out
|
||||
|
||||
- Success return float
|
||||
*/
|
||||
int leasingsEaseCircInOut( lua_State *L ) {
|
||||
int leasingsEaseCircInOut( lua_State* L ) {
|
||||
float t = luaL_checknumber( L, 1 );
|
||||
float b = luaL_checknumber( L, 2 );
|
||||
float c = luaL_checknumber( L, 3 );
|
||||
@@ -153,7 +153,7 @@ Ease cubic in
|
||||
|
||||
- Success return float
|
||||
*/
|
||||
int leasingsEaseCubicIn( lua_State *L ) {
|
||||
int leasingsEaseCubicIn( lua_State* L ) {
|
||||
float t = luaL_checknumber( L, 1 );
|
||||
float b = luaL_checknumber( L, 2 );
|
||||
float c = luaL_checknumber( L, 3 );
|
||||
@@ -171,7 +171,7 @@ Ease cubic out
|
||||
|
||||
- Success return float
|
||||
*/
|
||||
int leasingsEaseCubicOut( lua_State *L ) {
|
||||
int leasingsEaseCubicOut( lua_State* L ) {
|
||||
float t = luaL_checknumber( L, 1 );
|
||||
float b = luaL_checknumber( L, 2 );
|
||||
float c = luaL_checknumber( L, 3 );
|
||||
@@ -189,7 +189,7 @@ Ease cubic in out
|
||||
|
||||
- Success return float
|
||||
*/
|
||||
int leasingsEaseCubicInOut( lua_State *L ) {
|
||||
int leasingsEaseCubicInOut( lua_State* L ) {
|
||||
float t = luaL_checknumber( L, 1 );
|
||||
float b = luaL_checknumber( L, 2 );
|
||||
float c = luaL_checknumber( L, 3 );
|
||||
@@ -211,7 +211,7 @@ Ease quadratic in
|
||||
|
||||
- Success return float
|
||||
*/
|
||||
int leasingsEaseQuadIn( lua_State *L ) {
|
||||
int leasingsEaseQuadIn( lua_State* L ) {
|
||||
float t = luaL_checknumber( L, 1 );
|
||||
float b = luaL_checknumber( L, 2 );
|
||||
float c = luaL_checknumber( L, 3 );
|
||||
@@ -229,7 +229,7 @@ Ease quadratic out
|
||||
|
||||
- Success return float
|
||||
*/
|
||||
int leasingsEaseQuadOut( lua_State *L ) {
|
||||
int leasingsEaseQuadOut( lua_State* L ) {
|
||||
float t = luaL_checknumber( L, 1 );
|
||||
float b = luaL_checknumber( L, 2 );
|
||||
float c = luaL_checknumber( L, 3 );
|
||||
@@ -247,7 +247,7 @@ Ease quadratic in out
|
||||
|
||||
- Success return float
|
||||
*/
|
||||
int leasingsEaseQuadInOut( lua_State *L ) {
|
||||
int leasingsEaseQuadInOut( lua_State* L ) {
|
||||
float t = luaL_checknumber( L, 1 );
|
||||
float b = luaL_checknumber( L, 2 );
|
||||
float c = luaL_checknumber( L, 3 );
|
||||
@@ -269,7 +269,7 @@ Ease exponential in
|
||||
|
||||
- Success return float
|
||||
*/
|
||||
int leasingsEaseExpoIn( lua_State *L ) {
|
||||
int leasingsEaseExpoIn( lua_State* L ) {
|
||||
float t = luaL_checknumber( L, 1 );
|
||||
float b = luaL_checknumber( L, 2 );
|
||||
float c = luaL_checknumber( L, 3 );
|
||||
@@ -287,7 +287,7 @@ Ease exponential out
|
||||
|
||||
- Success return float
|
||||
*/
|
||||
int leasingsEaseExpoOut( lua_State *L ) {
|
||||
int leasingsEaseExpoOut( lua_State* L ) {
|
||||
float t = luaL_checknumber( L, 1 );
|
||||
float b = luaL_checknumber( L, 2 );
|
||||
float c = luaL_checknumber( L, 3 );
|
||||
@@ -305,7 +305,7 @@ Ease exponential in out
|
||||
|
||||
- Success return float
|
||||
*/
|
||||
int leasingsEaseExpoInOut( lua_State *L ) {
|
||||
int leasingsEaseExpoInOut( lua_State* L ) {
|
||||
float t = luaL_checknumber( L, 1 );
|
||||
float b = luaL_checknumber( L, 2 );
|
||||
float c = luaL_checknumber( L, 3 );
|
||||
@@ -327,7 +327,7 @@ Ease back in
|
||||
|
||||
- Success return float
|
||||
*/
|
||||
int leasingsEaseBackIn( lua_State *L ) {
|
||||
int leasingsEaseBackIn( lua_State* L ) {
|
||||
float t = luaL_checknumber( L, 1 );
|
||||
float b = luaL_checknumber( L, 2 );
|
||||
float c = luaL_checknumber( L, 3 );
|
||||
@@ -345,7 +345,7 @@ Ease back out
|
||||
|
||||
- Success return float
|
||||
*/
|
||||
int leasingsEaseBackOut( lua_State *L ) {
|
||||
int leasingsEaseBackOut( lua_State* L ) {
|
||||
float t = luaL_checknumber( L, 1 );
|
||||
float b = luaL_checknumber( L, 2 );
|
||||
float c = luaL_checknumber( L, 3 );
|
||||
@@ -363,7 +363,7 @@ Ease back in out
|
||||
|
||||
- Success return float
|
||||
*/
|
||||
int leasingsEaseBackInOut( lua_State *L ) {
|
||||
int leasingsEaseBackInOut( lua_State* L ) {
|
||||
float t = luaL_checknumber( L, 1 );
|
||||
float b = luaL_checknumber( L, 2 );
|
||||
float c = luaL_checknumber( L, 3 );
|
||||
@@ -385,7 +385,7 @@ Ease bounce in
|
||||
|
||||
- Success return float
|
||||
*/
|
||||
int leasingsEaseBounceIn( lua_State *L ) {
|
||||
int leasingsEaseBounceIn( lua_State* L ) {
|
||||
float t = luaL_checknumber( L, 1 );
|
||||
float b = luaL_checknumber( L, 2 );
|
||||
float c = luaL_checknumber( L, 3 );
|
||||
@@ -403,7 +403,7 @@ Ease bounce out
|
||||
|
||||
- Success return float
|
||||
*/
|
||||
int leasingsEaseBounceOut( lua_State *L ) {
|
||||
int leasingsEaseBounceOut( lua_State* L ) {
|
||||
float t = luaL_checknumber( L, 1 );
|
||||
float b = luaL_checknumber( L, 2 );
|
||||
float c = luaL_checknumber( L, 3 );
|
||||
@@ -421,7 +421,7 @@ Ease bounce in out
|
||||
|
||||
- Success return float
|
||||
*/
|
||||
int leasingsEaseBounceInOut( lua_State *L ) {
|
||||
int leasingsEaseBounceInOut( lua_State* L ) {
|
||||
float t = luaL_checknumber( L, 1 );
|
||||
float b = luaL_checknumber( L, 2 );
|
||||
float c = luaL_checknumber( L, 3 );
|
||||
@@ -443,7 +443,7 @@ Ease elastic in
|
||||
|
||||
- Success return float
|
||||
*/
|
||||
int leasingsEaseElasticIn( lua_State *L ) {
|
||||
int leasingsEaseElasticIn( lua_State* L ) {
|
||||
float t = luaL_checknumber( L, 1 );
|
||||
float b = luaL_checknumber( L, 2 );
|
||||
float c = luaL_checknumber( L, 3 );
|
||||
@@ -461,7 +461,7 @@ Ease elastic out
|
||||
|
||||
- Success return float
|
||||
*/
|
||||
int leasingsEaseElasticOut( lua_State *L ) {
|
||||
int leasingsEaseElasticOut( lua_State* L ) {
|
||||
float t = luaL_checknumber( L, 1 );
|
||||
float b = luaL_checknumber( L, 2 );
|
||||
float c = luaL_checknumber( L, 3 );
|
||||
@@ -479,7 +479,7 @@ Ease elastic in out
|
||||
|
||||
- Success return float
|
||||
*/
|
||||
int leasingsEaseElasticInOut( lua_State *L ) {
|
||||
int leasingsEaseElasticInOut( lua_State* L ) {
|
||||
float t = luaL_checknumber( L, 1 );
|
||||
float b = luaL_checknumber( L, 2 );
|
||||
float c = luaL_checknumber( L, 3 );
|
||||
|
||||
6
src/gl.c
6
src/gl.c
@@ -14,7 +14,7 @@
|
||||
Copy a block of pixels from one framebuffer object to another.
|
||||
Use -1 RenderTexture for window framebuffer
|
||||
*/
|
||||
int lglBlitFramebuffer( lua_State *L ) {
|
||||
int lglBlitFramebuffer( lua_State* L ) {
|
||||
#if defined( PLATFORM_DESKTOP ) || defined( PLATFORM_DESKTOP_SDL )
|
||||
if ( !( lua_isuserdata( L, 1 ) || lua_isnil( L, 1 ) ) || !( lua_isuserdata( L, 2 ) || lua_isnil( L, 2 ) ) ) {
|
||||
TraceLog( state->logLevelInvalid, "%s", "Argument needs to be RenderTexture or nil" );
|
||||
@@ -30,7 +30,7 @@ int lglBlitFramebuffer( lua_State *L ) {
|
||||
glBindFramebuffer( GL_READ_FRAMEBUFFER, 0 );
|
||||
}
|
||||
else {
|
||||
RenderTexture *srcTex = uluaGetRenderTexture( L, 1 );
|
||||
RenderTexture* srcTex = uluaGetRenderTexture( L, 1 );
|
||||
glBindFramebuffer( GL_READ_FRAMEBUFFER, srcTex->id );
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ int lglBlitFramebuffer( lua_State *L ) {
|
||||
glBindFramebuffer( GL_DRAW_FRAMEBUFFER, 0 );
|
||||
}
|
||||
else {
|
||||
RenderTexture *dstTex = uluaGetRenderTexture( L, 2 );
|
||||
RenderTexture* dstTex = uluaGetRenderTexture( L, 2 );
|
||||
glBindFramebuffer( GL_DRAW_FRAMEBUFFER, dstTex->id );
|
||||
}
|
||||
|
||||
|
||||
50
src/lights.c
50
src/lights.c
@@ -18,12 +18,12 @@ Create a light and get shader locations
|
||||
|
||||
- Success return Light
|
||||
*/
|
||||
int llightsCreateLight( lua_State *L ) {
|
||||
int llightsCreateLight( lua_State* L ) {
|
||||
int type = luaL_checkinteger( L, 1 );
|
||||
Vector3 position = uluaGetVector3( L, 2 );
|
||||
Vector3 target = uluaGetVector3( L, 3 );
|
||||
Color color = uluaGetColor( L, 4 );
|
||||
Shader *shader = uluaGetShader( L, 5 );
|
||||
Shader* shader = uluaGetShader( L, 5 );
|
||||
|
||||
uluaPushLight( L, CreateLight( type, position, target, color, *shader ) );
|
||||
|
||||
@@ -35,9 +35,9 @@ int llightsCreateLight( lua_State *L ) {
|
||||
|
||||
Send light properties to shader
|
||||
*/
|
||||
int llightsUpdateLightValues( lua_State *L ) {
|
||||
Shader *shader = uluaGetShader( L, 1 );
|
||||
Light *light = uluaGetLight( L, 2 );
|
||||
int llightsUpdateLightValues( lua_State* L ) {
|
||||
Shader* shader = uluaGetShader( L, 1 );
|
||||
Light* light = uluaGetLight( L, 2 );
|
||||
|
||||
UpdateLightValues( *shader, *light );
|
||||
|
||||
@@ -49,8 +49,8 @@ int llightsUpdateLightValues( lua_State *L ) {
|
||||
|
||||
Set light type
|
||||
*/
|
||||
int llightsSetLightType( lua_State *L ) {
|
||||
Light *light = uluaGetLight( L, 1 );
|
||||
int llightsSetLightType( lua_State* L ) {
|
||||
Light* light = uluaGetLight( L, 1 );
|
||||
int type = luaL_checkinteger( L, 2 );
|
||||
|
||||
light->type = type;
|
||||
@@ -63,8 +63,8 @@ int llightsSetLightType( lua_State *L ) {
|
||||
|
||||
Set light position
|
||||
*/
|
||||
int llightsSetLightPosition( lua_State *L ) {
|
||||
Light *light = uluaGetLight( L, 1 );
|
||||
int llightsSetLightPosition( lua_State* L ) {
|
||||
Light* light = uluaGetLight( L, 1 );
|
||||
Vector3 position = uluaGetVector3( L, 2 );
|
||||
|
||||
light->position = position;
|
||||
@@ -77,8 +77,8 @@ int llightsSetLightPosition( lua_State *L ) {
|
||||
|
||||
Set light target
|
||||
*/
|
||||
int llightsSetLightTarget( lua_State *L ) {
|
||||
Light *light = uluaGetLight( L, 1 );
|
||||
int llightsSetLightTarget( lua_State* L ) {
|
||||
Light* light = uluaGetLight( L, 1 );
|
||||
Vector3 target = uluaGetVector3( L, 2 );
|
||||
|
||||
light->target = target;
|
||||
@@ -91,8 +91,8 @@ int llightsSetLightTarget( lua_State *L ) {
|
||||
|
||||
Set light color
|
||||
*/
|
||||
int llightsSetLightColor( lua_State *L ) {
|
||||
Light *light = uluaGetLight( L, 1 );
|
||||
int llightsSetLightColor( lua_State* L ) {
|
||||
Light* light = uluaGetLight( L, 1 );
|
||||
Color color = uluaGetColor( L, 2 );
|
||||
|
||||
light->color = color;
|
||||
@@ -105,8 +105,8 @@ int llightsSetLightColor( lua_State *L ) {
|
||||
|
||||
Set light enabled
|
||||
*/
|
||||
int llightsSetLightEnabled( lua_State *L ) {
|
||||
Light *light = uluaGetLight( L, 1 );
|
||||
int llightsSetLightEnabled( lua_State* L ) {
|
||||
Light* light = uluaGetLight( L, 1 );
|
||||
bool enabled = uluaGetBoolean( L, 2 );
|
||||
|
||||
light->enabled = enabled;
|
||||
@@ -121,8 +121,8 @@ Get light type
|
||||
|
||||
- Success return int
|
||||
*/
|
||||
int llightsGetLightType( lua_State *L ) {
|
||||
Light *light = uluaGetLight( L, 1 );
|
||||
int llightsGetLightType( lua_State* L ) {
|
||||
Light* light = uluaGetLight( L, 1 );
|
||||
|
||||
lua_pushinteger( L, light->type );
|
||||
|
||||
@@ -136,8 +136,8 @@ Get light position
|
||||
|
||||
- Success return Vector3
|
||||
*/
|
||||
int llightsGetLightPosition( lua_State *L ) {
|
||||
Light *light = uluaGetLight( L, 1 );
|
||||
int llightsGetLightPosition( lua_State* L ) {
|
||||
Light* light = uluaGetLight( L, 1 );
|
||||
|
||||
uluaPushVector3( L, light->position );
|
||||
|
||||
@@ -151,8 +151,8 @@ Get light target
|
||||
|
||||
- Success return Vector3
|
||||
*/
|
||||
int llightsGetLightTarget( lua_State *L ) {
|
||||
Light *light = uluaGetLight( L, 1 );
|
||||
int llightsGetLightTarget( lua_State* L ) {
|
||||
Light* light = uluaGetLight( L, 1 );
|
||||
|
||||
uluaPushVector3( L, light->target );
|
||||
|
||||
@@ -166,8 +166,8 @@ Get light color
|
||||
|
||||
- Success return Color
|
||||
*/
|
||||
int llightsGetLightColor( lua_State *L ) {
|
||||
Light *light = uluaGetLight( L, 1 );
|
||||
int llightsGetLightColor( lua_State* L ) {
|
||||
Light* light = uluaGetLight( L, 1 );
|
||||
|
||||
uluaPushColor( L, light->color );
|
||||
|
||||
@@ -181,8 +181,8 @@ Get light enabled
|
||||
|
||||
- Success return bool
|
||||
*/
|
||||
int llightsIsLightEnabled( lua_State *L ) {
|
||||
Light *light = uluaGetLight( L, 1 );
|
||||
int llightsIsLightEnabled( lua_State* L ) {
|
||||
Light* light = uluaGetLight( L, 1 );
|
||||
|
||||
lua_pushboolean( L, light->enabled );
|
||||
|
||||
|
||||
298
src/lua_core.c
298
src/lua_core.c
@@ -25,16 +25,16 @@
|
||||
/* Define types. */
|
||||
|
||||
/* Buffer. */
|
||||
static int gcBuffer( lua_State *L ) {
|
||||
static int gcBuffer( lua_State* L ) {
|
||||
if ( state->gcUnload ) {
|
||||
Buffer *buffer = luaL_checkudata( L, 1, "Buffer" );
|
||||
Buffer* buffer = luaL_checkudata( L, 1, "Buffer" );
|
||||
unloadBuffer( buffer );
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void defineBuffer() {
|
||||
lua_State *L = state->luaState;
|
||||
lua_State* L = state->luaState;
|
||||
|
||||
luaL_newmetatable( L, "Buffer" );
|
||||
lua_pushvalue( L, -1 );
|
||||
@@ -44,16 +44,16 @@ static void defineBuffer() {
|
||||
}
|
||||
|
||||
/* Image */
|
||||
static int gcImage( lua_State *L ) {
|
||||
static int gcImage( lua_State* L ) {
|
||||
if ( state->gcUnload ) {
|
||||
Image *image = luaL_checkudata( L, 1, "Image" );
|
||||
Image* image = luaL_checkudata( L, 1, "Image" );
|
||||
UnloadImage( *image );
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void defineImage() {
|
||||
lua_State *L = state->luaState;
|
||||
lua_State* L = state->luaState;
|
||||
|
||||
luaL_newmetatable( L, "Image" );
|
||||
lua_pushvalue( L, -1 );
|
||||
@@ -63,16 +63,16 @@ static void defineImage() {
|
||||
}
|
||||
|
||||
/* Texture */
|
||||
static int gcTexture( lua_State *L ) {
|
||||
static int gcTexture( lua_State* L ) {
|
||||
if ( state->gcUnload ) {
|
||||
Texture *texture = luaL_checkudata( L, 1, "Texture" );
|
||||
Texture* texture = luaL_checkudata( L, 1, "Texture" );
|
||||
UnloadTexture( *texture );
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void defineTexture() {
|
||||
lua_State *L = state->luaState;
|
||||
lua_State* L = state->luaState;
|
||||
|
||||
luaL_newmetatable( L, "Texture" );
|
||||
lua_pushvalue( L, -1 );
|
||||
@@ -82,16 +82,16 @@ static void defineTexture() {
|
||||
}
|
||||
|
||||
/* RenderRexture. */
|
||||
static int gcRenderTexture( lua_State *L ) {
|
||||
static int gcRenderTexture( lua_State* L ) {
|
||||
if ( state->gcUnload ) {
|
||||
RenderTexture *renderTexture = luaL_checkudata( L, 1, "RenderTexture" );
|
||||
RenderTexture* renderTexture = luaL_checkudata( L, 1, "RenderTexture" );
|
||||
UnloadRenderTexture( *renderTexture );
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void defineRenderTexture() {
|
||||
lua_State *L = state->luaState;
|
||||
lua_State* L = state->luaState;
|
||||
|
||||
luaL_newmetatable( L, "RenderTexture" );
|
||||
lua_pushvalue( L, -1 );
|
||||
@@ -102,7 +102,7 @@ static void defineRenderTexture() {
|
||||
|
||||
/* Camera2D. */
|
||||
static void defineCamera2D() {
|
||||
lua_State *L = state->luaState;
|
||||
lua_State* L = state->luaState;
|
||||
|
||||
luaL_newmetatable( L, "Camera2D" );
|
||||
lua_pushvalue( L, -1 );
|
||||
@@ -111,7 +111,7 @@ static void defineCamera2D() {
|
||||
|
||||
/* Camera3D. */
|
||||
static void defineCamera3D() {
|
||||
lua_State *L = state->luaState;
|
||||
lua_State* L = state->luaState;
|
||||
|
||||
luaL_newmetatable( L, "Camera3D" );
|
||||
lua_pushvalue( L, -1 );
|
||||
@@ -119,16 +119,16 @@ static void defineCamera3D() {
|
||||
}
|
||||
|
||||
/* Shader. */
|
||||
static int gcShader( lua_State *L ) {
|
||||
static int gcShader( lua_State* L ) {
|
||||
if ( state->gcUnload ) {
|
||||
Shader *shader = luaL_checkudata( L, 1, "Shader" );
|
||||
Shader* shader = luaL_checkudata( L, 1, "Shader" );
|
||||
UnloadShader( *shader );
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void defineShader() {
|
||||
lua_State *L = state->luaState;
|
||||
lua_State* L = state->luaState;
|
||||
|
||||
luaL_newmetatable( L, "Shader" );
|
||||
lua_pushvalue( L, -1 );
|
||||
@@ -138,16 +138,16 @@ static void defineShader() {
|
||||
}
|
||||
|
||||
/* Font. */
|
||||
static int gcFont( lua_State *L ) {
|
||||
static int gcFont( lua_State* L ) {
|
||||
if ( state->gcUnload ) {
|
||||
Font *font = luaL_checkudata( L, 1, "Font" );
|
||||
Font* font = luaL_checkudata( L, 1, "Font" );
|
||||
UnloadFont( *font );
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void defineFont() {
|
||||
lua_State *L = state->luaState;
|
||||
lua_State* L = state->luaState;
|
||||
|
||||
luaL_newmetatable( L, "Font" );
|
||||
lua_pushvalue( L, -1 );
|
||||
@@ -157,16 +157,16 @@ static void defineFont() {
|
||||
}
|
||||
|
||||
/* GlyphInfo. */
|
||||
static int gcGlyphInfo( lua_State *L ) {
|
||||
static int gcGlyphInfo( lua_State* L ) {
|
||||
if ( state->gcUnload ) {
|
||||
GlyphInfo *glyph = luaL_checkudata( L, 1, "GlyphInfo" );
|
||||
GlyphInfo* glyph = luaL_checkudata( L, 1, "GlyphInfo" );
|
||||
unloadGlyphInfo( glyph );
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void defineGlyphInfo() {
|
||||
lua_State *L = state->luaState;
|
||||
lua_State* L = state->luaState;
|
||||
|
||||
luaL_newmetatable( L, "GlyphInfo" );
|
||||
lua_pushvalue( L, -1 );
|
||||
@@ -176,16 +176,16 @@ static void defineGlyphInfo() {
|
||||
}
|
||||
|
||||
/* Wave. */
|
||||
static int gcWave( lua_State *L ) {
|
||||
static int gcWave( lua_State* L ) {
|
||||
if ( state->gcUnload ) {
|
||||
Wave *wave = luaL_checkudata( L, 1, "Wave" );
|
||||
Wave* wave = luaL_checkudata( L, 1, "Wave" );
|
||||
UnloadWave( *wave );
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void defineWave() {
|
||||
lua_State *L = state->luaState;
|
||||
lua_State* L = state->luaState;
|
||||
|
||||
luaL_newmetatable( L, "Wave" );
|
||||
lua_pushvalue( L, -1 );
|
||||
@@ -195,16 +195,16 @@ static void defineWave() {
|
||||
}
|
||||
|
||||
/* Sound. */
|
||||
static int gcSound( lua_State *L ) {
|
||||
static int gcSound( lua_State* L ) {
|
||||
if ( state->gcUnload ) {
|
||||
Sound *sound = luaL_checkudata( L, 1, "Sound" );
|
||||
Sound* sound = luaL_checkudata( L, 1, "Sound" );
|
||||
UnloadSound( *sound );
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void defineSound() {
|
||||
lua_State *L = state->luaState;
|
||||
lua_State* L = state->luaState;
|
||||
|
||||
luaL_newmetatable( L, "Sound" );
|
||||
lua_pushvalue( L, -1 );
|
||||
@@ -214,16 +214,16 @@ static void defineSound() {
|
||||
}
|
||||
|
||||
/* Music. */
|
||||
static int gcMusic( lua_State *L ) {
|
||||
static int gcMusic( lua_State* L ) {
|
||||
if ( state->gcUnload ) {
|
||||
Music *music = luaL_checkudata( L, 1, "Music" );
|
||||
Music* music = luaL_checkudata( L, 1, "Music" );
|
||||
UnloadMusicStream( *music );
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void defineMusic() {
|
||||
lua_State *L = state->luaState;
|
||||
lua_State* L = state->luaState;
|
||||
|
||||
luaL_newmetatable( L, "Music" );
|
||||
lua_pushvalue( L, -1 );
|
||||
@@ -234,7 +234,7 @@ static void defineMusic() {
|
||||
|
||||
/* Light. */
|
||||
static void defineLight() {
|
||||
lua_State *L = state->luaState;
|
||||
lua_State* L = state->luaState;
|
||||
|
||||
luaL_newmetatable( L, "Light" );
|
||||
lua_pushvalue( L, -1 );
|
||||
@@ -242,9 +242,9 @@ static void defineLight() {
|
||||
}
|
||||
|
||||
/* Material. */
|
||||
static int gcMaterial( lua_State *L ) {
|
||||
static int gcMaterial( lua_State* L ) {
|
||||
if ( state->gcUnload ) {
|
||||
Material *material = luaL_checkudata( L, 1, "Material" );
|
||||
Material* material = luaL_checkudata( L, 1, "Material" );
|
||||
/* Custom UnloadMaterial since we don't want to free Shaders or Textures. */
|
||||
unloadMaterial( material );
|
||||
}
|
||||
@@ -252,7 +252,7 @@ static int gcMaterial( lua_State *L ) {
|
||||
}
|
||||
|
||||
static void defineMaterial() {
|
||||
lua_State *L = state->luaState;
|
||||
lua_State* L = state->luaState;
|
||||
|
||||
luaL_newmetatable( L, "Material" );
|
||||
lua_pushvalue( L, -1 );
|
||||
@@ -262,16 +262,16 @@ static void defineMaterial() {
|
||||
}
|
||||
|
||||
/* Mesh. */
|
||||
static int gcMesh( lua_State *L ) {
|
||||
static int gcMesh( lua_State* L ) {
|
||||
if ( state->gcUnload ) {
|
||||
Mesh *mesh = luaL_checkudata( L, 1, "Mesh" );
|
||||
Mesh* mesh = luaL_checkudata( L, 1, "Mesh" );
|
||||
UnloadMesh( *mesh );
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void defineMesh() {
|
||||
lua_State *L = state->luaState;
|
||||
lua_State* L = state->luaState;
|
||||
|
||||
luaL_newmetatable( L, "Mesh" );
|
||||
lua_pushvalue( L, -1 );
|
||||
@@ -281,16 +281,16 @@ static void defineMesh() {
|
||||
}
|
||||
|
||||
/* Model. */
|
||||
static int gcModel( lua_State *L ) {
|
||||
static int gcModel( lua_State* L ) {
|
||||
if ( state->gcUnload ) {
|
||||
Model *model = luaL_checkudata( L, 1, "Model" );
|
||||
Model* model = luaL_checkudata( L, 1, "Model" );
|
||||
UnloadModel( *model );
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void defineModel() {
|
||||
lua_State *L = state->luaState;
|
||||
lua_State* L = state->luaState;
|
||||
|
||||
luaL_newmetatable( L, "Model" );
|
||||
lua_pushvalue( L, -1 );
|
||||
@@ -300,16 +300,16 @@ static void defineModel() {
|
||||
}
|
||||
|
||||
/* ModelAnimation. */
|
||||
static int gcModelAnimation( lua_State *L ) {
|
||||
static int gcModelAnimation( lua_State* L ) {
|
||||
if ( state->gcUnload ) {
|
||||
ModelAnimation *modelAnimation = luaL_checkudata( L, 1, "ModelAnimation" );
|
||||
ModelAnimation* modelAnimation = luaL_checkudata( L, 1, "ModelAnimation" );
|
||||
UnloadModelAnimation( *modelAnimation );
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void defineModelAnimation() {
|
||||
lua_State *L = state->luaState;
|
||||
lua_State* L = state->luaState;
|
||||
|
||||
luaL_newmetatable( L, "ModelAnimation" );
|
||||
lua_pushvalue( L, -1 );
|
||||
@@ -319,16 +319,16 @@ static void defineModelAnimation() {
|
||||
}
|
||||
|
||||
/* rlRenderBatch. */
|
||||
static int gcRLRenderBatch( lua_State *L ) {
|
||||
static int gcRLRenderBatch( lua_State* L ) {
|
||||
if ( state->gcUnload ) {
|
||||
rlRenderBatch *renderBatch = luaL_checkudata( L, 1, "rlRenderBatch" );
|
||||
rlRenderBatch* renderBatch = luaL_checkudata( L, 1, "rlRenderBatch" );
|
||||
rlUnloadRenderBatch( *renderBatch );
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void defineRLRenderBatch() {
|
||||
lua_State *L = state->luaState;
|
||||
lua_State* L = state->luaState;
|
||||
|
||||
luaL_newmetatable( L, "rlRenderBatch" );
|
||||
lua_pushvalue( L, -1 );
|
||||
@@ -339,38 +339,38 @@ static void defineRLRenderBatch() {
|
||||
|
||||
/* Assing globals. */
|
||||
|
||||
void assignGlobalInt( int value, const char *name ) {
|
||||
lua_State *L = state->luaState;
|
||||
void assignGlobalInt( int value, const char* name ) {
|
||||
lua_State* L = state->luaState;
|
||||
lua_pushinteger( L, value );
|
||||
lua_setfield( L, -2, name );
|
||||
}
|
||||
|
||||
void assignGlobalFloat( float value, const char *name ) {
|
||||
lua_State *L = state->luaState;
|
||||
void assignGlobalFloat( float value, const char* name ) {
|
||||
lua_State* L = state->luaState;
|
||||
lua_pushnumber( L, value );
|
||||
lua_setfield( L, -2, name );
|
||||
}
|
||||
|
||||
void assignGlobalDouble( double value, const char *name ) {
|
||||
lua_State *L = state->luaState;
|
||||
void assignGlobalDouble( double value, const char* name ) {
|
||||
lua_State* L = state->luaState;
|
||||
lua_pushnumber( L, value );
|
||||
lua_setfield( L, -2, name );
|
||||
}
|
||||
|
||||
void assignGlobalColor( Color color, const char *name ) {
|
||||
lua_State *L = state->luaState;
|
||||
void assignGlobalColor( Color color, const char* name ) {
|
||||
lua_State* L = state->luaState;
|
||||
uluaPushColor( L, color );
|
||||
lua_setfield( L, -2, name );
|
||||
}
|
||||
|
||||
void assingGlobalFunction( const char *name, int ( *functionPtr )( lua_State* ) ) {
|
||||
lua_State *L = state->luaState;
|
||||
void assingGlobalFunction( const char* name, int ( *functionPtr )( lua_State* ) ) {
|
||||
lua_State* L = state->luaState;
|
||||
lua_pushcfunction( L, functionPtr );
|
||||
lua_setfield( L, -2, name );
|
||||
}
|
||||
|
||||
static void defineGlobals() {
|
||||
lua_State *L = state->luaState;
|
||||
lua_State* L = state->luaState;
|
||||
|
||||
lua_newtable( L );
|
||||
lua_setglobal( L, "RL" );
|
||||
@@ -960,7 +960,7 @@ static void defineGlobals() {
|
||||
}
|
||||
|
||||
// Custom logging funtion.
|
||||
static void logCustom( int logLevel, const char *text, va_list args ) {
|
||||
static void logCustom( int logLevel, const char* text, va_list args ) {
|
||||
char string[ STRING_LEN ] = {'\0'};
|
||||
char msg[ STRING_LEN ] = {'\0'};
|
||||
|
||||
@@ -979,7 +979,7 @@ static void logCustom( int logLevel, const char *text, va_list args ) {
|
||||
printf( "%s\n", msg );
|
||||
|
||||
/* Call Lua log function if exists. */
|
||||
lua_State *L = state->luaState;
|
||||
lua_State* L = state->luaState;
|
||||
|
||||
/* Prevent calling lua log function when lua is already shutdown. */
|
||||
if ( L != NULL ) {
|
||||
@@ -1004,9 +1004,9 @@ static void logCustom( int logLevel, const char *text, va_list args ) {
|
||||
}
|
||||
}
|
||||
|
||||
bool luaInit( int argn, const char **argc ) {
|
||||
bool luaInit( int argn, const char** argc ) {
|
||||
state->luaState = luaL_newstate();
|
||||
lua_State *L = state->luaState;
|
||||
lua_State* L = state->luaState;
|
||||
|
||||
luaL_openlibs( L );
|
||||
|
||||
@@ -1057,7 +1057,7 @@ bool luaInit( int argn, const char **argc ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
int luaTraceback( lua_State *L ) {
|
||||
int luaTraceback( lua_State* L ) {
|
||||
lua_getglobal( L, "debug" );
|
||||
|
||||
if ( !lua_istable( L, -1 ) ) {
|
||||
@@ -1078,7 +1078,7 @@ int luaTraceback( lua_State *L ) {
|
||||
}
|
||||
|
||||
bool luaCallMain() {
|
||||
lua_State *L = state->luaState;
|
||||
lua_State* L = state->luaState;
|
||||
|
||||
char path[ STRING_LEN ] = { '\0' };
|
||||
|
||||
@@ -1132,7 +1132,7 @@ void luaCallUpdate() {
|
||||
#if defined PLATFORM_DESKTOP_SDL && defined LUA_EVENTS
|
||||
platformSendEvents();
|
||||
#endif
|
||||
lua_State *L = state->luaState;
|
||||
lua_State* L = state->luaState;
|
||||
|
||||
lua_pushcfunction( L, luaTraceback );
|
||||
int tracebackidx = lua_gettop(L);
|
||||
@@ -1154,7 +1154,7 @@ void luaCallUpdate() {
|
||||
}
|
||||
|
||||
void luaCallDraw() {
|
||||
lua_State *L = state->luaState;
|
||||
lua_State* L = state->luaState;
|
||||
lua_pushcfunction( L, luaTraceback );
|
||||
int tracebackidx = lua_gettop(L);
|
||||
|
||||
@@ -1175,7 +1175,7 @@ void luaCallDraw() {
|
||||
}
|
||||
|
||||
void luaCallExit() {
|
||||
lua_State *L = state->luaState;
|
||||
lua_State* L = state->luaState;
|
||||
lua_pushcfunction( L, luaTraceback );
|
||||
int tracebackidx = lua_gettop(L);
|
||||
|
||||
@@ -1193,7 +1193,7 @@ void luaCallExit() {
|
||||
}
|
||||
|
||||
void luaRegister() {
|
||||
lua_State *L = state->luaState;
|
||||
lua_State* L = state->luaState;
|
||||
lua_getglobal( L, "RL" );
|
||||
|
||||
/* Core. */
|
||||
@@ -2226,13 +2226,13 @@ void luaRegister() {
|
||||
|
||||
/* Lua util functions. */
|
||||
|
||||
bool uluaGetBoolean( lua_State *L, int index ) {
|
||||
bool uluaGetBoolean( lua_State* L, int index ) {
|
||||
luaL_checktype( L, index, LUA_TBOOLEAN );
|
||||
|
||||
return lua_toboolean( L, index );
|
||||
}
|
||||
|
||||
Color uluaGetColor( lua_State *L, int index ) {
|
||||
Color uluaGetColor( lua_State* L, int index ) {
|
||||
luaL_checktype( L, index, LUA_TTABLE );
|
||||
Color color = { 0, 0, 0, 255 };
|
||||
|
||||
@@ -2280,7 +2280,7 @@ Color uluaGetColor( lua_State *L, int index ) {
|
||||
return color;
|
||||
}
|
||||
|
||||
Vector2 uluaGetVector2( lua_State *L, int index ) {
|
||||
Vector2 uluaGetVector2( lua_State* L, int index ) {
|
||||
luaL_checktype( L, index, LUA_TTABLE );
|
||||
Vector2 vector = { 0.0f, 0.0f };
|
||||
|
||||
@@ -2316,7 +2316,7 @@ Vector2 uluaGetVector2( lua_State *L, int index ) {
|
||||
return vector;
|
||||
}
|
||||
|
||||
Vector3 uluaGetVector3( lua_State *L, int index ) {
|
||||
Vector3 uluaGetVector3( lua_State* L, int index ) {
|
||||
luaL_checktype( L, index, LUA_TTABLE );
|
||||
Vector3 vector = { 0.0f, 0.0f, 0.0f };
|
||||
|
||||
@@ -2358,7 +2358,7 @@ Vector3 uluaGetVector3( lua_State *L, int index ) {
|
||||
return vector;
|
||||
}
|
||||
|
||||
Vector4 uluaGetVector4( lua_State *L, int index ) {
|
||||
Vector4 uluaGetVector4( lua_State* L, int index ) {
|
||||
luaL_checktype( L, index, LUA_TTABLE );
|
||||
Vector4 vector = { 0.0f, 0.0f, 0.0f, 0.0f };
|
||||
|
||||
@@ -2406,7 +2406,7 @@ Vector4 uluaGetVector4( lua_State *L, int index ) {
|
||||
return vector;
|
||||
}
|
||||
|
||||
Rectangle uluaGetRectangle( lua_State *L, int index ) {
|
||||
Rectangle uluaGetRectangle( lua_State* L, int index ) {
|
||||
luaL_checktype( L, index, LUA_TTABLE );
|
||||
Rectangle rect = { 0.0f, 0.0f, 0.0f, 0.0f };
|
||||
|
||||
@@ -2454,7 +2454,7 @@ Rectangle uluaGetRectangle( lua_State *L, int index ) {
|
||||
return rect;
|
||||
}
|
||||
|
||||
Quaternion uluaGetQuaternion( lua_State *L, int index ) {
|
||||
Quaternion uluaGetQuaternion( lua_State* L, int index ) {
|
||||
luaL_checktype( L, index, LUA_TTABLE );
|
||||
Quaternion quaternion = { 0.0f, 0.0f, 0.0f, 0.0f };
|
||||
|
||||
@@ -2502,7 +2502,7 @@ Quaternion uluaGetQuaternion( lua_State *L, int index ) {
|
||||
return quaternion;
|
||||
}
|
||||
|
||||
Matrix uluaGetMatrix( lua_State *L, int index ) {
|
||||
Matrix uluaGetMatrix( lua_State* L, int index ) {
|
||||
luaL_checktype( L, index, LUA_TTABLE );
|
||||
Matrix matrix = { 0.0f };
|
||||
float m[4][4];
|
||||
@@ -2547,7 +2547,7 @@ Matrix uluaGetMatrix( lua_State *L, int index ) {
|
||||
return matrix;
|
||||
}
|
||||
|
||||
BoundingBox uluaGetBoundingBox( lua_State *L, int index ) {
|
||||
BoundingBox uluaGetBoundingBox( lua_State* L, int index ) {
|
||||
luaL_checktype( L, index, LUA_TTABLE );
|
||||
BoundingBox box = { .min = { 0.0, 0.0, 0.0 }, .max = { 0.0, 0.0, 0.0 } };
|
||||
|
||||
@@ -2583,7 +2583,7 @@ BoundingBox uluaGetBoundingBox( lua_State *L, int index ) {
|
||||
return box;
|
||||
}
|
||||
|
||||
Ray uluaGetRay( lua_State *L, int index ) {
|
||||
Ray uluaGetRay( lua_State* L, int index ) {
|
||||
luaL_checktype( L, index, LUA_TTABLE );
|
||||
Ray ray = { .position = { 0.0, 0.0, 0.0 }, .direction = { 0.0, 0.0, 0.0 } };
|
||||
|
||||
@@ -2619,7 +2619,7 @@ Ray uluaGetRay( lua_State *L, int index ) {
|
||||
return ray;
|
||||
}
|
||||
|
||||
NPatchInfo uluaGetNPatchInfo( lua_State *L, int index ) {
|
||||
NPatchInfo uluaGetNPatchInfo( lua_State* L, int index ) {
|
||||
luaL_checktype( L, index, LUA_TTABLE );
|
||||
NPatchInfo npatch = { .source = { 0.0, 0.0, 0.0, 0.0 }, .left = 0, .top = 0, .right = 0, .bottom = 0, .layout = NPATCH_NINE_PATCH };
|
||||
|
||||
@@ -2678,7 +2678,7 @@ NPatchInfo uluaGetNPatchInfo( lua_State *L, int index ) {
|
||||
return npatch;
|
||||
}
|
||||
|
||||
BoneInfo uluaGetBoneInfo( lua_State *L, int index ) {
|
||||
BoneInfo uluaGetBoneInfo( lua_State* L, int index ) {
|
||||
luaL_checktype( L, index, LUA_TTABLE );
|
||||
BoneInfo bone = { 0 };
|
||||
|
||||
@@ -2715,7 +2715,7 @@ BoneInfo uluaGetBoneInfo( lua_State *L, int index ) {
|
||||
return bone;
|
||||
}
|
||||
|
||||
Transform uluaGetTransform( lua_State *L, int index ) {
|
||||
Transform uluaGetTransform( lua_State* L, int index ) {
|
||||
luaL_checktype( L, index, LUA_TTABLE );
|
||||
Transform transform = { 0 };
|
||||
|
||||
@@ -2758,126 +2758,126 @@ Transform uluaGetTransform( lua_State *L, int index ) {
|
||||
return transform;
|
||||
}
|
||||
|
||||
Buffer* uluaGetBuffer( lua_State *L, int index ) {
|
||||
Buffer* uluaGetBuffer( lua_State* L, int index ) {
|
||||
if ( lua_islightuserdata( L, index ) ) {
|
||||
return (Buffer*)lua_touserdata( L, index );
|
||||
}
|
||||
return luaL_checkudata( L, index, "Buffer" );
|
||||
}
|
||||
|
||||
Image* uluaGetImage( lua_State *L, int index ) {
|
||||
Image* uluaGetImage( lua_State* L, int index ) {
|
||||
if ( lua_islightuserdata( L, index ) ) {
|
||||
return (Image*)lua_touserdata( L, index );
|
||||
}
|
||||
return luaL_checkudata( L, index, "Image" );
|
||||
}
|
||||
|
||||
Texture* uluaGetTexture( lua_State *L, int index ) {
|
||||
Texture* uluaGetTexture( lua_State* L, int index ) {
|
||||
if ( lua_islightuserdata( L, index ) ) {
|
||||
return (Texture*)lua_touserdata( L, index );
|
||||
}
|
||||
return luaL_checkudata( L, index, "Texture" );
|
||||
}
|
||||
|
||||
RenderTexture* uluaGetRenderTexture( lua_State *L, int index ) {
|
||||
RenderTexture* uluaGetRenderTexture( lua_State* L, int index ) {
|
||||
if ( lua_islightuserdata( L, index ) ) {
|
||||
return (RenderTexture*)lua_touserdata( L, index );
|
||||
}
|
||||
return luaL_checkudata( L, index, "RenderTexture" );
|
||||
}
|
||||
|
||||
Shader* uluaGetShader( lua_State *L, int index ) {
|
||||
Shader* uluaGetShader( lua_State* L, int index ) {
|
||||
if ( lua_islightuserdata( L, index ) ) {
|
||||
return (Shader*)lua_touserdata( L, index );
|
||||
}
|
||||
return luaL_checkudata( L, index, "Shader" );
|
||||
}
|
||||
|
||||
Mesh* uluaGetMesh( lua_State *L, int index ) {
|
||||
Mesh* uluaGetMesh( lua_State* L, int index ) {
|
||||
if ( lua_islightuserdata( L, index ) ) {
|
||||
return (Mesh*)lua_touserdata( L, index );
|
||||
}
|
||||
return luaL_checkudata( L, index, "Mesh" );
|
||||
}
|
||||
|
||||
Camera2D* uluaGetCamera2D( lua_State *L, int index ) {
|
||||
Camera2D* uluaGetCamera2D( lua_State* L, int index ) {
|
||||
if ( lua_islightuserdata( L, index ) ) {
|
||||
return (Camera2D*)lua_touserdata( L, index );
|
||||
}
|
||||
return luaL_checkudata( L, index, "Camera2D" );
|
||||
}
|
||||
|
||||
Camera3D* uluaGetCamera3D( lua_State *L, int index ) {
|
||||
Camera3D* uluaGetCamera3D( lua_State* L, int index ) {
|
||||
if ( lua_islightuserdata( L, index ) ) {
|
||||
return (Camera3D*)lua_touserdata( L, index );
|
||||
}
|
||||
return luaL_checkudata( L, index, "Camera3D" );
|
||||
}
|
||||
|
||||
Font* uluaGetFont( lua_State *L, int index ) {
|
||||
Font* uluaGetFont( lua_State* L, int index ) {
|
||||
if ( lua_islightuserdata( L, index ) ) {
|
||||
return (Font*)lua_touserdata( L, index );
|
||||
}
|
||||
return luaL_checkudata( L, index, "Font" );
|
||||
}
|
||||
|
||||
GlyphInfo* uluaGetGlyphInfo( lua_State *L, int index ) {
|
||||
GlyphInfo* uluaGetGlyphInfo( lua_State* L, int index ) {
|
||||
if ( lua_islightuserdata( L, index ) ) {
|
||||
return (GlyphInfo*)lua_touserdata( L, index );
|
||||
}
|
||||
return luaL_checkudata( L, index, "GlyphInfo" );
|
||||
}
|
||||
|
||||
Wave* uluaGetWave( lua_State *L, int index ) {
|
||||
Wave* uluaGetWave( lua_State* L, int index ) {
|
||||
if ( lua_islightuserdata( L, index ) ) {
|
||||
return (Wave*)lua_touserdata( L, index );
|
||||
}
|
||||
return luaL_checkudata( L, index, "Wave" );
|
||||
}
|
||||
|
||||
Sound* uluaGetSound( lua_State *L, int index ) {
|
||||
Sound* uluaGetSound( lua_State* L, int index ) {
|
||||
if ( lua_islightuserdata( L, index ) ) {
|
||||
return (Sound*)lua_touserdata( L, index );
|
||||
}
|
||||
return luaL_checkudata( L, index, "Sound" );
|
||||
}
|
||||
|
||||
Music* uluaGetMusic( lua_State *L, int index ) {
|
||||
Music* uluaGetMusic( lua_State* L, int index ) {
|
||||
if ( lua_islightuserdata( L, index ) ) {
|
||||
return (Music*)lua_touserdata( L, index );
|
||||
}
|
||||
return luaL_checkudata( L, index, "Music" );
|
||||
}
|
||||
|
||||
Light* uluaGetLight( lua_State *L, int index ) {
|
||||
Light* uluaGetLight( lua_State* L, int index ) {
|
||||
if ( lua_islightuserdata( L, index ) ) {
|
||||
return (Light*)lua_touserdata( L, index );
|
||||
}
|
||||
return luaL_checkudata( L, index, "Light" );
|
||||
}
|
||||
|
||||
Material* uluaGetMaterial( lua_State *L, int index ) {
|
||||
Material* uluaGetMaterial( lua_State* L, int index ) {
|
||||
if ( lua_islightuserdata( L, index ) ) {
|
||||
return (Material*)lua_touserdata( L, index );
|
||||
}
|
||||
return luaL_checkudata( L, index, "Material" );
|
||||
}
|
||||
|
||||
Model* uluaGetModel( lua_State *L, int index ) {
|
||||
Model* uluaGetModel( lua_State* L, int index ) {
|
||||
if ( lua_islightuserdata( L, index ) ) {
|
||||
return (Model*)lua_touserdata( L, index );
|
||||
}
|
||||
return luaL_checkudata( L, index, "Model" );
|
||||
}
|
||||
|
||||
ModelAnimation* uluaGetModelAnimation( lua_State *L, int index ) {
|
||||
ModelAnimation* uluaGetModelAnimation( lua_State* L, int index ) {
|
||||
if ( lua_islightuserdata( L, index ) ) {
|
||||
return (ModelAnimation*)lua_touserdata( L, index );
|
||||
}
|
||||
return luaL_checkudata( L, index, "ModelAnimation" );
|
||||
}
|
||||
|
||||
rlRenderBatch* uluaGetRLRenderBatch( lua_State *L, int index ) {
|
||||
rlRenderBatch* uluaGetRLRenderBatch( lua_State* L, int index ) {
|
||||
if ( lua_islightuserdata( L, index ) ) {
|
||||
return (rlRenderBatch*)lua_touserdata( L, index );
|
||||
}
|
||||
@@ -2886,7 +2886,7 @@ rlRenderBatch* uluaGetRLRenderBatch( lua_State *L, int index ) {
|
||||
|
||||
/* Push types. */
|
||||
|
||||
void uluaPushColor( lua_State *L, Color color ) {
|
||||
void uluaPushColor( lua_State* L, Color color ) {
|
||||
lua_createtable( L, 3, 0 );
|
||||
lua_pushnumber( L, color.r );
|
||||
lua_rawseti( L, -2, 1 );
|
||||
@@ -2898,7 +2898,7 @@ void uluaPushColor( lua_State *L, Color color ) {
|
||||
lua_rawseti( L, -2, 4 );
|
||||
}
|
||||
|
||||
void uluaPushVector2( lua_State *L, Vector2 vector ) {
|
||||
void uluaPushVector2( lua_State* L, Vector2 vector ) {
|
||||
lua_createtable( L, 2, 0 );
|
||||
lua_pushnumber( L, vector.x );
|
||||
lua_rawseti( L, -2, 1 );
|
||||
@@ -2906,7 +2906,7 @@ void uluaPushVector2( lua_State *L, Vector2 vector ) {
|
||||
lua_rawseti( L, -2, 2 );
|
||||
}
|
||||
|
||||
void uluaPushVector3( lua_State *L, Vector3 vector ) {
|
||||
void uluaPushVector3( lua_State* L, Vector3 vector ) {
|
||||
lua_createtable( L, 3, 0 );
|
||||
lua_pushnumber( L, vector.x );
|
||||
lua_rawseti( L, -2, 1 );
|
||||
@@ -2916,7 +2916,7 @@ void uluaPushVector3( lua_State *L, Vector3 vector ) {
|
||||
lua_rawseti( L, -2, 3 );
|
||||
}
|
||||
|
||||
void uluaPushVector4( lua_State *L, Vector4 vector ) {
|
||||
void uluaPushVector4( lua_State* L, Vector4 vector ) {
|
||||
lua_createtable( L, 4, 0 );
|
||||
lua_pushnumber( L, vector.x );
|
||||
lua_rawseti( L, -2, 1 );
|
||||
@@ -2928,7 +2928,7 @@ void uluaPushVector4( lua_State *L, Vector4 vector ) {
|
||||
lua_rawseti( L, -2, 4 );
|
||||
}
|
||||
|
||||
void uluaPushRectangle( lua_State *L, Rectangle rect ) {
|
||||
void uluaPushRectangle( lua_State* L, Rectangle rect ) {
|
||||
lua_createtable( L, 4, 0 );
|
||||
lua_pushnumber( L, rect.x );
|
||||
lua_rawseti( L, -2, 1 );
|
||||
@@ -2940,7 +2940,7 @@ void uluaPushRectangle( lua_State *L, Rectangle rect ) {
|
||||
lua_rawseti( L, -2, 4 );
|
||||
}
|
||||
|
||||
void uluaPushQuaternion( lua_State *L, Quaternion quaternion ) {
|
||||
void uluaPushQuaternion( lua_State* L, Quaternion quaternion ) {
|
||||
lua_createtable( L, 4, 0 );
|
||||
lua_pushnumber( L, quaternion.x );
|
||||
lua_rawseti( L, -2, 1 );
|
||||
@@ -2952,7 +2952,7 @@ void uluaPushQuaternion( lua_State *L, Quaternion quaternion ) {
|
||||
lua_rawseti( L, -2, 4 );
|
||||
}
|
||||
|
||||
void uluaPushMatrix( lua_State *L, Matrix matrix ) {
|
||||
void uluaPushMatrix( lua_State* L, Matrix matrix ) {
|
||||
lua_createtable( L, 4, 0 );
|
||||
|
||||
lua_createtable( L, 4, 0 );
|
||||
@@ -3000,7 +3000,7 @@ void uluaPushMatrix( lua_State *L, Matrix matrix ) {
|
||||
lua_rawseti( L, -2, 4 );
|
||||
}
|
||||
|
||||
void uluaPushRay( lua_State *L, Ray ray ) {
|
||||
void uluaPushRay( lua_State* L, Ray ray ) {
|
||||
lua_createtable( L, 2, 0 );
|
||||
|
||||
lua_createtable( L, 3, 0 );
|
||||
@@ -3022,7 +3022,7 @@ void uluaPushRay( lua_State *L, Ray ray ) {
|
||||
lua_rawseti( L, -2, 2 );
|
||||
}
|
||||
|
||||
void uluaPushRayCollision( lua_State *L, RayCollision rayCol ) {
|
||||
void uluaPushRayCollision( lua_State* L, RayCollision rayCol ) {
|
||||
lua_createtable( L, 4, 0 );
|
||||
lua_pushboolean( L, rayCol.hit );
|
||||
lua_setfield( L, -2, "hit" );
|
||||
@@ -3034,7 +3034,7 @@ void uluaPushRayCollision( lua_State *L, RayCollision rayCol ) {
|
||||
lua_setfield( L, -2, "normal" );
|
||||
}
|
||||
|
||||
void uluaPushBoundingBox( lua_State *L, BoundingBox box ) {
|
||||
void uluaPushBoundingBox( lua_State* L, BoundingBox box ) {
|
||||
lua_createtable( L, 2, 0 );
|
||||
|
||||
lua_createtable( L, 3, 0 );
|
||||
@@ -3056,7 +3056,7 @@ void uluaPushBoundingBox( lua_State *L, BoundingBox box ) {
|
||||
lua_rawseti( L, -2, 2 );
|
||||
}
|
||||
|
||||
void uluaPushBoneInfo( lua_State *L, BoneInfo boneInfo ) {
|
||||
void uluaPushBoneInfo( lua_State* L, BoneInfo boneInfo ) {
|
||||
lua_createtable( L, 2, 0 );
|
||||
lua_pushstring( L, boneInfo.name );
|
||||
lua_setfield( L, -2, "name" );
|
||||
@@ -3064,7 +3064,7 @@ void uluaPushBoneInfo( lua_State *L, BoneInfo boneInfo ) {
|
||||
lua_setfield( L, -2, "parent" );
|
||||
}
|
||||
|
||||
void uluaPushTransform( lua_State *L, Transform transform ) {
|
||||
void uluaPushTransform( lua_State* L, Transform transform ) {
|
||||
lua_createtable( L, 3, 0 );
|
||||
uluaPushVector3( L, transform.translation );
|
||||
lua_setfield( L, -2, "name" );
|
||||
@@ -3074,118 +3074,118 @@ void uluaPushTransform( lua_State *L, Transform transform ) {
|
||||
lua_setfield( L, -2, "scale" );
|
||||
}
|
||||
|
||||
void uluaPushBuffer( lua_State *L, Buffer buffer ) {
|
||||
void uluaPushBuffer( lua_State* L, Buffer buffer ) {
|
||||
if ( buffer.size == 0 ) {
|
||||
buffer.data = NULL;
|
||||
}
|
||||
Buffer *bufferP = lua_newuserdata( L, sizeof( Buffer ) );
|
||||
Buffer* bufferP = lua_newuserdata( L, sizeof( Buffer ) );
|
||||
*bufferP = buffer;
|
||||
luaL_setmetatable( L, "Buffer" );
|
||||
}
|
||||
|
||||
void uluaPushImage( lua_State *L, Image image ) {
|
||||
Image *imageP = lua_newuserdata( L, sizeof( Image ) );
|
||||
void uluaPushImage( lua_State* L, Image image ) {
|
||||
Image* imageP = lua_newuserdata( L, sizeof( Image ) );
|
||||
*imageP = image;
|
||||
luaL_setmetatable( L, "Image" );
|
||||
}
|
||||
|
||||
void uluaPushTexture( lua_State *L, Texture texture ) {
|
||||
Texture *textureP = lua_newuserdata( L, sizeof( Texture ) );
|
||||
void uluaPushTexture( lua_State* L, Texture texture ) {
|
||||
Texture* textureP = lua_newuserdata( L, sizeof( Texture ) );
|
||||
*textureP = texture;
|
||||
luaL_setmetatable( L, "Texture" );
|
||||
}
|
||||
|
||||
void uluaPushRenderTexture( lua_State *L, RenderTexture renderTexture ) {
|
||||
RenderTexture *renderTextureP = lua_newuserdata( L, sizeof( RenderTexture ) );
|
||||
void uluaPushRenderTexture( lua_State* L, RenderTexture renderTexture ) {
|
||||
RenderTexture* renderTextureP = lua_newuserdata( L, sizeof( RenderTexture ) );
|
||||
*renderTextureP = renderTexture;
|
||||
luaL_setmetatable( L, "RenderTexture" );
|
||||
}
|
||||
|
||||
void uluaPushCamera2D( lua_State *L, Camera2D camera ) {
|
||||
Camera2D *cameraP = lua_newuserdata( L, sizeof( Camera2D ) );
|
||||
void uluaPushCamera2D( lua_State* L, Camera2D camera ) {
|
||||
Camera2D* cameraP = lua_newuserdata( L, sizeof( Camera2D ) );
|
||||
*cameraP = camera;
|
||||
luaL_setmetatable( L, "Camera2D" );
|
||||
}
|
||||
|
||||
void uluaPushCamera3D( lua_State *L, Camera3D camera ) {
|
||||
Camera3D *cameraP = lua_newuserdata( L, sizeof( Camera3D ) );
|
||||
void uluaPushCamera3D( lua_State* L, Camera3D camera ) {
|
||||
Camera3D* cameraP = lua_newuserdata( L, sizeof( Camera3D ) );
|
||||
*cameraP = camera;
|
||||
luaL_setmetatable( L, "Camera3D" );
|
||||
}
|
||||
|
||||
void uluaPushShader( lua_State *L, Shader shader ) {
|
||||
Shader *shaderP = lua_newuserdata( L, sizeof( Shader ) );
|
||||
void uluaPushShader( lua_State* L, Shader shader ) {
|
||||
Shader* shaderP = lua_newuserdata( L, sizeof( Shader ) );
|
||||
*shaderP = shader;
|
||||
luaL_setmetatable( L, "Shader" );
|
||||
}
|
||||
|
||||
void uluaPushFont( lua_State *L, Font font ) {
|
||||
Font *fontP = lua_newuserdata( L, sizeof( Font ) );
|
||||
void uluaPushFont( lua_State* L, Font font ) {
|
||||
Font* fontP = lua_newuserdata( L, sizeof( Font ) );
|
||||
*fontP = font;
|
||||
luaL_setmetatable( L, "Font" );
|
||||
}
|
||||
|
||||
void uluaPushGlyphInfo( lua_State *L, GlyphInfo glyph ) {
|
||||
GlyphInfo *glyphP = lua_newuserdata( L, sizeof( GlyphInfo ) );
|
||||
void uluaPushGlyphInfo( lua_State* L, GlyphInfo glyph ) {
|
||||
GlyphInfo* glyphP = lua_newuserdata( L, sizeof( GlyphInfo ) );
|
||||
*glyphP = glyph;
|
||||
luaL_setmetatable( L, "GlyphInfo" );
|
||||
}
|
||||
|
||||
void uluaPushWave( lua_State *L, Wave wave ) {
|
||||
Wave *waveP = lua_newuserdata( L, sizeof( Wave ) );
|
||||
void uluaPushWave( lua_State* L, Wave wave ) {
|
||||
Wave* waveP = lua_newuserdata( L, sizeof( Wave ) );
|
||||
*waveP = wave;
|
||||
luaL_setmetatable( L, "Wave" );
|
||||
}
|
||||
|
||||
void uluaPushSound( lua_State *L, Sound sound ) {
|
||||
Sound *soundP = lua_newuserdata( L, sizeof( Sound ) );
|
||||
void uluaPushSound( lua_State* L, Sound sound ) {
|
||||
Sound* soundP = lua_newuserdata( L, sizeof( Sound ) );
|
||||
*soundP = sound;
|
||||
luaL_setmetatable( L, "Sound" );
|
||||
}
|
||||
|
||||
void uluaPushMusic( lua_State *L, Music music ) {
|
||||
Music *musicP = lua_newuserdata( L, sizeof( Music ) );
|
||||
void uluaPushMusic( lua_State* L, Music music ) {
|
||||
Music* musicP = lua_newuserdata( L, sizeof( Music ) );
|
||||
*musicP = music;
|
||||
luaL_setmetatable( L, "Music" );
|
||||
}
|
||||
|
||||
void uluaPushLight( lua_State *L, Light light ) {
|
||||
Light *lightP = lua_newuserdata( L, sizeof( Light ) );
|
||||
void uluaPushLight( lua_State* L, Light light ) {
|
||||
Light* lightP = lua_newuserdata( L, sizeof( Light ) );
|
||||
*lightP = light;
|
||||
luaL_setmetatable( L, "Light" );
|
||||
}
|
||||
|
||||
void uluaPushMaterial( lua_State *L, Material material ) {
|
||||
Material *materialP = lua_newuserdata( L, sizeof( Material ) );
|
||||
void uluaPushMaterial( lua_State* L, Material material ) {
|
||||
Material* materialP = lua_newuserdata( L, sizeof( Material ) );
|
||||
*materialP = material;
|
||||
luaL_setmetatable( L, "Material" );
|
||||
}
|
||||
|
||||
void uluaPushMesh( lua_State *L, Mesh mesh ) {
|
||||
Mesh *meshP = lua_newuserdata( L, sizeof( Mesh ) );
|
||||
void uluaPushMesh( lua_State* L, Mesh mesh ) {
|
||||
Mesh* meshP = lua_newuserdata( L, sizeof( Mesh ) );
|
||||
*meshP = mesh;
|
||||
luaL_setmetatable( L, "Mesh" );
|
||||
}
|
||||
|
||||
void uluaPushModel( lua_State *L, Model model ) {
|
||||
Model *modelP = lua_newuserdata( L, sizeof( Model ) );
|
||||
void uluaPushModel( lua_State* L, Model model ) {
|
||||
Model* modelP = lua_newuserdata( L, sizeof( Model ) );
|
||||
*modelP = model;
|
||||
luaL_setmetatable( L, "Model" );
|
||||
}
|
||||
|
||||
void uluaPushModelAnimation( lua_State *L, ModelAnimation modelAnimation ) {
|
||||
ModelAnimation *modelAnimationP = lua_newuserdata( L, sizeof( ModelAnimation ) );
|
||||
void uluaPushModelAnimation( lua_State* L, ModelAnimation modelAnimation ) {
|
||||
ModelAnimation* modelAnimationP = lua_newuserdata( L, sizeof( ModelAnimation ) );
|
||||
*modelAnimationP = modelAnimation;
|
||||
luaL_setmetatable( L, "ModelAnimation" );
|
||||
}
|
||||
|
||||
void uluaPushRLRenderBatch( lua_State *L, rlRenderBatch renderBatch ) {
|
||||
rlRenderBatch *renderBatchP = lua_newuserdata( L, sizeof( rlRenderBatch ) );
|
||||
void uluaPushRLRenderBatch( lua_State* L, rlRenderBatch renderBatch ) {
|
||||
rlRenderBatch* renderBatchP = lua_newuserdata( L, sizeof( rlRenderBatch ) );
|
||||
*renderBatchP = renderBatch;
|
||||
luaL_setmetatable( L, "rlRenderBatch" );
|
||||
}
|
||||
|
||||
int uluaGetTableLen( lua_State *L, int index ) {
|
||||
int uluaGetTableLen( lua_State* L, int index ) {
|
||||
luaL_checktype( L, index, LUA_TTABLE );
|
||||
int t = index, i = 0;
|
||||
lua_pushnil( L );
|
||||
|
||||
@@ -19,7 +19,7 @@ inline static void printVersion() {
|
||||
#endif
|
||||
}
|
||||
|
||||
int main( int argn, const char **argc ) {
|
||||
int main( int argn, const char** argc ) {
|
||||
char exePath[ STRING_LEN ] = { '\0' };
|
||||
bool interpret_mode = false;
|
||||
|
||||
@@ -50,7 +50,7 @@ int main( int argn, const char **argc ) {
|
||||
if ( interpret_mode ) {
|
||||
stateInitInterpret( argn, argc );
|
||||
|
||||
lua_State *L = state->luaState;
|
||||
lua_State* L = state->luaState;
|
||||
lua_pushcfunction( L, luaTraceback );
|
||||
int tracebackidx = lua_gettop( L );
|
||||
|
||||
|
||||
362
src/models.c
362
src/models.c
File diff suppressed because it is too large
Load Diff
@@ -4,7 +4,7 @@
|
||||
#include "platforms/core_desktop.h"
|
||||
|
||||
void platformDefineGlobals() {
|
||||
lua_State *L = state->luaState;
|
||||
lua_State* L = state->luaState;
|
||||
|
||||
lua_getglobal( L, "RL" );
|
||||
/*DOC_DEFINES_START*/
|
||||
@@ -55,11 +55,11 @@ this function returns nil but does not emit an error.
|
||||
|
||||
- Success return string or nil
|
||||
*/
|
||||
int lcoreGetKeyName( lua_State *L ) {
|
||||
int lcoreGetKeyName( lua_State* L ) {
|
||||
int key = luaL_checkinteger( L, 1 );
|
||||
int scancode = luaL_checkinteger( L, 2 );
|
||||
|
||||
const char *keyName = glfwGetKeyName( key, scancode );
|
||||
const char* keyName = glfwGetKeyName( key, scancode );
|
||||
|
||||
if ( keyName != NULL ) {
|
||||
lua_pushstring( L, keyName );
|
||||
@@ -79,7 +79,7 @@ If the key is KEY_UNKNOWN or does not exist on the keyboard this method will ret
|
||||
|
||||
- Success return int
|
||||
*/
|
||||
int lcoreGetKeyScancode( lua_State *L ) {
|
||||
int lcoreGetKeyScancode( lua_State* L ) {
|
||||
int key = luaL_checkinteger( L, 1 );
|
||||
|
||||
lua_pushinteger( L, glfwGetKeyScancode( key ) );
|
||||
@@ -98,11 +98,11 @@ int lcoreGetKeyScancode( lua_State *L ) {
|
||||
|
||||
Called when the window is resized. Type GLFW_WINDOW_SIZE_EVENT
|
||||
*/
|
||||
static void windowSizeEvent( GLFWwindow *window, int width, int height ) {
|
||||
static void windowSizeEvent( GLFWwindow* window, int width, int height ) {
|
||||
/* Pass through to raylib callback. */
|
||||
state->raylibWindowSizeCallback( window, width, height );
|
||||
|
||||
lua_State *L = state->luaState;
|
||||
lua_State* L = state->luaState;
|
||||
|
||||
lua_pushcfunction( L, luaTraceback );
|
||||
int tracebackidx = lua_gettop( L );
|
||||
@@ -134,11 +134,11 @@ static void windowSizeEvent( GLFWwindow *window, int width, int height ) {
|
||||
|
||||
Called when the window is maximized or restored. Type GLFW_WINDOW_MAXIMIZE_EVENT
|
||||
*/
|
||||
static void windowMaximizeEvent( GLFWwindow *window, int maximized ) {
|
||||
static void windowMaximizeEvent( GLFWwindow* window, int maximized ) {
|
||||
/* Pass through to raylib callback. */
|
||||
state->raylibWindowMaximizeCallback( window, maximized );
|
||||
|
||||
lua_State *L = state->luaState;
|
||||
lua_State* L = state->luaState;
|
||||
|
||||
lua_pushcfunction( L, luaTraceback );
|
||||
int tracebackidx = lua_gettop( L );
|
||||
@@ -168,11 +168,11 @@ static void windowMaximizeEvent( GLFWwindow *window, int maximized ) {
|
||||
|
||||
Called when the window is iconified or restored. Type GLFW_WINDOW_ICONYFY_EVENT
|
||||
*/
|
||||
static void windowIconyfyEvent( GLFWwindow *window, int iconified ) {
|
||||
static void windowIconyfyEvent( GLFWwindow* window, int iconified ) {
|
||||
/* Pass through to raylib callback. */
|
||||
state->raylibWindowIconifyCallback( window, iconified );
|
||||
|
||||
lua_State *L = state->luaState;
|
||||
lua_State* L = state->luaState;
|
||||
|
||||
lua_pushcfunction( L, luaTraceback );
|
||||
int tracebackidx = lua_gettop( L );
|
||||
@@ -200,11 +200,11 @@ static void windowIconyfyEvent( GLFWwindow *window, int iconified ) {
|
||||
|
||||
Called when the window gains or loses input focus. Type GLFW_WINDOW_FOCUS_EVENT
|
||||
*/
|
||||
static void windowFocusEvent( GLFWwindow *window, int focused ) {
|
||||
static void windowFocusEvent( GLFWwindow* window, int focused ) {
|
||||
/* Pass through to raylib callback. */
|
||||
state->raylibWindowFocusCallback( window, focused );
|
||||
|
||||
lua_State *L = state->luaState;
|
||||
lua_State* L = state->luaState;
|
||||
|
||||
lua_pushcfunction( L, luaTraceback );
|
||||
int tracebackidx = lua_gettop( L );
|
||||
@@ -232,11 +232,11 @@ static void windowFocusEvent( GLFWwindow *window, int focused ) {
|
||||
|
||||
Called when files are dropped to the window. Type GLFW_WINDOW_DROP_EVENT
|
||||
*/
|
||||
static void windowDropEvent( GLFWwindow *window, int count, const char **paths ) {
|
||||
static void windowDropEvent( GLFWwindow* window, int count, const char** paths ) {
|
||||
/* Pass through to raylib callback. */
|
||||
state->raylibWindowDropCallback( window, count, paths );
|
||||
|
||||
lua_State *L = state->luaState;
|
||||
lua_State* L = state->luaState;
|
||||
|
||||
lua_pushcfunction( L, luaTraceback );
|
||||
int tracebackidx = lua_gettop( L );
|
||||
@@ -280,7 +280,7 @@ static void keyInputEvent( GLFWwindow* window, int key, int scancode, int action
|
||||
/* Pass through to raylib callback. */
|
||||
state->raylibKeyCallback( window, key, scancode, action, mods );
|
||||
|
||||
lua_State *L = state->luaState;
|
||||
lua_State* L = state->luaState;
|
||||
|
||||
lua_pushcfunction( L, luaTraceback );
|
||||
int tracebackidx = lua_gettop( L );
|
||||
@@ -318,7 +318,7 @@ static void charInputEvent( GLFWwindow* window, unsigned int key ) {
|
||||
/* Pass through to raylib callback. */
|
||||
state->raylibCharCallback( window, key );
|
||||
|
||||
lua_State *L = state->luaState;
|
||||
lua_State* L = state->luaState;
|
||||
|
||||
lua_pushcfunction( L, luaTraceback );
|
||||
int tracebackidx = lua_gettop( L );
|
||||
@@ -350,7 +350,7 @@ static void mouseButtonInputEvent( GLFWwindow* window, int button, int action, i
|
||||
/* Pass through to raylib callback. */
|
||||
state->raylibMouseButtonCallback( window, button, action, mods );
|
||||
|
||||
lua_State *L = state->luaState;
|
||||
lua_State* L = state->luaState;
|
||||
|
||||
lua_pushcfunction( L, luaTraceback );
|
||||
int tracebackidx = lua_gettop( L );
|
||||
@@ -386,7 +386,7 @@ static void mouseCursorPosInputEvent( GLFWwindow* window, double x, double y ) {
|
||||
/* Pass through to raylib callback. */
|
||||
state->raylibMouseCursorPosCallback( window, x, y );
|
||||
|
||||
lua_State *L = state->luaState;
|
||||
lua_State* L = state->luaState;
|
||||
|
||||
lua_pushcfunction( L, luaTraceback );
|
||||
int tracebackidx = lua_gettop( L );
|
||||
@@ -420,7 +420,7 @@ static void mouseScrollInputEvent( GLFWwindow* window, double xoffset, double yo
|
||||
/* Pass through to raylib callback. */
|
||||
state->raylibMouseScrollCallback( window, xoffset, yoffset );
|
||||
|
||||
lua_State *L = state->luaState;
|
||||
lua_State* L = state->luaState;
|
||||
|
||||
lua_pushcfunction( L, luaTraceback );
|
||||
int tracebackidx = lua_gettop( L );
|
||||
@@ -454,7 +454,7 @@ static void cursorEnterInputEvent( GLFWwindow* window, int enter ) {
|
||||
/* Pass through to raylib callback. */
|
||||
state->raylibCursorEnterCallback( window, enter );
|
||||
|
||||
lua_State *L = state->luaState;
|
||||
lua_State* L = state->luaState;
|
||||
|
||||
lua_pushcfunction( L, luaTraceback );
|
||||
int tracebackidx = lua_gettop( L );
|
||||
@@ -488,7 +488,7 @@ static void joystickEvent( int jid, int event ) {
|
||||
state->raylibJoystickCallback( jid, event );
|
||||
}
|
||||
|
||||
lua_State *L = state->luaState;
|
||||
lua_State* L = state->luaState;
|
||||
|
||||
lua_pushcfunction( L, luaTraceback );
|
||||
int tracebackidx = lua_gettop( L );
|
||||
@@ -520,7 +520,7 @@ Called when the pen tablet data is updated. Type GLFW_PEN_TABLET_DATA_EVENT
|
||||
NOTE: Experimental. Needs glfw PR https://github.com/glfw/glfw/pull/1445
|
||||
*/
|
||||
static void penTabletDataEvent( double x, double y, double z, double pressure, double pitch, double yaw, double roll ) {
|
||||
lua_State *L = state->luaState;
|
||||
lua_State* L = state->luaState;
|
||||
|
||||
lua_pushcfunction( L, luaTraceback );
|
||||
int tracebackidx = lua_gettop( L );
|
||||
@@ -562,7 +562,7 @@ Called when the pen tablet cursor has changed. Type GLFW_PEN_TABLET_CURSOR_EVENT
|
||||
NOTE: Experimental. Needs glfw PR https://github.com/glfw/glfw/pull/1445
|
||||
*/
|
||||
static void penTabletCursorEvent( unsigned int identifier ) {
|
||||
lua_State *L = state->luaState;
|
||||
lua_State* L = state->luaState;
|
||||
|
||||
lua_pushcfunction( L, luaTraceback );
|
||||
int tracebackidx = lua_gettop( L );
|
||||
@@ -592,7 +592,7 @@ Called when the pen tablet proximity has changed. Type GLFW_PEN_TABLET_PROXIMITY
|
||||
NOTE: Experimental. Needs glfw PR https://github.com/glfw/glfw/pull/1445
|
||||
*/
|
||||
static void penTabletProximityEvent( int proxState ) {
|
||||
lua_State *L = state->luaState;
|
||||
lua_State* L = state->luaState;
|
||||
|
||||
lua_pushcfunction( L, luaTraceback );
|
||||
int tracebackidx = lua_gettop( L );
|
||||
@@ -640,7 +640,7 @@ static void platformRegisterEvents() {
|
||||
}
|
||||
|
||||
void luaPlatformRegister() {
|
||||
lua_State *L = state->luaState;
|
||||
lua_State* L = state->luaState;
|
||||
lua_getglobal( L, "RL" );
|
||||
|
||||
/* Input-related functions: keyboard. */
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include "platforms/core_desktop_sdl.h"
|
||||
|
||||
void platformDefineGlobals() {
|
||||
lua_State *L = state->luaState;
|
||||
lua_State* L = state->luaState;
|
||||
|
||||
lua_getglobal( L, "RL" );
|
||||
/*DOC_DEFINES_START*/
|
||||
@@ -88,7 +88,7 @@ Use this function to get a human-readable name for a key. If the key doesn't hav
|
||||
|
||||
- Success return string
|
||||
*/
|
||||
int lcoreGetKeyName( lua_State *L ) {
|
||||
int lcoreGetKeyName( lua_State* L ) {
|
||||
int key = luaL_checkinteger( L, 1 );
|
||||
|
||||
lua_pushstring( L, SDL_GetKeyName( key ) );
|
||||
@@ -103,7 +103,7 @@ Use this function to get the scancode corresponding to the given key code accord
|
||||
|
||||
- Success return int
|
||||
*/
|
||||
int lcoreGetScancodeFromKey( lua_State *L ) {
|
||||
int lcoreGetScancodeFromKey( lua_State* L ) {
|
||||
int key = luaL_checkinteger( L, 1 );
|
||||
|
||||
lua_pushinteger( L, SDL_GetScancodeFromKey( key ) );
|
||||
@@ -118,7 +118,7 @@ int lcoreGetScancodeFromKey( lua_State *L ) {
|
||||
*/
|
||||
|
||||
/* This function is not thread safe so we don't use Lua inside it directly. It only adds events to another queue. */
|
||||
static int SDLEventFilter( void *userdata, SDL_Event *event ) {
|
||||
static int SDLEventFilter( void* userdata, SDL_Event* event ) {
|
||||
/* SDL_EVENT_POLL_SENTINEL = 0x7F00, /**< Signals the end of an event poll cycle */
|
||||
if ( event->type != SDL_QUIT && event->type != 0x7F00 && state->SDL_eventQueueLen < PLATFORM_SDL_EVENT_QUEUE_LEN ) {
|
||||
state->SDL_eventQueue[ state->SDL_eventQueueLen ] = *event;
|
||||
@@ -134,7 +134,7 @@ static void platformRegisterEvents() {
|
||||
}
|
||||
|
||||
static void platformSendEvents() {
|
||||
lua_State *L = state->luaState;
|
||||
lua_State* L = state->luaState;
|
||||
|
||||
lua_pushcfunction( L, luaTraceback );
|
||||
int tracebackidx = lua_gettop( L );
|
||||
@@ -546,7 +546,7 @@ Event occurs an event of type SDL_DOLLARGESTURE or SDL_DOLLARRECORD is reported.
|
||||
}
|
||||
|
||||
void luaPlatformRegister() {
|
||||
lua_State *L = state->luaState;
|
||||
lua_State* L = state->luaState;
|
||||
lua_getglobal( L, "RL" );
|
||||
|
||||
/* Input-related functions: keyboard. */
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#include "core.h"
|
||||
|
||||
void platformDefineGlobals() {
|
||||
lua_State *L = state->luaState;
|
||||
lua_State* L = state->luaState;
|
||||
|
||||
lua_getglobal( L, "RL" );
|
||||
/*DOC_DEFINES_START*/
|
||||
|
||||
130
src/rgui.c
130
src/rgui.c
@@ -15,7 +15,7 @@
|
||||
|
||||
Enable gui controls (global state)
|
||||
*/
|
||||
int lguiGuiEnable( lua_State *L ) {
|
||||
int lguiGuiEnable( lua_State* L ) {
|
||||
GuiEnable();
|
||||
|
||||
return 0;
|
||||
@@ -26,7 +26,7 @@ int lguiGuiEnable( lua_State *L ) {
|
||||
|
||||
Disable gui controls (global state)
|
||||
*/
|
||||
int lguiGuiDisable( lua_State *L ) {
|
||||
int lguiGuiDisable( lua_State* L ) {
|
||||
GuiDisable();
|
||||
|
||||
return 0;
|
||||
@@ -37,7 +37,7 @@ int lguiGuiDisable( lua_State *L ) {
|
||||
|
||||
Lock gui controls (global state)
|
||||
*/
|
||||
int lguiGuiLock( lua_State *L ) {
|
||||
int lguiGuiLock( lua_State* L ) {
|
||||
GuiLock();
|
||||
|
||||
return 0;
|
||||
@@ -48,7 +48,7 @@ int lguiGuiLock( lua_State *L ) {
|
||||
|
||||
Unlock gui controls (global state)
|
||||
*/
|
||||
int lguiGuiUnlock( lua_State *L ) {
|
||||
int lguiGuiUnlock( lua_State* L ) {
|
||||
GuiUnlock();
|
||||
|
||||
return 0;
|
||||
@@ -61,7 +61,7 @@ Check if gui is locked (global state)
|
||||
|
||||
- Success return bool
|
||||
*/
|
||||
int lguiGuiIsLocked( lua_State *L ) {
|
||||
int lguiGuiIsLocked( lua_State* L ) {
|
||||
lua_pushboolean( L, GuiIsLocked() );
|
||||
|
||||
return 1;
|
||||
@@ -72,7 +72,7 @@ int lguiGuiIsLocked( lua_State *L ) {
|
||||
|
||||
Set gui controls alpha (global state), alpha goes from 0.0f to 1.0f
|
||||
*/
|
||||
int lguiGuiSetAlpha( lua_State *L ) {
|
||||
int lguiGuiSetAlpha( lua_State* L ) {
|
||||
float alpha = luaL_checknumber( L, 1 );
|
||||
|
||||
GuiSetAlpha( alpha );
|
||||
@@ -85,7 +85,7 @@ int lguiGuiSetAlpha( lua_State *L ) {
|
||||
|
||||
Set gui state (global state)
|
||||
*/
|
||||
int lguiGuiSetState( lua_State *L ) {
|
||||
int lguiGuiSetState( lua_State* L ) {
|
||||
int state = luaL_checkinteger( L, 1 );
|
||||
|
||||
GuiSetState( state );
|
||||
@@ -100,7 +100,7 @@ Get gui state (global state)
|
||||
|
||||
- Success return int
|
||||
*/
|
||||
int lguiGuiGetState( lua_State *L ) {
|
||||
int lguiGuiGetState( lua_State* L ) {
|
||||
lua_pushinteger( L, GuiGetState() );
|
||||
|
||||
return 1;
|
||||
@@ -115,8 +115,8 @@ int lguiGuiGetState( lua_State *L ) {
|
||||
|
||||
Set gui custom font (global state)
|
||||
*/
|
||||
int lguiGuiSetFont( lua_State *L ) {
|
||||
Font *font = uluaGetFont( L, 1 );
|
||||
int lguiGuiSetFont( lua_State* L ) {
|
||||
Font* font = uluaGetFont( L, 1 );
|
||||
|
||||
GuiSetFont( *font );
|
||||
|
||||
@@ -130,7 +130,7 @@ Get gui custom font (global state)
|
||||
|
||||
- Success return Font
|
||||
*/
|
||||
int lguiGuiGetFont( lua_State *L ) {
|
||||
int lguiGuiGetFont( lua_State* L ) {
|
||||
uluaPushFont( L, GuiGetFont() );
|
||||
|
||||
return 1;
|
||||
@@ -145,7 +145,7 @@ int lguiGuiGetFont( lua_State *L ) {
|
||||
|
||||
Set one style property
|
||||
*/
|
||||
int lguiGuiSetStyle( lua_State *L ) {
|
||||
int lguiGuiSetStyle( lua_State* L ) {
|
||||
int control = luaL_checkinteger( L, 1 );
|
||||
int property = luaL_checkinteger( L, 2 );
|
||||
int value = luaL_checkinteger( L, 3 );
|
||||
@@ -162,7 +162,7 @@ Get one style property
|
||||
|
||||
- Success return int
|
||||
*/
|
||||
int lguiGuiGetStyle( lua_State *L ) {
|
||||
int lguiGuiGetStyle( lua_State* L ) {
|
||||
int control = luaL_checkinteger( L, 1 );
|
||||
int property = luaL_checkinteger( L, 2 );
|
||||
|
||||
@@ -183,7 +183,7 @@ Load style file over global style variable (.rgs)
|
||||
- Failure return nil
|
||||
- Success return true
|
||||
*/
|
||||
int lguiGuiLoadStyle( lua_State *L ) {
|
||||
int lguiGuiLoadStyle( lua_State* L ) {
|
||||
if ( FileExists( luaL_checkstring( L, 1 ) ) ) {
|
||||
GuiLoadStyle( lua_tostring( L, 1 ) );
|
||||
lua_pushboolean( L, true );
|
||||
@@ -201,7 +201,7 @@ int lguiGuiLoadStyle( lua_State *L ) {
|
||||
|
||||
Load style default over global style
|
||||
*/
|
||||
int lguiGuiLoadStyleDefault( lua_State *L ) {
|
||||
int lguiGuiLoadStyleDefault( lua_State* L ) {
|
||||
GuiLoadStyleDefault();
|
||||
|
||||
return 0;
|
||||
@@ -216,7 +216,7 @@ int lguiGuiLoadStyleDefault( lua_State *L ) {
|
||||
|
||||
Enable gui tooltips (global state)
|
||||
*/
|
||||
int lguiGuiEnableTooltip( lua_State *L ) {
|
||||
int lguiGuiEnableTooltip( lua_State* L ) {
|
||||
GuiEnableTooltip();
|
||||
|
||||
return 0;
|
||||
@@ -227,7 +227,7 @@ int lguiGuiEnableTooltip( lua_State *L ) {
|
||||
|
||||
Disable gui tooltips (global state)
|
||||
*/
|
||||
int lguiGuiDisableTooltip( lua_State *L ) {
|
||||
int lguiGuiDisableTooltip( lua_State* L ) {
|
||||
GuiDisableTooltip();
|
||||
|
||||
return 0;
|
||||
@@ -238,7 +238,7 @@ int lguiGuiDisableTooltip( lua_State *L ) {
|
||||
|
||||
Set tooltip string
|
||||
*/
|
||||
int lguiGuiSetTooltip( lua_State *L ) {
|
||||
int lguiGuiSetTooltip( lua_State* L ) {
|
||||
GuiSetTooltip( luaL_checkstring( L, 1 ) );
|
||||
|
||||
return 0;
|
||||
@@ -255,7 +255,7 @@ Get text with icon id prepended (if supported)
|
||||
|
||||
- Success return string
|
||||
*/
|
||||
int lguiGuiIconText( lua_State *L ) {
|
||||
int lguiGuiIconText( lua_State* L ) {
|
||||
int iconId = luaL_checkinteger( L, 1 );
|
||||
|
||||
if ( TextIsEqual( luaL_checkstring( L, 2 ), "" ) ) {
|
||||
@@ -273,7 +273,7 @@ int lguiGuiIconText( lua_State *L ) {
|
||||
|
||||
Set icon scale (1 by default)
|
||||
*/
|
||||
int lguiGuiSetIconScale( lua_State *L ) {
|
||||
int lguiGuiSetIconScale( lua_State* L ) {
|
||||
unsigned int scale = luaL_checkinteger( L, 1 );
|
||||
|
||||
GuiSetIconScale( scale );
|
||||
@@ -288,7 +288,7 @@ Get raygui icons data pointer
|
||||
|
||||
- Success return int
|
||||
*/
|
||||
int lguiGuiGetIcons( lua_State *L ) {
|
||||
int lguiGuiGetIcons( lua_State* L ) {
|
||||
lua_pushinteger( L, *GuiGetIcons() );
|
||||
|
||||
return 1;
|
||||
@@ -302,12 +302,12 @@ Load raygui icons file (.rgi) into internal icons data
|
||||
- Failure return nil
|
||||
- Success return strings{}
|
||||
*/
|
||||
int lguiGuiLoadIcons( lua_State *L ) {
|
||||
const char *fileName = luaL_checkstring( L, 1 );
|
||||
int lguiGuiLoadIcons( lua_State* L ) {
|
||||
const char* fileName = luaL_checkstring( L, 1 );
|
||||
bool loadIconsName = uluaGetBoolean( L, 2 );
|
||||
|
||||
if ( FileExists( fileName ) ) {
|
||||
char **iconNames = GuiLoadIcons( fileName, loadIconsName );
|
||||
char** iconNames = GuiLoadIcons( fileName, loadIconsName );
|
||||
|
||||
lua_createtable( L, 255, 0 );
|
||||
|
||||
@@ -331,7 +331,7 @@ int lguiGuiLoadIcons( lua_State *L ) {
|
||||
|
||||
Draw icon
|
||||
*/
|
||||
int lguiGuiDrawIcon( lua_State *L ) {
|
||||
int lguiGuiDrawIcon( lua_State* L ) {
|
||||
int iconId = luaL_checkinteger( L, 1 );
|
||||
Vector2 pos = uluaGetVector2( L, 2 );
|
||||
int pixelSize = luaL_checkinteger( L, 3 );
|
||||
@@ -353,7 +353,7 @@ Window Box control, shows a window that can be closed
|
||||
|
||||
- Success return int
|
||||
*/
|
||||
int lguiGuiWindowBox( lua_State *L ) {
|
||||
int lguiGuiWindowBox( lua_State* L ) {
|
||||
Rectangle bounds = uluaGetRectangle( L, 1 );
|
||||
|
||||
lua_pushinteger( L, GuiWindowBox( bounds, luaL_checkstring( L, 2 ) ) );
|
||||
@@ -368,7 +368,7 @@ Group Box control with text name
|
||||
|
||||
- Success return int
|
||||
*/
|
||||
int lguiGuiGroupBox( lua_State *L ) {
|
||||
int lguiGuiGroupBox( lua_State* L ) {
|
||||
Rectangle bounds = uluaGetRectangle( L, 1 );
|
||||
|
||||
lua_pushinteger( L, GuiGroupBox( bounds, luaL_checkstring( L, 2 ) ) );
|
||||
@@ -383,7 +383,7 @@ Line separator control, could contain text
|
||||
|
||||
- Success return int
|
||||
*/
|
||||
int lguiGuiLine( lua_State *L ) {
|
||||
int lguiGuiLine( lua_State* L ) {
|
||||
Rectangle bounds = uluaGetRectangle( L, 1 );
|
||||
|
||||
lua_pushinteger( L, GuiLine( bounds, luaL_checkstring( L, 2 ) ) );
|
||||
@@ -398,7 +398,7 @@ Panel control, useful to group controls
|
||||
|
||||
- Success return int
|
||||
*/
|
||||
int lguiGuiPanel( lua_State *L ) {
|
||||
int lguiGuiPanel( lua_State* L ) {
|
||||
Rectangle bounds = uluaGetRectangle( L, 1 );
|
||||
|
||||
lua_pushinteger( L, GuiPanel( bounds, luaL_checkstring( L, 2 ) ) );
|
||||
@@ -413,12 +413,12 @@ Tab Bar control, returns TAB to be closed or -1
|
||||
|
||||
- Success return int, int
|
||||
*/
|
||||
int lguiGuiTabBar( lua_State *L ) {
|
||||
int lguiGuiTabBar( lua_State* L ) {
|
||||
Rectangle bounds = uluaGetRectangle( L, 1 );
|
||||
int active = luaL_checkinteger( L, 3 );
|
||||
|
||||
int count = 0;
|
||||
const char **text = TextSplit( luaL_checkstring( L, 2 ), ';', &count );
|
||||
const char** text = TextSplit( luaL_checkstring( L, 2 ), ';', &count );
|
||||
|
||||
lua_pushinteger( L, GuiTabBar( bounds, text, count, &active ) );
|
||||
lua_pushinteger( L, active );
|
||||
@@ -433,7 +433,7 @@ Scroll Panel control
|
||||
|
||||
- Success return int, Vector2, Rectangle
|
||||
*/
|
||||
int lguiGuiScrollPanel( lua_State *L ) {
|
||||
int lguiGuiScrollPanel( lua_State* L ) {
|
||||
Rectangle bounds = uluaGetRectangle( L, 1 );
|
||||
Rectangle content = uluaGetRectangle( L, 3 );
|
||||
Vector2 scroll = uluaGetVector2( L, 4 );
|
||||
@@ -457,7 +457,7 @@ Label control, shows text
|
||||
|
||||
- Success return int
|
||||
*/
|
||||
int lguiGuiLabel( lua_State *L ) {
|
||||
int lguiGuiLabel( lua_State* L ) {
|
||||
Rectangle bounds = uluaGetRectangle( L, 1 );
|
||||
|
||||
lua_pushinteger( L, GuiLabel( bounds, luaL_checkstring( L, 2 ) ) );
|
||||
@@ -472,7 +472,7 @@ Button control, returns true when clicked
|
||||
|
||||
- Success return int
|
||||
*/
|
||||
int lguiGuiButton( lua_State *L ) {
|
||||
int lguiGuiButton( lua_State* L ) {
|
||||
Rectangle bounds = uluaGetRectangle( L, 1 );
|
||||
|
||||
lua_pushinteger( L, GuiButton( bounds, luaL_checkstring( L, 2 ) ) );
|
||||
@@ -487,7 +487,7 @@ Label button control, show true when clicked
|
||||
|
||||
- Success return int
|
||||
*/
|
||||
int lguiGuiLabelButton( lua_State *L ) {
|
||||
int lguiGuiLabelButton( lua_State* L ) {
|
||||
Rectangle bounds = uluaGetRectangle( L, 1 );
|
||||
|
||||
lua_pushinteger( L, GuiLabelButton( bounds, luaL_checkstring( L, 2 ) ) );
|
||||
@@ -502,7 +502,7 @@ Toggle Button control, returns true when active
|
||||
|
||||
- Success return int, bool
|
||||
*/
|
||||
int lguiGuiToggle( lua_State *L ) {
|
||||
int lguiGuiToggle( lua_State* L ) {
|
||||
Rectangle bounds = uluaGetRectangle( L, 1 );
|
||||
bool active = uluaGetBoolean( L, 3 );
|
||||
|
||||
@@ -519,7 +519,7 @@ Toggle Group control, returns active toggle index
|
||||
|
||||
- Success return int, int
|
||||
*/
|
||||
int lguiGuiToggleGroup( lua_State *L ) {
|
||||
int lguiGuiToggleGroup( lua_State* L ) {
|
||||
Rectangle bounds = uluaGetRectangle( L, 1 );
|
||||
int active = luaL_checkinteger( L, 3 );
|
||||
|
||||
@@ -536,7 +536,7 @@ Toggle Slider control, returns true when clicked
|
||||
|
||||
- Success return int, int
|
||||
*/
|
||||
int lguiGuiToggleSlider( lua_State *L ) {
|
||||
int lguiGuiToggleSlider( lua_State* L ) {
|
||||
Rectangle bounds = uluaGetRectangle( L, 1 );
|
||||
int active = luaL_checkinteger( L, 3 );
|
||||
|
||||
@@ -553,7 +553,7 @@ Check Box control, returns true when active
|
||||
|
||||
- Success return bool, Rectangle
|
||||
*/
|
||||
int lguiGuiCheckBox( lua_State *L ) {
|
||||
int lguiGuiCheckBox( lua_State* L ) {
|
||||
Rectangle bounds = uluaGetRectangle( L, 1 );
|
||||
bool checked = uluaGetBoolean( L, 3 );
|
||||
|
||||
@@ -572,7 +572,7 @@ Combo Box control, returns selected item index
|
||||
|
||||
- Success return int, int
|
||||
*/
|
||||
int lguiGuiComboBox( lua_State *L ) {
|
||||
int lguiGuiComboBox( lua_State* L ) {
|
||||
Rectangle bounds = uluaGetRectangle( L, 1 );
|
||||
int active = luaL_checkinteger( L, 3 );
|
||||
|
||||
@@ -589,7 +589,7 @@ Dropdown Box control, returns selected item
|
||||
|
||||
- Success return int, int
|
||||
*/
|
||||
int lguiGuiDropdownBox( lua_State *L ) {
|
||||
int lguiGuiDropdownBox( lua_State* L ) {
|
||||
Rectangle bounds = uluaGetRectangle( L, 1 );
|
||||
int active = luaL_checkinteger( L, 3 );
|
||||
bool editMode = uluaGetBoolean( L, 4 );
|
||||
@@ -607,7 +607,7 @@ Spinner control, returns selected value
|
||||
|
||||
- Success return int, int, Rectangle
|
||||
*/
|
||||
int lguiGuiSpinner( lua_State *L ) {
|
||||
int lguiGuiSpinner( lua_State* L ) {
|
||||
Rectangle bounds = uluaGetRectangle( L, 1 );
|
||||
int value = luaL_checkinteger( L, 3 );
|
||||
int minValue = luaL_checkinteger( L, 4 );
|
||||
@@ -629,7 +629,7 @@ Value Box control, updates input text with numbers
|
||||
|
||||
- Success return int, int, Rectangle
|
||||
*/
|
||||
int lguiGuiValueBox( lua_State *L ) {
|
||||
int lguiGuiValueBox( lua_State* L ) {
|
||||
Rectangle bounds = uluaGetRectangle( L, 1 );
|
||||
int value = luaL_checkinteger( L, 3 );
|
||||
int minValue = luaL_checkinteger( L, 4 );
|
||||
@@ -651,7 +651,7 @@ Text Box control, updates input text
|
||||
|
||||
- Success return int, string
|
||||
*/
|
||||
int lguiGuiTextBox( lua_State *L ) {
|
||||
int lguiGuiTextBox( lua_State* L ) {
|
||||
Rectangle bounds = uluaGetRectangle( L, 1 );
|
||||
int textSize = luaL_checkinteger( L, 3 );
|
||||
char text[ textSize + 1 ];
|
||||
@@ -671,7 +671,7 @@ Slider control, returns selected value
|
||||
|
||||
- Success return int, float, Rectangle, Rectangle
|
||||
*/
|
||||
int lguiGuiSlider( lua_State *L ) {
|
||||
int lguiGuiSlider( lua_State* L ) {
|
||||
Rectangle bounds = uluaGetRectangle( L, 1 );
|
||||
float value = luaL_checknumber( L, 4 );
|
||||
float minValue = luaL_checknumber( L, 5 );
|
||||
@@ -694,7 +694,7 @@ Slider Bar control, returns selected value
|
||||
|
||||
- Success return int, float, Rectangle, Rectangle
|
||||
*/
|
||||
int lguiGuiSliderBar( lua_State *L ) {
|
||||
int lguiGuiSliderBar( lua_State* L ) {
|
||||
Rectangle bounds = uluaGetRectangle( L, 1 );
|
||||
float value = luaL_checknumber( L, 4 );
|
||||
float minValue = luaL_checknumber( L, 5 );
|
||||
@@ -717,7 +717,7 @@ Progress Bar control, shows current progress value
|
||||
|
||||
- Success return int, float, Rectangle, Rectangle
|
||||
*/
|
||||
int lguiGuiProgressBar( lua_State *L ) {
|
||||
int lguiGuiProgressBar( lua_State* L ) {
|
||||
Rectangle bounds = uluaGetRectangle( L, 1 );
|
||||
float value = luaL_checknumber( L, 4 );
|
||||
float minValue = luaL_checknumber( L, 5 );
|
||||
@@ -740,7 +740,7 @@ Status Bar control, shows info text
|
||||
|
||||
- Success return int
|
||||
*/
|
||||
int lguiGuiStatusBar( lua_State *L ) {
|
||||
int lguiGuiStatusBar( lua_State* L ) {
|
||||
Rectangle bounds = uluaGetRectangle( L, 1 );
|
||||
|
||||
lua_pushinteger( L, GuiStatusBar( bounds, luaL_checkstring( L, 2 ) ) );
|
||||
@@ -755,7 +755,7 @@ Dummy control for placeholders
|
||||
|
||||
- Success return int
|
||||
*/
|
||||
int lguiGuiDummyRec( lua_State *L ) {
|
||||
int lguiGuiDummyRec( lua_State* L ) {
|
||||
Rectangle bounds = uluaGetRectangle( L, 1 );
|
||||
|
||||
lua_pushinteger( L, GuiDummyRec( bounds, luaL_checkstring( L, 2 ) ) );
|
||||
@@ -770,7 +770,7 @@ Grid control, returns mouse cell position
|
||||
|
||||
- Success return int, Vector2
|
||||
*/
|
||||
int lguiGuiGrid( lua_State *L ) {
|
||||
int lguiGuiGrid( lua_State* L ) {
|
||||
Rectangle bounds = uluaGetRectangle( L, 1 );
|
||||
float spacing = luaL_checknumber( L, 3 );
|
||||
int subdivs = luaL_checkinteger( L, 4 );
|
||||
@@ -789,7 +789,7 @@ Scroll bar control
|
||||
|
||||
- Success return int
|
||||
*/
|
||||
int lguiGuiScrollBar( lua_State *L ) {
|
||||
int lguiGuiScrollBar( lua_State* L ) {
|
||||
Rectangle bounds = uluaGetRectangle( L, 1 );
|
||||
int value = luaL_checkinteger( L, 2 );
|
||||
int minValue = luaL_checkinteger( L, 3 );
|
||||
@@ -811,7 +811,7 @@ List View control, returns selected list item index
|
||||
|
||||
- Success return int, int, int
|
||||
*/
|
||||
int lguiGuiListView( lua_State *L ) {
|
||||
int lguiGuiListView( lua_State* L ) {
|
||||
Rectangle bounds = uluaGetRectangle( L, 1 );
|
||||
int scrollIndex = luaL_checkinteger( L, 3 );
|
||||
int active = luaL_checkinteger( L, 4 );
|
||||
@@ -830,14 +830,14 @@ List View with extended parameters
|
||||
|
||||
- Success return int, int, int, int
|
||||
*/
|
||||
int lguiGuiListViewEx( lua_State *L ) {
|
||||
int lguiGuiListViewEx( lua_State* L ) {
|
||||
Rectangle bounds = uluaGetRectangle( L, 1 );
|
||||
int scrollIndex = luaL_checkinteger( L, 3 );
|
||||
int active = luaL_checkinteger( L, 4 );
|
||||
int focus = luaL_checkinteger( L, 5 );
|
||||
|
||||
int count = 0;
|
||||
const char **text = TextSplit( luaL_checkstring( L, 2 ), ';', &count );
|
||||
const char** text = TextSplit( luaL_checkstring( L, 2 ), ';', &count );
|
||||
|
||||
lua_pushinteger( L, GuiListViewEx( bounds, text, count, &scrollIndex, &active, &focus ) );
|
||||
lua_pushinteger( L, scrollIndex );
|
||||
@@ -854,7 +854,7 @@ Message Box control, displays a message
|
||||
|
||||
- Success return int
|
||||
*/
|
||||
int lguiGuiMessageBox( lua_State *L ) {
|
||||
int lguiGuiMessageBox( lua_State* L ) {
|
||||
Rectangle bounds = uluaGetRectangle( L, 1 );
|
||||
|
||||
lua_pushinteger( L, GuiMessageBox( bounds, luaL_checkstring( L, 2 ), luaL_checkstring( L, 3 ), luaL_checkstring( L, 4 ) ) );
|
||||
@@ -869,11 +869,11 @@ Text Input Box control, ask for text, supports secret
|
||||
|
||||
- Success return int, string, bool
|
||||
*/
|
||||
int lguiGuiTextInputBox( lua_State *L ) {
|
||||
int lguiGuiTextInputBox( lua_State* L ) {
|
||||
Rectangle bounds = uluaGetRectangle( L, 1 );
|
||||
const char *title = luaL_checkstring( L, 2 );
|
||||
const char *message = luaL_checkstring( L, 3 );
|
||||
const char *buttons = luaL_checkstring( L, 4 );
|
||||
const char* title = luaL_checkstring( L, 2 );
|
||||
const char* message = luaL_checkstring( L, 3 );
|
||||
const char* buttons = luaL_checkstring( L, 4 );
|
||||
int textMaxSize = luaL_checkinteger( L, 6 );
|
||||
bool secretViewActive = uluaGetBoolean( L, 7 );
|
||||
char text[ textMaxSize + 1 ];
|
||||
@@ -893,7 +893,7 @@ Color Picker control (multiple color controls)
|
||||
|
||||
- Success return int, Color
|
||||
*/
|
||||
int lguiGuiColorPicker( lua_State *L ) {
|
||||
int lguiGuiColorPicker( lua_State* L ) {
|
||||
Rectangle bounds = uluaGetRectangle( L, 1 );
|
||||
Color color = uluaGetColor( L, 3 );
|
||||
|
||||
@@ -910,7 +910,7 @@ Color Panel control
|
||||
|
||||
- Success return int, Color
|
||||
*/
|
||||
int lguiGuiColorPanel( lua_State *L ) {
|
||||
int lguiGuiColorPanel( lua_State* L ) {
|
||||
Rectangle bounds = uluaGetRectangle( L, 1 );
|
||||
Color color = uluaGetColor( L, 3 );
|
||||
|
||||
@@ -927,7 +927,7 @@ Color Bar Alpha control
|
||||
|
||||
- Success return int, float
|
||||
*/
|
||||
int lguiGuiColorBarAlpha( lua_State *L ) {
|
||||
int lguiGuiColorBarAlpha( lua_State* L ) {
|
||||
Rectangle bounds = uluaGetRectangle( L, 1 );
|
||||
float alpha = luaL_checknumber( L, 3 );
|
||||
|
||||
@@ -944,7 +944,7 @@ Color Bar Hue control
|
||||
|
||||
- Success return int, float
|
||||
*/
|
||||
int lguiGuiColorBarHue( lua_State *L ) {
|
||||
int lguiGuiColorBarHue( lua_State* L ) {
|
||||
Rectangle bounds = uluaGetRectangle( L, 1 );
|
||||
float value = luaL_checknumber( L, 3 );
|
||||
|
||||
@@ -961,7 +961,7 @@ Color Picker control that avoids conversion to RGB on each call (multiple color
|
||||
|
||||
- Success return int, Vector3
|
||||
*/
|
||||
int lguiGuiColorPickerHSV( lua_State *L ) {
|
||||
int lguiGuiColorPickerHSV( lua_State* L ) {
|
||||
Rectangle bounds = uluaGetRectangle( L, 1 );
|
||||
Vector3 colorHsv = uluaGetVector3( L, 3 );
|
||||
|
||||
@@ -978,7 +978,7 @@ Color Panel control that returns HSV color value, used by GuiColorPickerHSV()
|
||||
|
||||
- Success return int, Vector3
|
||||
*/
|
||||
int lguiGuiColorPanelHSV( lua_State *L ) {
|
||||
int lguiGuiColorPanelHSV( lua_State* L ) {
|
||||
Rectangle bounds = uluaGetRectangle( L, 1 );
|
||||
Vector3 colorHsv = uluaGetVector3( L, 3 );
|
||||
|
||||
|
||||
310
src/rlgl.c
310
src/rlgl.c
File diff suppressed because it is too large
Load Diff
220
src/rmath.c
220
src/rmath.c
@@ -22,7 +22,7 @@ Clamp float value
|
||||
|
||||
- Success return float
|
||||
*/
|
||||
int lmathClamp( lua_State *L ) {
|
||||
int lmathClamp( lua_State* L ) {
|
||||
float value = luaL_checknumber( L, 1 );
|
||||
float min = luaL_checknumber( L, 2 );
|
||||
float max = luaL_checknumber( L, 3 );
|
||||
@@ -39,7 +39,7 @@ Calculate linear interpolation between two floats
|
||||
|
||||
- Success return float
|
||||
*/
|
||||
int lmathLerp( lua_State *L ) {
|
||||
int lmathLerp( lua_State* L ) {
|
||||
float start = luaL_checknumber( L, 1 );
|
||||
float end = luaL_checknumber( L, 2 );
|
||||
float amount = luaL_checknumber( L, 3 );
|
||||
@@ -56,7 +56,7 @@ Normalize input value within input range
|
||||
|
||||
- Success return float
|
||||
*/
|
||||
int lmathNormalize( lua_State *L ) {
|
||||
int lmathNormalize( lua_State* L ) {
|
||||
float value = luaL_checknumber( L, 1 );
|
||||
float start = luaL_checknumber( L, 2 );
|
||||
float end = luaL_checknumber( L, 3 );
|
||||
@@ -73,7 +73,7 @@ Remap input value within input range to output range
|
||||
|
||||
- Success return float
|
||||
*/
|
||||
int lmathRemap( lua_State *L ) {
|
||||
int lmathRemap( lua_State* L ) {
|
||||
float value = luaL_checknumber( L, 1 );
|
||||
float inputStart = luaL_checknumber( L, 2 );
|
||||
float inputEnd = luaL_checknumber( L, 3 );
|
||||
@@ -92,7 +92,7 @@ Wrap input value from min to max
|
||||
|
||||
- Success return float
|
||||
*/
|
||||
int lmathWrap( lua_State *L ) {
|
||||
int lmathWrap( lua_State* L ) {
|
||||
float value = luaL_checknumber( L, 1 );
|
||||
float min = luaL_checknumber( L, 2 );
|
||||
float max = luaL_checknumber( L, 3 );
|
||||
@@ -109,7 +109,7 @@ Check whether two given floats are almost equal
|
||||
|
||||
- Success return int
|
||||
*/
|
||||
int lmathFloatEquals( lua_State *L ) {
|
||||
int lmathFloatEquals( lua_State* L ) {
|
||||
float x = luaL_checknumber( L, 1 );
|
||||
float y = luaL_checknumber( L, 2 );
|
||||
|
||||
@@ -129,7 +129,7 @@ Vector with components value 0.0f
|
||||
|
||||
- Success return Vector2
|
||||
*/
|
||||
int lmathVector2Zero( lua_State *L ) {
|
||||
int lmathVector2Zero( lua_State* L ) {
|
||||
uluaPushVector2( L, Vector2Zero() );
|
||||
|
||||
return 1;
|
||||
@@ -142,7 +142,7 @@ Vector with components value 1.0f
|
||||
|
||||
- Success return Vector2
|
||||
*/
|
||||
int lmathVector2One( lua_State *L ) {
|
||||
int lmathVector2One( lua_State* L ) {
|
||||
uluaPushVector2( L, Vector2One() );
|
||||
|
||||
return 1;
|
||||
@@ -155,7 +155,7 @@ Add two vectors (v1 + v2)
|
||||
|
||||
- Success return Vector2
|
||||
*/
|
||||
int lmathVector2Add( lua_State *L ) {
|
||||
int lmathVector2Add( lua_State* L ) {
|
||||
Vector2 v1 = uluaGetVector2( L, 1 );
|
||||
Vector2 v2 = uluaGetVector2( L, 2 );
|
||||
|
||||
@@ -171,7 +171,7 @@ Add vector and float value
|
||||
|
||||
- Success return Vector2
|
||||
*/
|
||||
int lmathVector2AddValue( lua_State *L ) {
|
||||
int lmathVector2AddValue( lua_State* L ) {
|
||||
Vector2 v = uluaGetVector2( L, 1 );
|
||||
float add = luaL_checknumber( L, 2 );
|
||||
|
||||
@@ -187,7 +187,7 @@ Subtract two vectors (v1 - v2)
|
||||
|
||||
- Success return Vector2
|
||||
*/
|
||||
int lmathVector2Subtract( lua_State *L ) {
|
||||
int lmathVector2Subtract( lua_State* L ) {
|
||||
Vector2 v1 = uluaGetVector2( L, 1 );
|
||||
Vector2 v2 = uluaGetVector2( L, 2 );
|
||||
|
||||
@@ -203,7 +203,7 @@ Subtract vector by float value
|
||||
|
||||
- Success return Vector2
|
||||
*/
|
||||
int lmathVector2SubtractValue( lua_State *L ) {
|
||||
int lmathVector2SubtractValue( lua_State* L ) {
|
||||
Vector2 v = uluaGetVector2( L, 1 );
|
||||
float sub = luaL_checknumber( L, 2 );
|
||||
|
||||
@@ -219,7 +219,7 @@ Calculate vector length
|
||||
|
||||
- Success return float
|
||||
*/
|
||||
int lmathVector2Length( lua_State *L ) {
|
||||
int lmathVector2Length( lua_State* L ) {
|
||||
Vector2 v = uluaGetVector2( L, 1 );
|
||||
|
||||
lua_pushnumber( L, Vector2Length( v ) );
|
||||
@@ -234,7 +234,7 @@ Calculate vector square length
|
||||
|
||||
- Success return float
|
||||
*/
|
||||
int lmathVector2LengthSqr( lua_State *L ) {
|
||||
int lmathVector2LengthSqr( lua_State* L ) {
|
||||
Vector2 v = uluaGetVector2( L, 1 );
|
||||
|
||||
lua_pushnumber( L, Vector2LengthSqr( v ) );
|
||||
@@ -249,7 +249,7 @@ Calculate two vectors dot product
|
||||
|
||||
- Success return float
|
||||
*/
|
||||
int lmathVector2DotProduct( lua_State *L ) {
|
||||
int lmathVector2DotProduct( lua_State* L ) {
|
||||
Vector2 v1 = uluaGetVector2( L, 1 );
|
||||
Vector2 v2 = uluaGetVector2( L, 2 );
|
||||
|
||||
@@ -265,7 +265,7 @@ Calculate distance between two vectors
|
||||
|
||||
- Success return float
|
||||
*/
|
||||
int lmathVector2Distance( lua_State *L ) {
|
||||
int lmathVector2Distance( lua_State* L ) {
|
||||
Vector2 v1 = uluaGetVector2( L, 1 );
|
||||
Vector2 v2 = uluaGetVector2( L, 2 );
|
||||
|
||||
@@ -281,7 +281,7 @@ Calculate square distance between two vectors
|
||||
|
||||
- Success return float
|
||||
*/
|
||||
int lmathVector2DistanceSqr( lua_State *L ) {
|
||||
int lmathVector2DistanceSqr( lua_State* L ) {
|
||||
Vector2 v1 = uluaGetVector2( L, 1 );
|
||||
Vector2 v2 = uluaGetVector2( L, 2 );
|
||||
|
||||
@@ -298,7 +298,7 @@ NOTE: Angle is calculated from origin point (0, 0)
|
||||
|
||||
- Success return float
|
||||
*/
|
||||
int lmathVector2Angle( lua_State *L ) {
|
||||
int lmathVector2Angle( lua_State* L ) {
|
||||
Vector2 v1 = uluaGetVector2( L, 1 );
|
||||
Vector2 v2 = uluaGetVector2( L, 2 );
|
||||
|
||||
@@ -316,7 +316,7 @@ Current implementation should be aligned with glm::angle
|
||||
|
||||
- Success return float
|
||||
*/
|
||||
int lmathVector2LineAngle( lua_State *L ) {
|
||||
int lmathVector2LineAngle( lua_State* L ) {
|
||||
Vector2 start = uluaGetVector2( L, 1 );
|
||||
Vector2 end = uluaGetVector2( L, 2 );
|
||||
|
||||
@@ -332,7 +332,7 @@ Scale vector (multiply by value)
|
||||
|
||||
- Success return Vector2
|
||||
*/
|
||||
int lmathVector2Scale( lua_State *L ) {
|
||||
int lmathVector2Scale( lua_State* L ) {
|
||||
Vector2 v = uluaGetVector2( L, 1 );
|
||||
float scale = luaL_checknumber( L, 2 );
|
||||
|
||||
@@ -348,7 +348,7 @@ Multiply vector by vector
|
||||
|
||||
- Success return Vector2
|
||||
*/
|
||||
int lmathVector2Multiply( lua_State *L ) {
|
||||
int lmathVector2Multiply( lua_State* L ) {
|
||||
Vector2 v1 = uluaGetVector2( L, 1 );
|
||||
Vector2 v2 = uluaGetVector2( L, 2 );
|
||||
|
||||
@@ -364,7 +364,7 @@ Negate vector
|
||||
|
||||
- Success return Vector2
|
||||
*/
|
||||
int lmathVector2Negate( lua_State *L ) {
|
||||
int lmathVector2Negate( lua_State* L ) {
|
||||
Vector2 v = uluaGetVector2( L, 1 );
|
||||
|
||||
uluaPushVector2( L, Vector2Negate( v ) );
|
||||
@@ -379,7 +379,7 @@ Divide vector by vector
|
||||
|
||||
- Success return Vector2
|
||||
*/
|
||||
int lmathVector2Divide( lua_State *L ) {
|
||||
int lmathVector2Divide( lua_State* L ) {
|
||||
Vector2 v1 = uluaGetVector2( L, 1 );
|
||||
Vector2 v2 = uluaGetVector2( L, 2 );
|
||||
|
||||
@@ -395,7 +395,7 @@ Normalize provided vector
|
||||
|
||||
- Success return Vector2
|
||||
*/
|
||||
int lmathVector2Normalize( lua_State *L ) {
|
||||
int lmathVector2Normalize( lua_State* L ) {
|
||||
Vector2 v = uluaGetVector2( L, 1 );
|
||||
|
||||
uluaPushVector2( L, Vector2Normalize( v ) );
|
||||
@@ -410,7 +410,7 @@ Transforms a Vector2 by a given Matrix
|
||||
|
||||
- Success return Vector2
|
||||
*/
|
||||
int lmathVector2Transform( lua_State *L ) {
|
||||
int lmathVector2Transform( lua_State* L ) {
|
||||
Vector2 v = uluaGetVector2( L, 1 );
|
||||
Matrix mat = uluaGetMatrix( L, 2 );
|
||||
|
||||
@@ -426,7 +426,7 @@ Calculate linear interpolation between two vectors
|
||||
|
||||
- Success return Vector2
|
||||
*/
|
||||
int lmathVector2Lerp( lua_State *L ) {
|
||||
int lmathVector2Lerp( lua_State* L ) {
|
||||
Vector2 v1 = uluaGetVector2( L, 1 );
|
||||
Vector2 v2 = uluaGetVector2( L, 2 );
|
||||
float amount = luaL_checknumber( L, 3 );
|
||||
@@ -443,7 +443,7 @@ Calculate reflected vector to normal
|
||||
|
||||
- Success return Vector2
|
||||
*/
|
||||
int lmathVector2Reflect( lua_State *L ) {
|
||||
int lmathVector2Reflect( lua_State* L ) {
|
||||
Vector2 v1 = uluaGetVector2( L, 1 );
|
||||
Vector2 v2 = uluaGetVector2( L, 2 );
|
||||
|
||||
@@ -459,7 +459,7 @@ Rotate vector by angle
|
||||
|
||||
- Success return Vector2
|
||||
*/
|
||||
int lmathVector2Rotate( lua_State *L ) {
|
||||
int lmathVector2Rotate( lua_State* L ) {
|
||||
Vector2 v = uluaGetVector2( L, 1 );
|
||||
float degs = luaL_checknumber( L, 2 );
|
||||
|
||||
@@ -475,7 +475,7 @@ Move Vector towards target
|
||||
|
||||
- Success return Vector2
|
||||
*/
|
||||
int lmathVector2MoveTowards( lua_State *L ) {
|
||||
int lmathVector2MoveTowards( lua_State* L ) {
|
||||
Vector2 v1 = uluaGetVector2( L, 1 );
|
||||
Vector2 v2 = uluaGetVector2( L, 2 );
|
||||
float maxDistance = luaL_checknumber( L, 3 );
|
||||
@@ -492,7 +492,7 @@ Invert the given vector
|
||||
|
||||
- Success return Vector2
|
||||
*/
|
||||
int lmathVector2Invert( lua_State *L ) {
|
||||
int lmathVector2Invert( lua_State* L ) {
|
||||
Vector2 v = uluaGetVector2( L, 1 );
|
||||
|
||||
uluaPushVector2( L, Vector2Invert( v ) );
|
||||
@@ -508,7 +508,7 @@ min and max values specified by the given vectors
|
||||
|
||||
- Success return Vector2
|
||||
*/
|
||||
int lmathVector2Clamp( lua_State *L ) {
|
||||
int lmathVector2Clamp( lua_State* L ) {
|
||||
Vector2 v = uluaGetVector2( L, 1 );
|
||||
Vector2 min = uluaGetVector2( L, 2 );
|
||||
Vector2 max = uluaGetVector2( L, 3 );
|
||||
@@ -525,7 +525,7 @@ Clamp the magnitude of the vector between two min and max values
|
||||
|
||||
- Success return Vector2
|
||||
*/
|
||||
int lmathVector2ClampValue( lua_State *L ) {
|
||||
int lmathVector2ClampValue( lua_State* L ) {
|
||||
Vector2 v = uluaGetVector2( L, 1 );
|
||||
float min = luaL_checknumber( L, 2 );
|
||||
float max = luaL_checknumber( L, 3 );
|
||||
@@ -542,7 +542,7 @@ Check whether two given vectors are almost equal
|
||||
|
||||
- Success return int
|
||||
*/
|
||||
int lmathVector2Equals( lua_State *L ) {
|
||||
int lmathVector2Equals( lua_State* L ) {
|
||||
Vector2 v1 = uluaGetVector2( L, 1 );
|
||||
Vector2 v2 = uluaGetVector2( L, 2 );
|
||||
|
||||
@@ -562,7 +562,7 @@ Vector with components value 0.0f
|
||||
|
||||
- Success return Vector3
|
||||
*/
|
||||
int lmathVector3Zero( lua_State *L ) {
|
||||
int lmathVector3Zero( lua_State* L ) {
|
||||
uluaPushVector3( L, Vector3Zero() );
|
||||
|
||||
return 1;
|
||||
@@ -575,7 +575,7 @@ Vector with components value 1.0f
|
||||
|
||||
- Success return Vector3
|
||||
*/
|
||||
int lmathVector3One( lua_State *L ) {
|
||||
int lmathVector3One( lua_State* L ) {
|
||||
uluaPushVector3( L, Vector3One() );
|
||||
|
||||
return 1;
|
||||
@@ -588,7 +588,7 @@ Add two vectors
|
||||
|
||||
- Success return Vector3
|
||||
*/
|
||||
int lmathVector3Add( lua_State *L ) {
|
||||
int lmathVector3Add( lua_State* L ) {
|
||||
Vector3 v1 = uluaGetVector3( L, 1 );
|
||||
Vector3 v2 = uluaGetVector3( L, 2 );
|
||||
|
||||
@@ -604,7 +604,7 @@ Add vector and float value
|
||||
|
||||
- Success return Vector3
|
||||
*/
|
||||
int lmathVector3AddValue( lua_State *L ) {
|
||||
int lmathVector3AddValue( lua_State* L ) {
|
||||
Vector3 v = uluaGetVector3( L, 1 );
|
||||
float add = luaL_checknumber( L, 2 );
|
||||
|
||||
@@ -620,7 +620,7 @@ Subtract two vectors
|
||||
|
||||
- Success return Vector3
|
||||
*/
|
||||
int lmathVector3Subtract( lua_State *L ) {
|
||||
int lmathVector3Subtract( lua_State* L ) {
|
||||
Vector3 v1 = uluaGetVector3( L, 1 );
|
||||
Vector3 v2 = uluaGetVector3( L, 2 );
|
||||
|
||||
@@ -636,7 +636,7 @@ Subtract vector by float value
|
||||
|
||||
- Success return Vector3
|
||||
*/
|
||||
int lmathVector3SubtractValue( lua_State *L ) {
|
||||
int lmathVector3SubtractValue( lua_State* L ) {
|
||||
Vector3 v = uluaGetVector3( L, 1 );
|
||||
float sub = luaL_checknumber( L, 2 );
|
||||
|
||||
@@ -652,7 +652,7 @@ Multiply vector by scalar
|
||||
|
||||
- Success return Vector3
|
||||
*/
|
||||
int lmathVector3Scale( lua_State *L ) {
|
||||
int lmathVector3Scale( lua_State* L ) {
|
||||
Vector3 v = uluaGetVector3( L, 1 );
|
||||
float scalar = luaL_checknumber( L, 2 );
|
||||
|
||||
@@ -668,7 +668,7 @@ Multiply vector by vector
|
||||
|
||||
- Success return Vector3
|
||||
*/
|
||||
int lmathVector3Multiply( lua_State *L ) {
|
||||
int lmathVector3Multiply( lua_State* L ) {
|
||||
Vector3 v1 = uluaGetVector3( L, 1 );
|
||||
Vector3 v2 = uluaGetVector3( L, 2 );
|
||||
|
||||
@@ -684,7 +684,7 @@ Calculate two vectors cross product
|
||||
|
||||
- Success return Vector3
|
||||
*/
|
||||
int lmathVector3CrossProduct( lua_State *L ) {
|
||||
int lmathVector3CrossProduct( lua_State* L ) {
|
||||
Vector3 v1 = uluaGetVector3( L, 1 );
|
||||
Vector3 v2 = uluaGetVector3( L, 2 );
|
||||
|
||||
@@ -700,7 +700,7 @@ Calculate one vector perpendicular vector
|
||||
|
||||
- Success return Vector3
|
||||
*/
|
||||
int lmathVector3Perpendicular( lua_State *L ) {
|
||||
int lmathVector3Perpendicular( lua_State* L ) {
|
||||
Vector3 v = uluaGetVector3( L, 1 );
|
||||
|
||||
uluaPushVector3( L, Vector3Perpendicular( v ) );
|
||||
@@ -715,7 +715,7 @@ Calculate vector length
|
||||
|
||||
- Success return float
|
||||
*/
|
||||
int lmathVector3Length( lua_State *L ) {
|
||||
int lmathVector3Length( lua_State* L ) {
|
||||
Vector3 v = uluaGetVector3( L, 1 );
|
||||
|
||||
lua_pushnumber( L, Vector3Length( v ) );
|
||||
@@ -730,7 +730,7 @@ Calculate vector square length
|
||||
|
||||
- Success return float
|
||||
*/
|
||||
int lmathVector3LengthSqr( lua_State *L ) {
|
||||
int lmathVector3LengthSqr( lua_State* L ) {
|
||||
Vector3 v = uluaGetVector3( L, 1 );
|
||||
|
||||
lua_pushnumber( L, Vector3LengthSqr( v ) );
|
||||
@@ -745,7 +745,7 @@ Calculate two vectors dot product
|
||||
|
||||
- Success return float
|
||||
*/
|
||||
int lmathVector3DotProduct( lua_State *L ) {
|
||||
int lmathVector3DotProduct( lua_State* L ) {
|
||||
Vector3 v1 = uluaGetVector3( L, 1 );
|
||||
Vector3 v2 = uluaGetVector3( L, 2 );
|
||||
|
||||
@@ -761,7 +761,7 @@ Calculate distance between two vectors
|
||||
|
||||
- Success return float
|
||||
*/
|
||||
int lmathVector3Distance( lua_State *L ) {
|
||||
int lmathVector3Distance( lua_State* L ) {
|
||||
Vector3 v1 = uluaGetVector3( L, 1 );
|
||||
Vector3 v2 = uluaGetVector3( L, 2 );
|
||||
|
||||
@@ -777,7 +777,7 @@ Calculate square distance between two vectors
|
||||
|
||||
- Success return float
|
||||
*/
|
||||
int lmathVector3DistanceSqr( lua_State *L ) {
|
||||
int lmathVector3DistanceSqr( lua_State* L ) {
|
||||
Vector3 v1 = uluaGetVector3( L, 1 );
|
||||
Vector3 v2 = uluaGetVector3( L, 2 );
|
||||
|
||||
@@ -793,7 +793,7 @@ Calculate angle between two vectors
|
||||
|
||||
- Success return float
|
||||
*/
|
||||
int lmathVector3Angle( lua_State *L ) {
|
||||
int lmathVector3Angle( lua_State* L ) {
|
||||
Vector3 v1 = uluaGetVector3( L, 1 );
|
||||
Vector3 v2 = uluaGetVector3( L, 2 );
|
||||
|
||||
@@ -809,7 +809,7 @@ Negate provided vector (invert direction)
|
||||
|
||||
- Success return Vector3
|
||||
*/
|
||||
int lmathVector3Negate( lua_State *L ) {
|
||||
int lmathVector3Negate( lua_State* L ) {
|
||||
Vector3 v = uluaGetVector3( L, 1 );
|
||||
|
||||
uluaPushVector3( L, Vector3Negate( v ) );
|
||||
@@ -824,7 +824,7 @@ Divide vector by vector
|
||||
|
||||
- Success return Vector3
|
||||
*/
|
||||
int lmathVector3Divide( lua_State *L ) {
|
||||
int lmathVector3Divide( lua_State* L ) {
|
||||
Vector3 v1 = uluaGetVector3( L, 1 );
|
||||
Vector3 v2 = uluaGetVector3( L, 2 );
|
||||
|
||||
@@ -840,7 +840,7 @@ Normalize provided vector
|
||||
|
||||
- Success return Vector3
|
||||
*/
|
||||
int lmathVector3Normalize( lua_State *L ) {
|
||||
int lmathVector3Normalize( lua_State* L ) {
|
||||
Vector3 v = uluaGetVector3( L, 1 );
|
||||
|
||||
uluaPushVector3( L, Vector3Normalize( v ) );
|
||||
@@ -856,7 +856,7 @@ Gram-Schmidt function implementation
|
||||
|
||||
- Success return Vector3, Vector3
|
||||
*/
|
||||
int lmathVector3OrthoNormalize( lua_State *L ) {
|
||||
int lmathVector3OrthoNormalize( lua_State* L ) {
|
||||
Vector3 v1 = uluaGetVector3( L, 1 );
|
||||
Vector3 v2 = uluaGetVector3( L, 2 );
|
||||
|
||||
@@ -875,7 +875,7 @@ Transforms a Vector3 by a given Matrix
|
||||
|
||||
- Success return Vector3
|
||||
*/
|
||||
int lmathVector3Transform( lua_State *L ) {
|
||||
int lmathVector3Transform( lua_State* L ) {
|
||||
Vector3 v = uluaGetVector3( L, 1 );
|
||||
Matrix mat = uluaGetMatrix( L, 2 );
|
||||
|
||||
@@ -891,7 +891,7 @@ Transform a vector by quaternion rotation
|
||||
|
||||
- Success return Vector3
|
||||
*/
|
||||
int lmathVector3RotateByQuaternion( lua_State *L ) {
|
||||
int lmathVector3RotateByQuaternion( lua_State* L ) {
|
||||
Vector3 v = uluaGetVector3( L, 1 );
|
||||
Quaternion q = uluaGetQuaternion( L, 2 );
|
||||
|
||||
@@ -907,7 +907,7 @@ Rotates a vector around an axis
|
||||
|
||||
- Success return Vector3
|
||||
*/
|
||||
int lmathVector3RotateByAxisAngle( lua_State *L ) {
|
||||
int lmathVector3RotateByAxisAngle( lua_State* L ) {
|
||||
Vector3 v = uluaGetVector3( L, 1 );
|
||||
Vector3 axis = uluaGetVector3( L, 2 );
|
||||
float angle = luaL_checknumber( L, 3 );
|
||||
@@ -924,7 +924,7 @@ Calculate linear interpolation between two vectors
|
||||
|
||||
- Success return Vector3
|
||||
*/
|
||||
int lmathVector3Lerp( lua_State *L ) {
|
||||
int lmathVector3Lerp( lua_State* L ) {
|
||||
Vector3 v1 = uluaGetVector3( L, 1 );
|
||||
Vector3 v2 = uluaGetVector3( L, 2 );
|
||||
float amount = luaL_checknumber( L, 3 );
|
||||
@@ -941,7 +941,7 @@ Calculate reflected vector to normal
|
||||
|
||||
- Success return Vector3
|
||||
*/
|
||||
int lmathVector3Reflect( lua_State *L ) {
|
||||
int lmathVector3Reflect( lua_State* L ) {
|
||||
Vector3 v = uluaGetVector3( L, 1 );
|
||||
Vector3 normal = uluaGetVector3( L, 2 );
|
||||
|
||||
@@ -957,7 +957,7 @@ Get min value for each pair of components
|
||||
|
||||
- Success return Vector3
|
||||
*/
|
||||
int lmathVector3Min( lua_State *L ) {
|
||||
int lmathVector3Min( lua_State* L ) {
|
||||
Vector3 v1 = uluaGetVector3( L, 1 );
|
||||
Vector3 v2 = uluaGetVector3( L, 2 );
|
||||
|
||||
@@ -973,7 +973,7 @@ Get max value for each pair of components
|
||||
|
||||
- Success return Vector3
|
||||
*/
|
||||
int lmathVector3Max( lua_State *L ) {
|
||||
int lmathVector3Max( lua_State* L ) {
|
||||
Vector3 v1 = uluaGetVector3( L, 1 );
|
||||
Vector3 v2 = uluaGetVector3( L, 2 );
|
||||
|
||||
@@ -990,7 +990,7 @@ NOTE: Assumes P is on the plane of the triangle
|
||||
|
||||
- Success return Vector3
|
||||
*/
|
||||
int lmathVector3Barycenter( lua_State *L ) {
|
||||
int lmathVector3Barycenter( lua_State* L ) {
|
||||
Vector3 p = uluaGetVector3( L, 1 );
|
||||
Vector3 a = uluaGetVector3( L, 2 );
|
||||
Vector3 b = uluaGetVector3( L, 3 );
|
||||
@@ -1009,7 +1009,7 @@ NOTE: We are avoiding calling other raymath functions despite available
|
||||
|
||||
- Success return Vector3
|
||||
*/
|
||||
int lmathVector3Unproject( lua_State *L ) {
|
||||
int lmathVector3Unproject( lua_State* L ) {
|
||||
Vector3 source = uluaGetVector3( L, 1 );
|
||||
Matrix projection = uluaGetMatrix( L, 2 );
|
||||
Matrix view = uluaGetMatrix( L, 3 );
|
||||
@@ -1026,7 +1026,7 @@ Invert the given vector
|
||||
|
||||
- Success return Vector3
|
||||
*/
|
||||
int lmathVector3Invert( lua_State *L ) {
|
||||
int lmathVector3Invert( lua_State* L ) {
|
||||
Vector3 v = uluaGetVector3( L, 1 );
|
||||
|
||||
uluaPushVector3( L, Vector3Invert( v ) );
|
||||
@@ -1042,7 +1042,7 @@ min and max values specified by the given vectors
|
||||
|
||||
- Success return Vector3
|
||||
*/
|
||||
int lmathVector3Clamp( lua_State *L ) {
|
||||
int lmathVector3Clamp( lua_State* L ) {
|
||||
Vector3 v = uluaGetVector3( L, 1 );
|
||||
Vector3 min = uluaGetVector3( L, 2 );
|
||||
Vector3 max = uluaGetVector3( L, 3 );
|
||||
@@ -1059,7 +1059,7 @@ Clamp the magnitude of the vector between two values
|
||||
|
||||
- Success return Vector3
|
||||
*/
|
||||
int lmathVector3ClampValue( lua_State *L ) {
|
||||
int lmathVector3ClampValue( lua_State* L ) {
|
||||
Vector3 v = uluaGetVector3( L, 1 );
|
||||
float min = luaL_checknumber( L, 2 );
|
||||
float max = luaL_checknumber( L, 3 );
|
||||
@@ -1076,7 +1076,7 @@ Check whether two given vectors are almost equal
|
||||
|
||||
- Success return int
|
||||
*/
|
||||
int lmathVector3Equals( lua_State *L ) {
|
||||
int lmathVector3Equals( lua_State* L ) {
|
||||
Vector3 v1 = uluaGetVector3( L, 1 );
|
||||
Vector3 v2 = uluaGetVector3( L, 2 );
|
||||
|
||||
@@ -1097,7 +1097,7 @@ on the other side of the surface
|
||||
|
||||
- Success return Vector3
|
||||
*/
|
||||
int lmathVector3Refract( lua_State *L ) {
|
||||
int lmathVector3Refract( lua_State* L ) {
|
||||
Vector3 v = uluaGetVector3( L, 1 );
|
||||
Vector3 n = uluaGetVector3( L, 2 );
|
||||
float r = luaL_checknumber( L, 3 );
|
||||
@@ -1118,7 +1118,7 @@ Compute matrix determinant
|
||||
|
||||
- Success return float
|
||||
*/
|
||||
int lmathMatrixDeterminant( lua_State *L ) {
|
||||
int lmathMatrixDeterminant( lua_State* L ) {
|
||||
Matrix mat = uluaGetMatrix( L, 1 );
|
||||
|
||||
lua_pushnumber( L, MatrixDeterminant( mat ) );
|
||||
@@ -1133,7 +1133,7 @@ Get the trace of the matrix (sum of the values along the diagonal)
|
||||
|
||||
- Success return float
|
||||
*/
|
||||
int lmathMatrixTrace( lua_State *L ) {
|
||||
int lmathMatrixTrace( lua_State* L ) {
|
||||
Matrix mat = uluaGetMatrix( L, 1 );
|
||||
|
||||
lua_pushnumber( L, MatrixTrace( mat ) );
|
||||
@@ -1148,7 +1148,7 @@ Transposes provided matrix
|
||||
|
||||
- Success return Matrix
|
||||
*/
|
||||
int lmathMatrixTranspose( lua_State *L ) {
|
||||
int lmathMatrixTranspose( lua_State* L ) {
|
||||
Matrix mat = uluaGetMatrix( L, 1 );
|
||||
|
||||
uluaPushMatrix( L, MatrixTranspose( mat ) );
|
||||
@@ -1163,7 +1163,7 @@ Invert provided matrix
|
||||
|
||||
- Success return Matrix
|
||||
*/
|
||||
int lmathMatrixInvert( lua_State *L ) {
|
||||
int lmathMatrixInvert( lua_State* L ) {
|
||||
Matrix mat = uluaGetMatrix( L, 1 );
|
||||
|
||||
uluaPushMatrix( L, MatrixInvert( mat ) );
|
||||
@@ -1178,7 +1178,7 @@ Get identity matrix
|
||||
|
||||
- Success return Matrix
|
||||
*/
|
||||
int lmathMatrixIdentity( lua_State *L ) {
|
||||
int lmathMatrixIdentity( lua_State* L ) {
|
||||
uluaPushMatrix( L, MatrixIdentity() );
|
||||
|
||||
return 1;
|
||||
@@ -1191,7 +1191,7 @@ Add two matrices
|
||||
|
||||
- Success return Matrix
|
||||
*/
|
||||
int lmathMatrixAdd( lua_State *L ) {
|
||||
int lmathMatrixAdd( lua_State* L ) {
|
||||
Matrix mat1 = uluaGetMatrix( L, 1 );
|
||||
Matrix mat2 = uluaGetMatrix( L, 2 );
|
||||
|
||||
@@ -1207,7 +1207,7 @@ Subtract two matrices (left - right)
|
||||
|
||||
- Success return Matrix
|
||||
*/
|
||||
int lmathMatrixSubtract( lua_State *L ) {
|
||||
int lmathMatrixSubtract( lua_State* L ) {
|
||||
Matrix mat1 = uluaGetMatrix( L, 1 );
|
||||
Matrix mat2 = uluaGetMatrix( L, 2 );
|
||||
|
||||
@@ -1223,7 +1223,7 @@ Get two matrix multiplication
|
||||
|
||||
- Success return Matrix
|
||||
*/
|
||||
int lmathMatrixMultiply( lua_State *L ) {
|
||||
int lmathMatrixMultiply( lua_State* L ) {
|
||||
Matrix mat1 = uluaGetMatrix( L, 1 );
|
||||
Matrix mat2 = uluaGetMatrix( L, 2 );
|
||||
|
||||
@@ -1239,7 +1239,7 @@ Get translation matrix
|
||||
|
||||
- Success return Matrix
|
||||
*/
|
||||
int lmathMatrixTranslate( lua_State *L ) {
|
||||
int lmathMatrixTranslate( lua_State* L ) {
|
||||
Vector3 v = uluaGetVector3( L, 1 );
|
||||
|
||||
uluaPushMatrix( L, MatrixTranslate( v.x, v.y, v.z ) );
|
||||
@@ -1254,7 +1254,7 @@ Create rotation matrix from axis and angle. NOTE: Angle should be provided in ra
|
||||
|
||||
- Success return Matrix
|
||||
*/
|
||||
int lmathMatrixRotate( lua_State *L ) {
|
||||
int lmathMatrixRotate( lua_State* L ) {
|
||||
Vector3 axis = uluaGetVector3( L, 1 );
|
||||
float angle = luaL_checknumber( L, 2 );
|
||||
|
||||
@@ -1270,7 +1270,7 @@ Get x-rotation matrix (angle in radians)
|
||||
|
||||
- Success return Matrix
|
||||
*/
|
||||
int lmathMatrixRotateX( lua_State *L ) {
|
||||
int lmathMatrixRotateX( lua_State* L ) {
|
||||
float angle = luaL_checknumber( L, 1 );
|
||||
|
||||
uluaPushMatrix( L, MatrixRotateX( angle ) );
|
||||
@@ -1285,7 +1285,7 @@ Get y-rotation matrix (angle in radians)
|
||||
|
||||
- Success return Matrix
|
||||
*/
|
||||
int lmathMatrixRotateY( lua_State *L ) {
|
||||
int lmathMatrixRotateY( lua_State* L ) {
|
||||
float angle = luaL_checknumber( L, 1 );
|
||||
|
||||
uluaPushMatrix( L, MatrixRotateY( angle ) );
|
||||
@@ -1300,7 +1300,7 @@ Get z-rotation matrix (angle in radians)
|
||||
|
||||
- Success return Matrix
|
||||
*/
|
||||
int lmathMatrixRotateZ( lua_State *L ) {
|
||||
int lmathMatrixRotateZ( lua_State* L ) {
|
||||
float angle = luaL_checknumber( L, 1 );
|
||||
|
||||
uluaPushMatrix( L, MatrixRotateZ( angle ) );
|
||||
@@ -1315,7 +1315,7 @@ Get xyz-rotation matrix (angles in radians)
|
||||
|
||||
- Success return Matrix
|
||||
*/
|
||||
int lmathMatrixRotateXYZ( lua_State *L ) {
|
||||
int lmathMatrixRotateXYZ( lua_State* L ) {
|
||||
Vector3 angle = uluaGetVector3( L, 1 );
|
||||
|
||||
uluaPushMatrix( L, MatrixRotateXYZ( angle ) );
|
||||
@@ -1330,7 +1330,7 @@ Get zyx-rotation matrix (angles in radians)
|
||||
|
||||
- Success return Matrix
|
||||
*/
|
||||
int lmathMatrixRotateZYX( lua_State *L ) {
|
||||
int lmathMatrixRotateZYX( lua_State* L ) {
|
||||
Vector3 angle = uluaGetVector3( L, 1 );
|
||||
|
||||
uluaPushMatrix( L, MatrixRotateZYX( angle ) );
|
||||
@@ -1345,7 +1345,7 @@ Get scaling matrix
|
||||
|
||||
- Success return Matrix
|
||||
*/
|
||||
int lmathMatrixScale( lua_State *L ) {
|
||||
int lmathMatrixScale( lua_State* L ) {
|
||||
Vector3 v = uluaGetVector3( L, 1 );
|
||||
|
||||
uluaPushMatrix( L, MatrixScale( v.x, v.y, v.z ) );
|
||||
@@ -1360,7 +1360,7 @@ Get perspective projection matrix
|
||||
|
||||
- Success return Matrix
|
||||
*/
|
||||
int lmathMatrixFrustum( lua_State *L ) {
|
||||
int lmathMatrixFrustum( lua_State* L ) {
|
||||
float left = luaL_checknumber( L, 1 );
|
||||
float right = luaL_checknumber( L, 2);
|
||||
float bottom = luaL_checknumber( L, 3 );
|
||||
@@ -1380,7 +1380,7 @@ Get perspective projection matrix
|
||||
|
||||
- Success return Matrix
|
||||
*/
|
||||
int lmathMatrixPerspective( lua_State *L ) {
|
||||
int lmathMatrixPerspective( lua_State* L ) {
|
||||
float fovy = luaL_checknumber( L, 1 );
|
||||
float aspect = luaL_checknumber( L, 2 );
|
||||
float near = luaL_checknumber( L, 3 );
|
||||
@@ -1398,7 +1398,7 @@ Get orthographic projection matrix
|
||||
|
||||
- Success return Matrix
|
||||
*/
|
||||
int lmathMatrixOrtho( lua_State *L ) {
|
||||
int lmathMatrixOrtho( lua_State* L ) {
|
||||
float left = luaL_checknumber( L, 1 );
|
||||
float right = luaL_checknumber( L, 2 );
|
||||
float bottom = luaL_checknumber( L, 3 );
|
||||
@@ -1418,7 +1418,7 @@ Get camera look-at matrix (View matrix)
|
||||
|
||||
- Success return Matrix
|
||||
*/
|
||||
int lmathMatrixLookAt( lua_State *L ) {
|
||||
int lmathMatrixLookAt( lua_State* L ) {
|
||||
Vector3 eye = uluaGetVector3( L, 1 );
|
||||
Vector3 target = uluaGetVector3( L, 2 );
|
||||
Vector3 up = uluaGetVector3( L, 3 );
|
||||
@@ -1439,7 +1439,7 @@ Add two quaternions
|
||||
|
||||
- Success return Quaternion
|
||||
*/
|
||||
int lmathQuaternionAdd( lua_State *L ) {
|
||||
int lmathQuaternionAdd( lua_State* L ) {
|
||||
Quaternion q1 = uluaGetQuaternion( L, 1 );
|
||||
Quaternion q2 = uluaGetQuaternion( L, 2 );
|
||||
|
||||
@@ -1455,7 +1455,7 @@ Add quaternion and float value
|
||||
|
||||
- Success return Quaternion
|
||||
*/
|
||||
int lmathQuaternionAddValue( lua_State *L ) {
|
||||
int lmathQuaternionAddValue( lua_State* L ) {
|
||||
Quaternion q = uluaGetQuaternion( L, 1 );
|
||||
float add = luaL_checknumber( L, 2 );
|
||||
|
||||
@@ -1471,7 +1471,7 @@ Subtract two quaternions
|
||||
|
||||
- Success return Quaternion
|
||||
*/
|
||||
int lmathQuaternionSubtract( lua_State *L ) {
|
||||
int lmathQuaternionSubtract( lua_State* L ) {
|
||||
Quaternion q1 = uluaGetQuaternion( L, 1 );
|
||||
Quaternion q2 = uluaGetQuaternion( L, 2 );
|
||||
|
||||
@@ -1487,7 +1487,7 @@ Subtract quaternion and float value
|
||||
|
||||
- Success return Quaternion
|
||||
*/
|
||||
int lmathQuaternionSubtractValue( lua_State *L ) {
|
||||
int lmathQuaternionSubtractValue( lua_State* L ) {
|
||||
Quaternion q = uluaGetQuaternion( L, 1 );
|
||||
float sub = luaL_checknumber( L, 2 );
|
||||
|
||||
@@ -1503,7 +1503,7 @@ Get identity quaternion
|
||||
|
||||
- Success return Quaternion
|
||||
*/
|
||||
int lmathQuaternionIdentity( lua_State *L ) {
|
||||
int lmathQuaternionIdentity( lua_State* L ) {
|
||||
uluaPushQuaternion( L, QuaternionIdentity() );
|
||||
|
||||
return 1;
|
||||
@@ -1516,7 +1516,7 @@ Computes the length of a quaternion
|
||||
|
||||
- Success return float
|
||||
*/
|
||||
int lmathQuaternionLength( lua_State *L ) {
|
||||
int lmathQuaternionLength( lua_State* L ) {
|
||||
Quaternion q = uluaGetQuaternion( L, 1 );
|
||||
|
||||
lua_pushnumber( L, QuaternionLength( q ) );
|
||||
@@ -1531,7 +1531,7 @@ Normalize provided quaternion
|
||||
|
||||
- Success return Quaternion
|
||||
*/
|
||||
int lmathQuaternionNormalize( lua_State *L ) {
|
||||
int lmathQuaternionNormalize( lua_State* L ) {
|
||||
Quaternion q = uluaGetQuaternion( L, 1 );
|
||||
|
||||
uluaPushQuaternion( L, QuaternionNormalize( q ) );
|
||||
@@ -1546,7 +1546,7 @@ Invert provided quaternion
|
||||
|
||||
- Success return Quaternion
|
||||
*/
|
||||
int lmathQuaternionInvert( lua_State *L ) {
|
||||
int lmathQuaternionInvert( lua_State* L ) {
|
||||
Quaternion q = uluaGetQuaternion( L, 1 );
|
||||
|
||||
uluaPushQuaternion( L, QuaternionInvert( q ) );
|
||||
@@ -1561,7 +1561,7 @@ Calculate two quaternion multiplication
|
||||
|
||||
- Success return Quaternion
|
||||
*/
|
||||
int lmathQuaternionMultiply( lua_State *L ) {
|
||||
int lmathQuaternionMultiply( lua_State* L ) {
|
||||
Quaternion q1 = uluaGetQuaternion( L, 1 );
|
||||
Quaternion q2 = uluaGetQuaternion( L, 2 );
|
||||
|
||||
@@ -1577,7 +1577,7 @@ Scale quaternion by float value
|
||||
|
||||
- Success return Quaternion
|
||||
*/
|
||||
int lmathQuaternionScale( lua_State *L ) {
|
||||
int lmathQuaternionScale( lua_State* L ) {
|
||||
Quaternion q = uluaGetQuaternion( L, 1 );
|
||||
float mul = luaL_checknumber( L, 2 );
|
||||
|
||||
@@ -1593,7 +1593,7 @@ Divide two quaternions
|
||||
|
||||
- Success return Quaternion
|
||||
*/
|
||||
int lmathQuaternionDivide( lua_State *L ) {
|
||||
int lmathQuaternionDivide( lua_State* L ) {
|
||||
Quaternion q1 = uluaGetQuaternion( L, 1 );
|
||||
Quaternion q2 = uluaGetQuaternion( L, 2 );
|
||||
|
||||
@@ -1609,7 +1609,7 @@ Calculate linear interpolation between two quaternions
|
||||
|
||||
- Success return Quaternion
|
||||
*/
|
||||
int lmathQuaternionLerp( lua_State *L ) {
|
||||
int lmathQuaternionLerp( lua_State* L ) {
|
||||
Quaternion q1 = uluaGetQuaternion( L, 1 );
|
||||
Quaternion q2 = uluaGetQuaternion( L, 2 );
|
||||
float amount = luaL_checknumber( L, 3 );
|
||||
@@ -1626,7 +1626,7 @@ Calculate slerp-optimized interpolation between two quaternions
|
||||
|
||||
- Success return Quaternion
|
||||
*/
|
||||
int lmathQuaternionNlerp( lua_State *L ) {
|
||||
int lmathQuaternionNlerp( lua_State* L ) {
|
||||
Quaternion q1 = uluaGetQuaternion( L, 1 );
|
||||
Quaternion q2 = uluaGetQuaternion( L, 2 );
|
||||
float amount = luaL_checknumber( L, 3 );
|
||||
@@ -1643,7 +1643,7 @@ Calculates spherical linear interpolation between two quaternions
|
||||
|
||||
- Success return Quaternion
|
||||
*/
|
||||
int lmathQuaternionSlerp( lua_State *L ) {
|
||||
int lmathQuaternionSlerp( lua_State* L ) {
|
||||
Quaternion q1 = uluaGetQuaternion( L, 1 );
|
||||
Quaternion q2 = uluaGetQuaternion( L, 2 );
|
||||
float amount = luaL_checknumber( L, 3 );
|
||||
@@ -1660,7 +1660,7 @@ Calculate quaternion based on the rotation from one vector to another
|
||||
|
||||
- Success return Quaternion
|
||||
*/
|
||||
int lmathQuaternionFromVector3ToVector3( lua_State *L ) {
|
||||
int lmathQuaternionFromVector3ToVector3( lua_State* L ) {
|
||||
Vector3 from = uluaGetVector3( L, 1 );
|
||||
Vector3 to = uluaGetVector3( L, 2 );
|
||||
|
||||
@@ -1676,7 +1676,7 @@ Get a quaternion for a given rotation matrix
|
||||
|
||||
- Success return Quaternion
|
||||
*/
|
||||
int lmathQuaternionFromMatrix( lua_State *L ) {
|
||||
int lmathQuaternionFromMatrix( lua_State* L ) {
|
||||
Matrix mat = uluaGetMatrix( L, 1 );
|
||||
|
||||
uluaPushQuaternion( L, QuaternionFromMatrix( mat ) );
|
||||
@@ -1691,7 +1691,7 @@ Get a quaternion for a given rotation matrix
|
||||
|
||||
- Success return Matrix
|
||||
*/
|
||||
int lmathQuaternionToMatrix( lua_State *L ) {
|
||||
int lmathQuaternionToMatrix( lua_State* L ) {
|
||||
Quaternion q = uluaGetQuaternion( L, 1 );
|
||||
|
||||
uluaPushMatrix( L, QuaternionToMatrix( q ) );
|
||||
@@ -1707,7 +1707,7 @@ NOTE: angle must be provided in radians
|
||||
|
||||
- Success return Quaternion
|
||||
*/
|
||||
int lmathQuaternionFromAxisAngle( lua_State *L ) {
|
||||
int lmathQuaternionFromAxisAngle( lua_State* L ) {
|
||||
Vector3 axis = uluaGetVector3( L, 1 );
|
||||
float angle = luaL_checknumber( L, 2 );
|
||||
|
||||
@@ -1723,7 +1723,7 @@ Get the rotation angle and axis for a given quaternion
|
||||
|
||||
- Success return Vector3, float
|
||||
*/
|
||||
int lmathQuaternionToAxisAngle( lua_State *L ) {
|
||||
int lmathQuaternionToAxisAngle( lua_State* L ) {
|
||||
Quaternion q = uluaGetQuaternion( L, 1 );
|
||||
float angle = 0.0;
|
||||
Vector3 axis = { 0.0 };
|
||||
@@ -1744,7 +1744,7 @@ NOTE: Rotation order is ZYX
|
||||
|
||||
- Success return Quaternion
|
||||
*/
|
||||
int lmathQuaternionFromEuler( lua_State *L ) {
|
||||
int lmathQuaternionFromEuler( lua_State* L ) {
|
||||
float pitch = luaL_checknumber( L, 1 );
|
||||
float yaw = luaL_checknumber( L, 2 );
|
||||
float roll = luaL_checknumber( L, 3 );
|
||||
@@ -1762,7 +1762,7 @@ NOTE: Angles are returned in a Vector3 struct in radians
|
||||
|
||||
- Success return Vector3
|
||||
*/
|
||||
int lmathQuaternionToEuler( lua_State *L ) {
|
||||
int lmathQuaternionToEuler( lua_State* L ) {
|
||||
Quaternion q = uluaGetQuaternion( L, 1 );
|
||||
|
||||
uluaPushVector3( L, QuaternionToEuler( q ) );
|
||||
@@ -1777,7 +1777,7 @@ Transform a quaternion given a transformation matrix
|
||||
|
||||
- Success return Quaternion
|
||||
*/
|
||||
int lmathQuaternionTransform( lua_State *L ) {
|
||||
int lmathQuaternionTransform( lua_State* L ) {
|
||||
Quaternion q = uluaGetQuaternion( L, 1 );
|
||||
Matrix mat = uluaGetMatrix( L, 2 );
|
||||
|
||||
@@ -1793,7 +1793,7 @@ Check whether two given quaternions are almost equal
|
||||
|
||||
- Success return int
|
||||
*/
|
||||
int lmathQuaternionEquals( lua_State *L ) {
|
||||
int lmathQuaternionEquals( lua_State* L ) {
|
||||
Quaternion q1 = uluaGetQuaternion( L, 1 );
|
||||
Quaternion q2 = uluaGetQuaternion( L, 2 );
|
||||
|
||||
|
||||
114
src/shapes.c
114
src/shapes.c
@@ -4,7 +4,7 @@
|
||||
#include "lua_core.h"
|
||||
#include "textures.h"
|
||||
|
||||
static inline void getVector2Array( lua_State *L, int index, Vector2 points[] ) {
|
||||
static inline void getVector2Array( lua_State* L, int index, Vector2 points[] ) {
|
||||
int t = index, i = 0;
|
||||
lua_pushnil( L );
|
||||
|
||||
@@ -26,8 +26,8 @@ Set texture and rectangle to be used on shapes drawing
|
||||
NOTE: It can be useful when using basic shapes and one single font,
|
||||
defining a font char white rectangle would allow drawing everything in a single draw call
|
||||
*/
|
||||
int lshapesSetShapesTexture( lua_State *L ) {
|
||||
Texture *texture = uluaGetTexture( L, 1 );
|
||||
int lshapesSetShapesTexture( lua_State* L ) {
|
||||
Texture* texture = uluaGetTexture( L, 1 );
|
||||
Rectangle source = uluaGetRectangle( L, 2 );
|
||||
|
||||
SetShapesTexture( *texture, source );
|
||||
@@ -40,7 +40,7 @@ int lshapesSetShapesTexture( lua_State *L ) {
|
||||
|
||||
Draw a pixel
|
||||
*/
|
||||
int lshapesDrawPixel( lua_State *L ) {
|
||||
int lshapesDrawPixel( lua_State* L ) {
|
||||
Vector2 pos = uluaGetVector2( L, 1 );
|
||||
Color color = uluaGetColor( L, 2 );
|
||||
|
||||
@@ -54,7 +54,7 @@ int lshapesDrawPixel( lua_State *L ) {
|
||||
|
||||
Draw a line defining thickness
|
||||
*/
|
||||
int lshapesDrawLine( lua_State *L ) {
|
||||
int lshapesDrawLine( lua_State* L ) {
|
||||
Vector2 startPos = uluaGetVector2( L, 1 );
|
||||
Vector2 endPos = uluaGetVector2( L, 2 );
|
||||
float thickness = luaL_checknumber( L, 3 );
|
||||
@@ -70,7 +70,7 @@ int lshapesDrawLine( lua_State *L ) {
|
||||
|
||||
Draw lines sequence
|
||||
*/
|
||||
int lshapesDrawLineStrip( lua_State *L ) {
|
||||
int lshapesDrawLineStrip( lua_State* L ) {
|
||||
int pointsCount = uluaGetTableLen( L, 1 );
|
||||
Color color = uluaGetColor( L, 2 );
|
||||
|
||||
@@ -95,7 +95,7 @@ int lshapesDrawLineStrip( lua_State *L ) {
|
||||
|
||||
Draw a line using cubic-bezier curves in-out
|
||||
*/
|
||||
int lshapesDrawLineBezier( lua_State *L ) {
|
||||
int lshapesDrawLineBezier( lua_State* L ) {
|
||||
Vector2 startPos = uluaGetVector2( L, 1 );
|
||||
Vector2 endPos = uluaGetVector2( L, 2 );
|
||||
float thickness = luaL_checknumber( L, 3 );
|
||||
@@ -111,7 +111,7 @@ int lshapesDrawLineBezier( lua_State *L ) {
|
||||
|
||||
Draw a color-filled circle
|
||||
*/
|
||||
int lshapesDrawCircle( lua_State *L ) {
|
||||
int lshapesDrawCircle( lua_State* L ) {
|
||||
Vector2 center = uluaGetVector2( L, 1 );
|
||||
float radius = luaL_checknumber( L, 2 );
|
||||
Color color = uluaGetColor( L, 3 );
|
||||
@@ -126,7 +126,7 @@ int lshapesDrawCircle( lua_State *L ) {
|
||||
|
||||
Draw a piece of a circle
|
||||
*/
|
||||
int lshapesDrawCircleSector( lua_State *L ) {
|
||||
int lshapesDrawCircleSector( lua_State* L ) {
|
||||
Vector2 center = uluaGetVector2( L, 1 );
|
||||
float radius = luaL_checknumber( L, 2 );
|
||||
float startAngle = luaL_checknumber( L, 3 );
|
||||
@@ -144,7 +144,7 @@ int lshapesDrawCircleSector( lua_State *L ) {
|
||||
|
||||
Draw circle sector outline
|
||||
*/
|
||||
int lshapesDrawCircleSectorLines( lua_State *L ) {
|
||||
int lshapesDrawCircleSectorLines( lua_State* L ) {
|
||||
Vector2 center = uluaGetVector2( L, 1 );
|
||||
float radius = luaL_checknumber( L, 2 );
|
||||
float startAngle = luaL_checknumber( L, 3 );
|
||||
@@ -162,7 +162,7 @@ int lshapesDrawCircleSectorLines( lua_State *L ) {
|
||||
|
||||
Draw a gradient-filled circle
|
||||
*/
|
||||
int lshapesDrawCircleGradient( lua_State *L ) {
|
||||
int lshapesDrawCircleGradient( lua_State* L ) {
|
||||
Vector2 center = uluaGetVector2( L, 1 );
|
||||
float radius = luaL_checknumber( L, 2 );
|
||||
Color color1 = uluaGetColor( L, 3 );
|
||||
@@ -178,7 +178,7 @@ int lshapesDrawCircleGradient( lua_State *L ) {
|
||||
|
||||
Draw circle outline
|
||||
*/
|
||||
int lshapesDrawCircleLines( lua_State *L ) {
|
||||
int lshapesDrawCircleLines( lua_State* L ) {
|
||||
Vector2 center = uluaGetVector2( L, 1 );
|
||||
float radius = luaL_checknumber( L, 2 );
|
||||
Color color = uluaGetColor( L, 3 );
|
||||
@@ -193,7 +193,7 @@ int lshapesDrawCircleLines( lua_State *L ) {
|
||||
|
||||
Draw ellipse
|
||||
*/
|
||||
int lshapesDrawEllipse( lua_State *L ) {
|
||||
int lshapesDrawEllipse( lua_State* L ) {
|
||||
Vector2 center = uluaGetVector2( L, 1 );
|
||||
float radiusH = luaL_checknumber( L, 2 );
|
||||
float radiusV = luaL_checknumber( L, 3 );
|
||||
@@ -209,7 +209,7 @@ int lshapesDrawEllipse( lua_State *L ) {
|
||||
|
||||
Draw ellipse outline
|
||||
*/
|
||||
int lshapesDrawEllipseLines( lua_State *L ) {
|
||||
int lshapesDrawEllipseLines( lua_State* L ) {
|
||||
Vector2 center = uluaGetVector2( L, 1 );
|
||||
float radiusH = luaL_checknumber( L, 2 );
|
||||
float radiusV = luaL_checknumber( L, 3 );
|
||||
@@ -225,7 +225,7 @@ int lshapesDrawEllipseLines( lua_State *L ) {
|
||||
|
||||
Draw ring
|
||||
*/
|
||||
int lshapesDrawRing( lua_State *L ) {
|
||||
int lshapesDrawRing( lua_State* L ) {
|
||||
Vector2 center = uluaGetVector2( L, 1 );
|
||||
float innerRadius = luaL_checknumber( L, 2 );
|
||||
float outerRadius = luaL_checknumber( L, 3 );
|
||||
@@ -244,7 +244,7 @@ int lshapesDrawRing( lua_State *L ) {
|
||||
|
||||
Draw ring outline
|
||||
*/
|
||||
int lshapesDrawRingLines( lua_State *L ) {
|
||||
int lshapesDrawRingLines( lua_State* L ) {
|
||||
Vector2 center = uluaGetVector2( L, 1 );
|
||||
float innerRadius = luaL_checknumber( L, 2 );
|
||||
float outerRadius = luaL_checknumber( L, 3 );
|
||||
@@ -263,7 +263,7 @@ int lshapesDrawRingLines( lua_State *L ) {
|
||||
|
||||
Draw a color-filled rectangle
|
||||
*/
|
||||
int lshapesDrawRectangle( lua_State *L ) {
|
||||
int lshapesDrawRectangle( lua_State* L ) {
|
||||
Rectangle rect = uluaGetRectangle( L, 1 );
|
||||
Color color = uluaGetColor( L, 2 );
|
||||
|
||||
@@ -277,7 +277,7 @@ int lshapesDrawRectangle( lua_State *L ) {
|
||||
|
||||
Draw a color-filled rectangle with pro parameters
|
||||
*/
|
||||
int lshapesDrawRectanglePro( lua_State *L ) {
|
||||
int lshapesDrawRectanglePro( lua_State* L ) {
|
||||
Rectangle rec = uluaGetRectangle( L, 1 );
|
||||
Vector2 origin = uluaGetVector2( L, 2 );
|
||||
float rotation = luaL_checknumber( L, 3 );
|
||||
@@ -293,7 +293,7 @@ int lshapesDrawRectanglePro( lua_State *L ) {
|
||||
|
||||
Draw a vertical-gradient-filled rectangle
|
||||
*/
|
||||
int lshapesDrawRectangleGradientV( lua_State *L ) {
|
||||
int lshapesDrawRectangleGradientV( lua_State* L ) {
|
||||
Rectangle rect = uluaGetRectangle( L, 1 );
|
||||
Color color1 = uluaGetColor( L, 2 );
|
||||
Color color2 = uluaGetColor( L, 3 );
|
||||
@@ -308,7 +308,7 @@ int lshapesDrawRectangleGradientV( lua_State *L ) {
|
||||
|
||||
Draw a horizontal-gradient-filled rectangle
|
||||
*/
|
||||
int lshapesDrawRectangleGradientH( lua_State *L ) {
|
||||
int lshapesDrawRectangleGradientH( lua_State* L ) {
|
||||
Rectangle rect = uluaGetRectangle( L, 1 );
|
||||
Color color1 = uluaGetColor( L, 2 );
|
||||
Color color2 = uluaGetColor( L, 3 );
|
||||
@@ -323,7 +323,7 @@ int lshapesDrawRectangleGradientH( lua_State *L ) {
|
||||
|
||||
Draw a gradient-filled rectangle with custom vertex colors
|
||||
*/
|
||||
int lshapesDrawRectangleGradientEx( lua_State *L ) {
|
||||
int lshapesDrawRectangleGradientEx( lua_State* L ) {
|
||||
Rectangle rect = uluaGetRectangle( L, 1 );
|
||||
Color color1 = uluaGetColor( L, 2 );
|
||||
Color color2 = uluaGetColor( L, 3 );
|
||||
@@ -340,7 +340,7 @@ int lshapesDrawRectangleGradientEx( lua_State *L ) {
|
||||
|
||||
Draw rectangle outline
|
||||
*/
|
||||
int lshapesDrawRectangleLines( lua_State *L ) {
|
||||
int lshapesDrawRectangleLines( lua_State* L ) {
|
||||
Rectangle rect = uluaGetRectangle( L, 1 );
|
||||
Color color = uluaGetColor( L, 2 );
|
||||
|
||||
@@ -354,7 +354,7 @@ int lshapesDrawRectangleLines( lua_State *L ) {
|
||||
|
||||
Draw rectangle outline with extended parameters
|
||||
*/
|
||||
int lshapesDrawRectangleLinesEx( lua_State *L ) {
|
||||
int lshapesDrawRectangleLinesEx( lua_State* L ) {
|
||||
Rectangle rect = uluaGetRectangle( L, 1 );
|
||||
int lineThick = luaL_checkinteger( L, 2 );
|
||||
Color color = uluaGetColor( L, 3 );
|
||||
@@ -369,7 +369,7 @@ int lshapesDrawRectangleLinesEx( lua_State *L ) {
|
||||
|
||||
Draw rectangle with rounded edges
|
||||
*/
|
||||
int lshapesDrawRectangleRounded( lua_State *L ) {
|
||||
int lshapesDrawRectangleRounded( lua_State* L ) {
|
||||
Rectangle rect = uluaGetRectangle( L, 1 );
|
||||
float roundness = luaL_checknumber( L, 2 );
|
||||
int segments = luaL_checkinteger( L, 3 );
|
||||
@@ -385,7 +385,7 @@ int lshapesDrawRectangleRounded( lua_State *L ) {
|
||||
|
||||
Draw rectangle with rounded edges outline
|
||||
*/
|
||||
int lshapesDrawRectangleRoundedLines( lua_State *L ) {
|
||||
int lshapesDrawRectangleRoundedLines( lua_State* L ) {
|
||||
Rectangle rect = uluaGetRectangle( L, 1 );
|
||||
float roundness = luaL_checknumber( L, 2 );
|
||||
int segments = luaL_checkinteger( L, 3 );
|
||||
@@ -402,7 +402,7 @@ int lshapesDrawRectangleRoundedLines( lua_State *L ) {
|
||||
|
||||
Draw a color-filled triangle (Vertex in counter-clockwise order!)
|
||||
*/
|
||||
int lshapesDrawTriangle( lua_State *L ) {
|
||||
int lshapesDrawTriangle( lua_State* L ) {
|
||||
Vector2 v1 = uluaGetVector2( L, 1 );
|
||||
Vector2 v2 = uluaGetVector2( L, 2 );
|
||||
Vector2 v3 = uluaGetVector2( L, 3 );
|
||||
@@ -418,7 +418,7 @@ int lshapesDrawTriangle( lua_State *L ) {
|
||||
|
||||
Draw triangle outline (Vertex in counter-clockwise order!)
|
||||
*/
|
||||
int lshapesDrawTriangleLines( lua_State *L ) {
|
||||
int lshapesDrawTriangleLines( lua_State* L ) {
|
||||
Vector2 v1 = uluaGetVector2( L, 1 );
|
||||
Vector2 v2 = uluaGetVector2( L, 2 );
|
||||
Vector2 v3 = uluaGetVector2( L, 3 );
|
||||
@@ -434,7 +434,7 @@ int lshapesDrawTriangleLines( lua_State *L ) {
|
||||
|
||||
Draw a triangle fan defined by points (first vertex is the center)
|
||||
*/
|
||||
int lshapesDrawTriangleFan( lua_State *L ) {
|
||||
int lshapesDrawTriangleFan( lua_State* L ) {
|
||||
int pointsCount = uluaGetTableLen( L, 1 );
|
||||
Color color = uluaGetColor( L, 2 );
|
||||
|
||||
@@ -459,7 +459,7 @@ int lshapesDrawTriangleFan( lua_State *L ) {
|
||||
|
||||
Draw a triangle strip defined by points
|
||||
*/
|
||||
int lshapesDrawTriangleStrip( lua_State *L ) {
|
||||
int lshapesDrawTriangleStrip( lua_State* L ) {
|
||||
int pointsCount = uluaGetTableLen( L, 1 );
|
||||
Color color = uluaGetColor( L, 2 );
|
||||
|
||||
@@ -484,7 +484,7 @@ int lshapesDrawTriangleStrip( lua_State *L ) {
|
||||
|
||||
Draw a regular polygon (Vector version)
|
||||
*/
|
||||
int lshapesDrawPoly( lua_State *L ) {
|
||||
int lshapesDrawPoly( lua_State* L ) {
|
||||
Vector2 center = uluaGetVector2( L, 1 );
|
||||
int sides = luaL_checkinteger( L, 2 );
|
||||
float radius = luaL_checknumber( L, 3 );
|
||||
@@ -501,7 +501,7 @@ int lshapesDrawPoly( lua_State *L ) {
|
||||
|
||||
Draw a polygon outline of n sides
|
||||
*/
|
||||
int lshapesDrawPolyLines( lua_State *L ) {
|
||||
int lshapesDrawPolyLines( lua_State* L ) {
|
||||
Vector2 center = uluaGetVector2( L, 1 );
|
||||
int sides = luaL_checkinteger( L, 2 );
|
||||
float radius = luaL_checknumber( L, 3 );
|
||||
@@ -518,7 +518,7 @@ int lshapesDrawPolyLines( lua_State *L ) {
|
||||
|
||||
Draw a polygon outline of n sides with extended parameters
|
||||
*/
|
||||
int lshapesDrawPolyLinesEx( lua_State *L ) {
|
||||
int lshapesDrawPolyLinesEx( lua_State* L ) {
|
||||
Vector2 center = uluaGetVector2( L, 1 );
|
||||
int sides = luaL_checkinteger( L, 2 );
|
||||
float radius = luaL_checknumber( L, 3 );
|
||||
@@ -540,7 +540,7 @@ int lshapesDrawPolyLinesEx( lua_State *L ) {
|
||||
|
||||
Draw spline: Linear, minimum 2 points
|
||||
*/
|
||||
int lshapesDrawSplineLinear( lua_State *L ) {
|
||||
int lshapesDrawSplineLinear( lua_State* L ) {
|
||||
int pointCount = uluaGetTableLen( L, 1 );
|
||||
Vector2 points[ pointCount ];
|
||||
float thick = luaL_checknumber( L, 2 );
|
||||
@@ -557,7 +557,7 @@ int lshapesDrawSplineLinear( lua_State *L ) {
|
||||
|
||||
Draw spline: B-Spline, minimum 4 points
|
||||
*/
|
||||
int lshapesDrawSplineBasis( lua_State *L ) {
|
||||
int lshapesDrawSplineBasis( lua_State* L ) {
|
||||
int pointCount = uluaGetTableLen( L, 1 );
|
||||
Vector2 points[ pointCount ];
|
||||
float thick = luaL_checknumber( L, 2 );
|
||||
@@ -574,7 +574,7 @@ int lshapesDrawSplineBasis( lua_State *L ) {
|
||||
|
||||
Draw spline: Catmull-Rom, minimum 4 points
|
||||
*/
|
||||
int lshapesDrawSplineCatmullRom( lua_State *L ) {
|
||||
int lshapesDrawSplineCatmullRom( lua_State* L ) {
|
||||
int pointCount = uluaGetTableLen( L, 1 );
|
||||
Vector2 points[ pointCount ];
|
||||
float thick = luaL_checknumber( L, 2 );
|
||||
@@ -591,7 +591,7 @@ int lshapesDrawSplineCatmullRom( lua_State *L ) {
|
||||
|
||||
Draw spline: Quadratic Bezier, minimum 3 points (1 control point): [p1, c2, p3, c4...]
|
||||
*/
|
||||
int lshapesDrawSplineBezierQuadratic( lua_State *L ) {
|
||||
int lshapesDrawSplineBezierQuadratic( lua_State* L ) {
|
||||
int pointCount = uluaGetTableLen( L, 1 );
|
||||
Vector2 points[ pointCount ];
|
||||
float thick = luaL_checknumber( L, 2 );
|
||||
@@ -608,7 +608,7 @@ int lshapesDrawSplineBezierQuadratic( lua_State *L ) {
|
||||
|
||||
Draw spline: Cubic Bezier, minimum 4 points (2 control points): [p1, c2, c3, p4, c5, c6...]
|
||||
*/
|
||||
int lshapesDrawSplineBezierCubic( lua_State *L ) {
|
||||
int lshapesDrawSplineBezierCubic( lua_State* L ) {
|
||||
int pointCount = uluaGetTableLen( L, 1 );
|
||||
Vector2 points[ pointCount ];
|
||||
float thick = luaL_checknumber( L, 2 );
|
||||
@@ -625,7 +625,7 @@ int lshapesDrawSplineBezierCubic( lua_State *L ) {
|
||||
|
||||
Draw spline segment: Linear, 2 points
|
||||
*/
|
||||
int lshapesDrawSplineSegmentLinear( lua_State *L ) {
|
||||
int lshapesDrawSplineSegmentLinear( lua_State* L ) {
|
||||
Vector2 p1 = uluaGetVector2( L, 1 );
|
||||
Vector2 p2 = uluaGetVector2( L, 2 );
|
||||
float thick = luaL_checknumber( L, 3 );
|
||||
@@ -641,7 +641,7 @@ int lshapesDrawSplineSegmentLinear( lua_State *L ) {
|
||||
|
||||
Draw spline segment: B-Spline, 4 points
|
||||
*/
|
||||
int lshapesDrawSplineSegmentBasis( lua_State *L ) {
|
||||
int lshapesDrawSplineSegmentBasis( lua_State* L ) {
|
||||
Vector2 p1 = uluaGetVector2( L, 1 );
|
||||
Vector2 p2 = uluaGetVector2( L, 2 );
|
||||
Vector2 p3 = uluaGetVector2( L, 3 );
|
||||
@@ -659,7 +659,7 @@ int lshapesDrawSplineSegmentBasis( lua_State *L ) {
|
||||
|
||||
Draw spline segment: Catmull-Rom, 4 points
|
||||
*/
|
||||
int lshapesDrawSplineSegmentCatmullRom( lua_State *L ) {
|
||||
int lshapesDrawSplineSegmentCatmullRom( lua_State* L ) {
|
||||
Vector2 p1 = uluaGetVector2( L, 1 );
|
||||
Vector2 p2 = uluaGetVector2( L, 2 );
|
||||
Vector2 p3 = uluaGetVector2( L, 3 );
|
||||
@@ -677,7 +677,7 @@ int lshapesDrawSplineSegmentCatmullRom( lua_State *L ) {
|
||||
|
||||
Draw spline segment: Quadratic Bezier, 2 points, 1 control point
|
||||
*/
|
||||
int lshapesDrawSplineSegmentBezierQuadratic( lua_State *L ) {
|
||||
int lshapesDrawSplineSegmentBezierQuadratic( lua_State* L ) {
|
||||
Vector2 p1 = uluaGetVector2( L, 1 );
|
||||
Vector2 c2 = uluaGetVector2( L, 2 );
|
||||
Vector2 p3 = uluaGetVector2( L, 3 );
|
||||
@@ -694,7 +694,7 @@ int lshapesDrawSplineSegmentBezierQuadratic( lua_State *L ) {
|
||||
|
||||
Draw spline segment: Cubic Bezier, 2 points, 2 control points
|
||||
*/
|
||||
int lshapesDrawSplineSegmentBezierCubic( lua_State *L ) {
|
||||
int lshapesDrawSplineSegmentBezierCubic( lua_State* L ) {
|
||||
Vector2 p1 = uluaGetVector2( L, 1 );
|
||||
Vector2 c2 = uluaGetVector2( L, 2 );
|
||||
Vector2 c3 = uluaGetVector2( L, 3 );
|
||||
@@ -718,7 +718,7 @@ Get (evaluate) spline point: Linear
|
||||
|
||||
- Success return Vector2
|
||||
*/
|
||||
int lshapesGetSplinePointLinear( lua_State *L ) {
|
||||
int lshapesGetSplinePointLinear( lua_State* L ) {
|
||||
Vector2 p1 = uluaGetVector2( L, 1 );
|
||||
Vector2 p2 = uluaGetVector2( L, 2 );
|
||||
float t = luaL_checknumber( L, 3 );
|
||||
@@ -735,7 +735,7 @@ Get (evaluate) spline point: B-Spline
|
||||
|
||||
- Success return Vector2
|
||||
*/
|
||||
int lshapesGetSplinePointBasis( lua_State *L ) {
|
||||
int lshapesGetSplinePointBasis( lua_State* L ) {
|
||||
Vector2 p1 = uluaGetVector2( L, 1 );
|
||||
Vector2 p2 = uluaGetVector2( L, 2 );
|
||||
Vector2 p3 = uluaGetVector2( L, 3 );
|
||||
@@ -754,7 +754,7 @@ Get (evaluate) spline point: Catmull-Rom
|
||||
|
||||
- Success return Vector2
|
||||
*/
|
||||
int lshapesGetSplinePointCatmullRom( lua_State *L ) {
|
||||
int lshapesGetSplinePointCatmullRom( lua_State* L ) {
|
||||
Vector2 p1 = uluaGetVector2( L, 1 );
|
||||
Vector2 p2 = uluaGetVector2( L, 2 );
|
||||
Vector2 p3 = uluaGetVector2( L, 3 );
|
||||
@@ -773,7 +773,7 @@ Get (evaluate) spline point: Quadratic Bezier
|
||||
|
||||
- Success return Vector2
|
||||
*/
|
||||
int lshapesGetSplinePointBezierQuad( lua_State *L ) {
|
||||
int lshapesGetSplinePointBezierQuad( lua_State* L ) {
|
||||
Vector2 p1 = uluaGetVector2( L, 1 );
|
||||
Vector2 c2 = uluaGetVector2( L, 2 );
|
||||
Vector2 p3 = uluaGetVector2( L, 3 );
|
||||
@@ -791,7 +791,7 @@ Get (evaluate) spline point: Cubic Bezier
|
||||
|
||||
- Success return Vector2
|
||||
*/
|
||||
int lshapesGetSplinePointBezierCubic( lua_State *L ) {
|
||||
int lshapesGetSplinePointBezierCubic( lua_State* L ) {
|
||||
Vector2 p1 = uluaGetVector2( L, 1 );
|
||||
Vector2 c2 = uluaGetVector2( L, 2 );
|
||||
Vector2 c3 = uluaGetVector2( L, 3 );
|
||||
@@ -814,7 +814,7 @@ Check collision between two rectangles
|
||||
|
||||
- Success return bool
|
||||
*/
|
||||
int lshapesCheckCollisionRecs( lua_State *L ) {
|
||||
int lshapesCheckCollisionRecs( lua_State* L ) {
|
||||
Rectangle rect1 = uluaGetRectangle( L, 1 );
|
||||
Rectangle rect2 = uluaGetRectangle( L, 2 );
|
||||
|
||||
@@ -830,7 +830,7 @@ Check collision between two circles
|
||||
|
||||
- Success return bool
|
||||
*/
|
||||
int lshapesCheckCollisionCircles( lua_State *L ) {
|
||||
int lshapesCheckCollisionCircles( lua_State* L ) {
|
||||
Vector2 center1 = uluaGetVector2( L, 1 );
|
||||
float radius1 = luaL_checknumber( L, 2 );
|
||||
Vector2 center2 = uluaGetVector2( L, 3 );
|
||||
@@ -848,7 +848,7 @@ Check collision between circle and rectangle
|
||||
|
||||
- Success return bool
|
||||
*/
|
||||
int lshapesCheckCollisionCircleRec( lua_State *L ) {
|
||||
int lshapesCheckCollisionCircleRec( lua_State* L ) {
|
||||
Vector2 center = uluaGetVector2( L, 1 );
|
||||
float radius = luaL_checknumber( L, 2 );
|
||||
Rectangle rec = uluaGetRectangle( L, 3 );
|
||||
@@ -865,7 +865,7 @@ Check if point is inside rectangle
|
||||
|
||||
- Success return bool
|
||||
*/
|
||||
int lshapesCheckCollisionPointRec( lua_State *L ) {
|
||||
int lshapesCheckCollisionPointRec( lua_State* L ) {
|
||||
Vector2 point = uluaGetVector2( L, 1 );
|
||||
Rectangle rec = uluaGetRectangle( L, 2 );
|
||||
|
||||
@@ -881,7 +881,7 @@ Check if point is inside circle
|
||||
|
||||
- Success return bool
|
||||
*/
|
||||
int lshapesCheckCollisionPointCircle( lua_State *L ) {
|
||||
int lshapesCheckCollisionPointCircle( lua_State* L ) {
|
||||
Vector2 point = uluaGetVector2( L, 1 );
|
||||
Vector2 center = uluaGetVector2( L, 2 );
|
||||
float radius = luaL_checknumber( L, 3 );
|
||||
@@ -898,7 +898,7 @@ Check if point is inside a triangle
|
||||
|
||||
- Success return bool
|
||||
*/
|
||||
int lshapesCheckCollisionPointTriangle( lua_State *L ) {
|
||||
int lshapesCheckCollisionPointTriangle( lua_State* L ) {
|
||||
Vector2 point = uluaGetVector2( L, 1 );
|
||||
Vector2 p1 = uluaGetVector2( L, 2 );
|
||||
Vector2 p2 = uluaGetVector2( L, 3 );
|
||||
@@ -916,7 +916,7 @@ Check if point is within a polygon described by array of vertices
|
||||
|
||||
- Success return bool
|
||||
*/
|
||||
int lshapesCheckCollisionPointPoly( lua_State *L ) {
|
||||
int lshapesCheckCollisionPointPoly( lua_State* L ) {
|
||||
Vector2 point = uluaGetVector2( L, 1 );
|
||||
int pointCount = uluaGetTableLen( L, 2 );
|
||||
Vector2 points[ pointCount ];
|
||||
@@ -942,7 +942,7 @@ Check the collision between two lines defined by two points each, returns collis
|
||||
|
||||
- Success return bool, Vector2
|
||||
*/
|
||||
int lshapesCheckCollisionLines( lua_State *L ) {
|
||||
int lshapesCheckCollisionLines( lua_State* L ) {
|
||||
Vector2 startPos1 = uluaGetVector2( L, 1 );
|
||||
Vector2 endPos1 = uluaGetVector2( L, 2 );
|
||||
Vector2 startPos2 = uluaGetVector2( L, 3 );
|
||||
@@ -963,7 +963,7 @@ Check if point belongs to line created between two points [p1] and [p2] with def
|
||||
|
||||
- Success return bool
|
||||
*/
|
||||
int lshapesCheckCollisionPointLine( lua_State *L ) {
|
||||
int lshapesCheckCollisionPointLine( lua_State* L ) {
|
||||
Vector2 point = uluaGetVector2( L, 1 );
|
||||
Vector2 p1 = uluaGetVector2( L, 2 );
|
||||
Vector2 p2 = uluaGetVector2( L, 3 );
|
||||
@@ -981,7 +981,7 @@ Get collision rectangle for two rectangles collision
|
||||
|
||||
- Success return Rectangle
|
||||
*/
|
||||
int lshapesGetCollisionRec( lua_State *L ) {
|
||||
int lshapesGetCollisionRec( lua_State* L ) {
|
||||
Rectangle rec1 = uluaGetRectangle( L, 1 );
|
||||
Rectangle rec2 = uluaGetRectangle( L, 2 );
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
State *state;
|
||||
|
||||
bool stateInit( int argn, const char **argc, const char *exePath ) {
|
||||
bool stateInit( int argn, const char** argc, const char* exePath ) {
|
||||
state = malloc( sizeof( State ) );
|
||||
|
||||
state->exePath = malloc( STRING_LEN * sizeof( char ) );
|
||||
@@ -32,7 +32,7 @@ bool stateInit( int argn, const char **argc, const char *exePath ) {
|
||||
state->defaultMaterial = LoadMaterialDefault();
|
||||
state->defaultTexture = (Texture){ 1, 1, 1, 1, 7 };
|
||||
state->RLGLcurrentShaderLocs = malloc( RL_MAX_SHADER_LOCATIONS * sizeof( int ) );
|
||||
int *defaultShaderLocs = rlGetShaderLocsDefault();
|
||||
int* defaultShaderLocs = rlGetShaderLocsDefault();
|
||||
|
||||
for ( int i = 0; i < RL_MAX_SHADER_LOCATIONS; i++ ) {
|
||||
state->RLGLcurrentShaderLocs[i] = defaultShaderLocs[i];
|
||||
@@ -45,7 +45,7 @@ bool stateInit( int argn, const char **argc, const char *exePath ) {
|
||||
return state->run;
|
||||
}
|
||||
|
||||
void stateInitInterpret( int argn, const char **argc ) {
|
||||
void stateInitInterpret( int argn, const char** argc ) {
|
||||
state = malloc( sizeof( State ) );
|
||||
luaInit( argn, argc );
|
||||
}
|
||||
|
||||
180
src/text.c
180
src/text.c
@@ -4,15 +4,15 @@
|
||||
#include "textures.h"
|
||||
#include "lua_core.h"
|
||||
|
||||
void unloadGlyphInfo( GlyphInfo *glyph ) {
|
||||
void unloadGlyphInfo( GlyphInfo* glyph ) {
|
||||
UnloadImage( glyph->image );
|
||||
}
|
||||
|
||||
// DrawTextBoxed is modified DrawTextBoxedSelectable from raylib [text] example - Rectangle bounds
|
||||
|
||||
// Draw text using font inside rectangle limits
|
||||
static int DrawTextBoxed( Font font, const char *text, Rectangle rec, float fontSize, float spacing,
|
||||
bool wordWrap, Color *tints, int tintCount, Color *backTints, int backTintCount )
|
||||
static int DrawTextBoxed( Font font, const char* text, Rectangle rec, float fontSize, float spacing,
|
||||
bool wordWrap, Color* tints, int tintCount, Color* backTints, int backTintCount )
|
||||
{
|
||||
int length = TextLength(text); // Total length in bytes of the text, scanned by codepoints in loop
|
||||
|
||||
@@ -161,7 +161,7 @@ bool wordWrap, Color *tints, int tintCount, Color *backTints, int backTintCount
|
||||
return mouseChar;
|
||||
}
|
||||
|
||||
static inline void getCodepoints( lua_State *L, int codepoints[], int index ) {
|
||||
static inline void getCodepoints( lua_State* L, int codepoints[], int index ) {
|
||||
int t = index;
|
||||
int i = 0;
|
||||
lua_pushnil( L );
|
||||
@@ -184,7 +184,7 @@ Get the default Font. Return as lightuserdata
|
||||
|
||||
- Success return Font
|
||||
*/
|
||||
int ltextGetFontDefault( lua_State *L ) {
|
||||
int ltextGetFontDefault( lua_State* L ) {
|
||||
lua_pushlightuserdata( L, &state->defaultFont );
|
||||
|
||||
return 1;
|
||||
@@ -198,7 +198,7 @@ Load font from file into GPU memory (VRAM)
|
||||
- Failure return nil
|
||||
- Success return Font
|
||||
*/
|
||||
int ltextLoadFont( lua_State *L ) {
|
||||
int ltextLoadFont( lua_State* L ) {
|
||||
if ( FileExists( luaL_checkstring( L, 1 ) ) ) {
|
||||
uluaPushFont( L, LoadFont( lua_tostring( L, 1 ) ) );
|
||||
|
||||
@@ -218,7 +218,7 @@ Load font from file with extended parameters, use NULL for codepoints to load th
|
||||
- Failure return nil
|
||||
- Success return Font
|
||||
*/
|
||||
int ltextLoadFontEx( lua_State *L ) {
|
||||
int ltextLoadFontEx( lua_State* L ) {
|
||||
int fontSize = luaL_checkinteger( L, 2 );
|
||||
|
||||
if ( FileExists( luaL_checkstring( L, 1 ) ) ) {
|
||||
@@ -248,8 +248,8 @@ Load font from Image (XNA style)
|
||||
|
||||
- Success return Font
|
||||
*/
|
||||
int ltextLoadFontFromImage( lua_State *L ) {
|
||||
Image *image = uluaGetImage( L, 1 );
|
||||
int ltextLoadFontFromImage( lua_State* L ) {
|
||||
Image* image = uluaGetImage( L, 1 );
|
||||
Color key = uluaGetColor( L, 2 );
|
||||
int firstChar = luaL_checkinteger( L, 3 );
|
||||
|
||||
@@ -265,9 +265,9 @@ Load font from memory buffer, fileType refers to extension: i.e. '.ttf'. NOTE: f
|
||||
|
||||
- Success return Font
|
||||
*/
|
||||
int ltextLoadFontFromMemory( lua_State *L ) {
|
||||
const char *fileType = luaL_checkstring( L, 1 );
|
||||
Buffer *fileData = uluaGetBuffer( L, 2 );
|
||||
int ltextLoadFontFromMemory( lua_State* L ) {
|
||||
const char* fileType = luaL_checkstring( L, 1 );
|
||||
Buffer* fileData = uluaGetBuffer( L, 2 );
|
||||
int fontSize = luaL_checkinteger( L, 3 );
|
||||
|
||||
if ( lua_istable( L, 4 ) ) {
|
||||
@@ -292,7 +292,7 @@ Load Font from data
|
||||
|
||||
- Success return Font
|
||||
*/
|
||||
int ltextLoadFontFromData( lua_State *L ) {
|
||||
int ltextLoadFontFromData( lua_State* L ) {
|
||||
luaL_checktype( L, 1, LUA_TTABLE );
|
||||
|
||||
Font font = { 0 };
|
||||
@@ -353,8 +353,8 @@ Check if a font is ready
|
||||
|
||||
- Success return bool
|
||||
*/
|
||||
int ltextIsFontReady( lua_State *L ) {
|
||||
Font *font = uluaGetFont( L, 1 );
|
||||
int ltextIsFontReady( lua_State* L ) {
|
||||
Font* font = uluaGetFont( L, 1 );
|
||||
|
||||
lua_pushboolean( L, IsFontReady( *font ) );
|
||||
|
||||
@@ -368,8 +368,8 @@ Load font data for further use. NOTE: fileData type should be unsigned char
|
||||
|
||||
- Success return GlyphInfo{}
|
||||
*/
|
||||
int ltextLoadFontData( lua_State *L ) {
|
||||
Buffer *fileData = uluaGetBuffer( L, 1 );
|
||||
int ltextLoadFontData( lua_State* L ) {
|
||||
Buffer* fileData = uluaGetBuffer( L, 1 );
|
||||
int fontSize = luaL_checkinteger( L, 2 );
|
||||
int type = luaL_checkinteger( L, 4 );
|
||||
int codepointCount = 95; // In case no chars count provided, default to 95.
|
||||
@@ -379,7 +379,7 @@ int ltextLoadFontData( lua_State *L ) {
|
||||
int codepoints[ codepointCount ];
|
||||
|
||||
getCodepoints( L, codepoints, 3 );
|
||||
GlyphInfo *glyphs = LoadFontData( fileData->data, fileData->size, fontSize, codepoints, codepointCount, type );
|
||||
GlyphInfo* glyphs = LoadFontData( fileData->data, fileData->size, fontSize, codepoints, codepointCount, type );
|
||||
lua_createtable( L, codepointCount, 0 );
|
||||
|
||||
for ( int i = 0; i < codepointCount; i++ ) {
|
||||
@@ -391,7 +391,7 @@ int ltextLoadFontData( lua_State *L ) {
|
||||
return 1;
|
||||
}
|
||||
/* If no codepoints provided. */
|
||||
GlyphInfo *glyphs = LoadFontData( fileData->data, fileData->size, fontSize, NULL, 0, type );
|
||||
GlyphInfo* glyphs = LoadFontData( fileData->data, fileData->size, fontSize, NULL, 0, type );
|
||||
lua_createtable( L, codepointCount, 0 );
|
||||
|
||||
for ( int i = 0; i < codepointCount; i++ ) {
|
||||
@@ -410,7 +410,7 @@ Generate image font atlas using chars info. NOTE: Packing method: 0-Default, 1-S
|
||||
|
||||
- Success Image, Rectangle{}
|
||||
*/
|
||||
int ltextGenImageFontAtlas( lua_State *L ) {
|
||||
int ltextGenImageFontAtlas( lua_State* L ) {
|
||||
int fontSize = luaL_checkinteger( L, 2 );
|
||||
int padding = luaL_checkinteger( L, 3 );
|
||||
int packMethod = luaL_checkinteger( L, 4 );
|
||||
@@ -444,8 +444,8 @@ int ltextGenImageFontAtlas( lua_State *L ) {
|
||||
|
||||
Unload font from GPU memory (VRAM)
|
||||
*/
|
||||
int ltextUnloadFont( lua_State *L ) {
|
||||
Font *font = uluaGetFont( L, 1 );
|
||||
int ltextUnloadFont( lua_State* L ) {
|
||||
Font* font = uluaGetFont( L, 1 );
|
||||
|
||||
UnloadFont( *font );
|
||||
|
||||
@@ -459,9 +459,9 @@ Export font as code file, returns true on success
|
||||
|
||||
- Success return bool
|
||||
*/
|
||||
int ltextExportFontAsCode( lua_State *L ) {
|
||||
Font *font = uluaGetFont( L, 1 );
|
||||
const char *fileName = luaL_checkstring( L, 2 );
|
||||
int ltextExportFontAsCode( lua_State* L ) {
|
||||
Font* font = uluaGetFont( L, 1 );
|
||||
const char* fileName = luaL_checkstring( L, 2 );
|
||||
|
||||
lua_pushboolean( L, ExportFontAsCode( *font, fileName ) );
|
||||
|
||||
@@ -477,7 +477,7 @@ int ltextExportFontAsCode( lua_State *L ) {
|
||||
|
||||
Draw current FPS
|
||||
*/
|
||||
int ltextDrawFPS( lua_State *L ) {
|
||||
int ltextDrawFPS( lua_State* L ) {
|
||||
Vector2 pos = uluaGetVector2( L, 1 );
|
||||
|
||||
DrawFPS( pos.x, pos.y );
|
||||
@@ -490,7 +490,7 @@ int ltextDrawFPS( lua_State *L ) {
|
||||
|
||||
Draw text (using default font)
|
||||
*/
|
||||
int ltextDrawText( lua_State *L ) {
|
||||
int ltextDrawText( lua_State* L ) {
|
||||
Vector2 position = uluaGetVector2( L, 2 );
|
||||
float fontSize = luaL_checknumber( L, 3 );
|
||||
Color tint = uluaGetColor( L, 4 );
|
||||
@@ -505,8 +505,8 @@ int ltextDrawText( lua_State *L ) {
|
||||
|
||||
Draw text using font and additional parameters
|
||||
*/
|
||||
int ltextDrawTextEx( lua_State *L ) {
|
||||
Font *font = uluaGetFont( L, 1 );
|
||||
int ltextDrawTextEx( lua_State* L ) {
|
||||
Font* font = uluaGetFont( L, 1 );
|
||||
Vector2 position = uluaGetVector2( L, 3 );
|
||||
float fontSize = luaL_checknumber( L, 4 );
|
||||
float spacing = luaL_checknumber( L, 5 );
|
||||
@@ -522,8 +522,8 @@ int ltextDrawTextEx( lua_State *L ) {
|
||||
|
||||
Draw text using Font and pro parameters (rotation)
|
||||
*/
|
||||
int ltextDrawTextPro( lua_State *L ) {
|
||||
Font *font = uluaGetFont( L, 1 );
|
||||
int ltextDrawTextPro( lua_State* L ) {
|
||||
Font* font = uluaGetFont( L, 1 );
|
||||
Vector2 position = uluaGetVector2( L, 3 );
|
||||
Vector2 origin = uluaGetVector2( L, 4 );
|
||||
float rotation = luaL_checknumber( L, 5 );
|
||||
@@ -541,8 +541,8 @@ int ltextDrawTextPro( lua_State *L ) {
|
||||
|
||||
Draw one character (codepoint)
|
||||
*/
|
||||
int ltextDrawTextCodepoint( lua_State *L ) {
|
||||
Font *font = uluaGetFont( L, 1 );
|
||||
int ltextDrawTextCodepoint( lua_State* L ) {
|
||||
Font* font = uluaGetFont( L, 1 );
|
||||
int codepoint = luaL_checkinteger( L, 2 );
|
||||
Vector2 position = uluaGetVector2( L, 3 );
|
||||
float fontSize = luaL_checknumber( L, 4 );
|
||||
@@ -558,8 +558,8 @@ int ltextDrawTextCodepoint( lua_State *L ) {
|
||||
|
||||
Draw multiple character (codepoint)
|
||||
*/
|
||||
int ltextDrawTextCodepoints( lua_State *L ) {
|
||||
Font *font = uluaGetFont( L, 1 );
|
||||
int ltextDrawTextCodepoints( lua_State* L ) {
|
||||
Font* font = uluaGetFont( L, 1 );
|
||||
Vector2 position = uluaGetVector2( L, 3 );
|
||||
float fontSize = luaL_checknumber( L, 4 );
|
||||
float spacing = luaL_checknumber( L, 5 );
|
||||
@@ -590,9 +590,9 @@ Draw text using font inside rectangle limits. Return character id from mouse pos
|
||||
|
||||
- Success return int
|
||||
*/
|
||||
int ltextDrawTextBoxed( lua_State *L ) {
|
||||
Font *font = uluaGetFont( L, 1 );
|
||||
const char *text = luaL_checkstring( L, 2 );
|
||||
int ltextDrawTextBoxed( lua_State* L ) {
|
||||
Font* font = uluaGetFont( L, 1 );
|
||||
const char* text = luaL_checkstring( L, 2 );
|
||||
Rectangle rec = uluaGetRectangle( L, 3 );
|
||||
float fontSize = luaL_checknumber( L, 4 );
|
||||
float spacing = luaL_checknumber( L, 5 );
|
||||
@@ -611,9 +611,9 @@ Draw text using font inside rectangle limits with support for tint and backgroun
|
||||
|
||||
- Success return int
|
||||
*/
|
||||
int ltextDrawTextBoxedTinted( lua_State *L ) {
|
||||
Font *font = uluaGetFont( L, 1 );
|
||||
const char *text = luaL_checkstring( L, 2 );
|
||||
int ltextDrawTextBoxedTinted( lua_State* L ) {
|
||||
Font* font = uluaGetFont( L, 1 );
|
||||
const char* text = luaL_checkstring( L, 2 );
|
||||
Rectangle rec = uluaGetRectangle( L, 3 );
|
||||
float fontSize = luaL_checknumber( L, 4 );
|
||||
float spacing = luaL_checknumber( L, 5 );
|
||||
@@ -656,7 +656,7 @@ int ltextDrawTextBoxedTinted( lua_State *L ) {
|
||||
|
||||
Set vertical line spacing when drawing with line-breaks
|
||||
*/
|
||||
int ltextSetTextLineSpacing( lua_State *L ) {
|
||||
int ltextSetTextLineSpacing( lua_State* L ) {
|
||||
int spacing = luaL_checkinteger( L, 1 );
|
||||
|
||||
SetTextLineSpacing( spacing );
|
||||
@@ -669,8 +669,8 @@ Measure string size for Font
|
||||
|
||||
- Success return Vector2
|
||||
*/
|
||||
int ltextMeasureText( lua_State *L ) {
|
||||
Font *font = uluaGetFont( L, 1 );
|
||||
int ltextMeasureText( lua_State* L ) {
|
||||
Font* font = uluaGetFont( L, 1 );
|
||||
float fontSize = luaL_checknumber( L, 3 );
|
||||
float spacing = luaL_checknumber( L, 4 );
|
||||
|
||||
@@ -686,8 +686,8 @@ Get glyph index position in font for a codepoint (unicode character), fallback t
|
||||
|
||||
- Success return int
|
||||
*/
|
||||
int ltextGetGlyphIndex( lua_State *L ) {
|
||||
Font *font = uluaGetFont( L, 1 );
|
||||
int ltextGetGlyphIndex( lua_State* L ) {
|
||||
Font* font = uluaGetFont( L, 1 );
|
||||
int codepoint = luaL_checkinteger( L, 2 );
|
||||
|
||||
lua_pushinteger( L, GetGlyphIndex( *font, codepoint ) );
|
||||
@@ -702,8 +702,8 @@ Get glyph font info data for a codepoint (unicode character), fallback to '?' if
|
||||
|
||||
- Success return GlyphInfo
|
||||
*/
|
||||
int ltextGetGlyphInfo( lua_State *L ) {
|
||||
Font *font = uluaGetFont( L, 1 );
|
||||
int ltextGetGlyphInfo( lua_State* L ) {
|
||||
Font* font = uluaGetFont( L, 1 );
|
||||
int codepoint = luaL_checkinteger( L, 2 );
|
||||
|
||||
int id = GetGlyphIndex( *font, codepoint );
|
||||
@@ -720,8 +720,8 @@ Get glyph font info data by index. Return as lightuserdata
|
||||
- Failure return nil
|
||||
- Success return GlyphInfo
|
||||
*/
|
||||
int ltextGetGlyphInfoByIndex( lua_State *L ) {
|
||||
Font *font = uluaGetFont( L, 1 );
|
||||
int ltextGetGlyphInfoByIndex( lua_State* L ) {
|
||||
Font* font = uluaGetFont( L, 1 );
|
||||
int index = luaL_checkinteger( L, 2 );
|
||||
|
||||
if ( 0 <= index && index < font->glyphCount ) {
|
||||
@@ -742,8 +742,8 @@ Get glyph rectangle in font atlas for a codepoint (unicode character), fallback
|
||||
|
||||
- Success return Rectangle
|
||||
*/
|
||||
int ltextGetGlyphAtlasRec( lua_State *L ) {
|
||||
Font *font = uluaGetFont( L, 1 );
|
||||
int ltextGetGlyphAtlasRec( lua_State* L ) {
|
||||
Font* font = uluaGetFont( L, 1 );
|
||||
int codepoint = luaL_checkinteger( L, 2 );
|
||||
|
||||
uluaPushRectangle( L, GetGlyphAtlasRec( *font, codepoint ) );
|
||||
@@ -759,8 +759,8 @@ Get glyph rectangle in font atlas by index
|
||||
- Failure return nil
|
||||
- Success return Rectangle
|
||||
*/
|
||||
int ltextGetGlyphAtlasRecByIndex( lua_State *L ) {
|
||||
Font *font = uluaGetFont( L, 1 );
|
||||
int ltextGetGlyphAtlasRecByIndex( lua_State* L ) {
|
||||
Font* font = uluaGetFont( L, 1 );
|
||||
int index = luaL_checkinteger( L, 2 );
|
||||
|
||||
if ( 0 <= index && index < font->glyphCount ) {
|
||||
@@ -781,8 +781,8 @@ Get font base size (default chars height)
|
||||
|
||||
- Success return int
|
||||
*/
|
||||
int ltextGetFontBaseSize( lua_State *L ) {
|
||||
Font *font = uluaGetFont( L, 1 );
|
||||
int ltextGetFontBaseSize( lua_State* L ) {
|
||||
Font* font = uluaGetFont( L, 1 );
|
||||
|
||||
lua_pushinteger( L, font->baseSize );
|
||||
|
||||
@@ -796,8 +796,8 @@ Get font number of glyph characters
|
||||
|
||||
- Success return int
|
||||
*/
|
||||
int ltextGetFontGlyphCount( lua_State *L ) {
|
||||
Font *font = uluaGetFont( L, 1 );
|
||||
int ltextGetFontGlyphCount( lua_State* L ) {
|
||||
Font* font = uluaGetFont( L, 1 );
|
||||
|
||||
lua_pushinteger( L, font->glyphCount );
|
||||
|
||||
@@ -811,8 +811,8 @@ Get font padding around the glyph characters
|
||||
|
||||
- Success return int
|
||||
*/
|
||||
int ltextGetFontGlyphPadding( lua_State *L ) {
|
||||
Font *font = uluaGetFont( L, 1 );
|
||||
int ltextGetFontGlyphPadding( lua_State* L ) {
|
||||
Font* font = uluaGetFont( L, 1 );
|
||||
|
||||
lua_pushinteger( L, font->glyphPadding );
|
||||
|
||||
@@ -826,8 +826,8 @@ Get font texture atlas containing the glyphs. Return as lightuserdata
|
||||
|
||||
- Success return Texture
|
||||
*/
|
||||
int ltextGetFontTexture( lua_State *L ) {
|
||||
Font *font = uluaGetFont( L, 1 );
|
||||
int ltextGetFontTexture( lua_State* L ) {
|
||||
Font* font = uluaGetFont( L, 1 );
|
||||
|
||||
lua_pushlightuserdata( L, &font->texture );
|
||||
|
||||
@@ -845,7 +845,7 @@ Load GlyphInfo from data
|
||||
|
||||
- Success return GlyphInfo
|
||||
*/
|
||||
int ltextLoadGlyphInfo( lua_State *L ) {
|
||||
int ltextLoadGlyphInfo( lua_State* L ) {
|
||||
luaL_checktype( L, 1, LUA_TTABLE );
|
||||
|
||||
GlyphInfo glyph = { 0 };
|
||||
@@ -881,8 +881,8 @@ int ltextLoadGlyphInfo( lua_State *L ) {
|
||||
|
||||
Unload glyphInfo image from CPU memory (RAM)
|
||||
*/
|
||||
int ltextUnloadGlyphInfo( lua_State *L ) {
|
||||
GlyphInfo *glyph = uluaGetGlyphInfo( L, 1 );
|
||||
int ltextUnloadGlyphInfo( lua_State* L ) {
|
||||
GlyphInfo* glyph = uluaGetGlyphInfo( L, 1 );
|
||||
|
||||
unloadGlyphInfo( glyph );
|
||||
|
||||
@@ -894,8 +894,8 @@ int ltextUnloadGlyphInfo( lua_State *L ) {
|
||||
|
||||
Set glyphInfo character value (Unicode)
|
||||
*/
|
||||
int ltextSetGlyphInfoValue( lua_State *L ) {
|
||||
GlyphInfo *glyph = uluaGetGlyphInfo( L, 1 );
|
||||
int ltextSetGlyphInfoValue( lua_State* L ) {
|
||||
GlyphInfo* glyph = uluaGetGlyphInfo( L, 1 );
|
||||
int value = luaL_checkinteger( L, 2 );
|
||||
|
||||
glyph->value = value;
|
||||
@@ -908,8 +908,8 @@ int ltextSetGlyphInfoValue( lua_State *L ) {
|
||||
|
||||
Set glyphInfo character offset when drawing
|
||||
*/
|
||||
int ltextSetGlyphInfoOffset( lua_State *L ) {
|
||||
GlyphInfo *glyph = uluaGetGlyphInfo( L, 1 );
|
||||
int ltextSetGlyphInfoOffset( lua_State* L ) {
|
||||
GlyphInfo* glyph = uluaGetGlyphInfo( L, 1 );
|
||||
Vector2 offset = uluaGetVector2( L, 2 );
|
||||
|
||||
glyph->offsetX = (int)offset.x;
|
||||
@@ -923,8 +923,8 @@ int ltextSetGlyphInfoOffset( lua_State *L ) {
|
||||
|
||||
Set glyphInfo character advance position X
|
||||
*/
|
||||
int ltextSetGlyphInfoAdvanceX( lua_State *L ) {
|
||||
GlyphInfo *glyph = uluaGetGlyphInfo( L, 1 );
|
||||
int ltextSetGlyphInfoAdvanceX( lua_State* L ) {
|
||||
GlyphInfo* glyph = uluaGetGlyphInfo( L, 1 );
|
||||
int advanceX = luaL_checkinteger( L, 2 );
|
||||
|
||||
glyph->advanceX = advanceX;
|
||||
@@ -937,8 +937,8 @@ int ltextSetGlyphInfoAdvanceX( lua_State *L ) {
|
||||
|
||||
Set glyphInfo character image data
|
||||
*/
|
||||
int ltextSetGlyphInfoImage( lua_State *L ) {
|
||||
GlyphInfo *glyph = uluaGetGlyphInfo( L, 1 );
|
||||
int ltextSetGlyphInfoImage( lua_State* L ) {
|
||||
GlyphInfo* glyph = uluaGetGlyphInfo( L, 1 );
|
||||
Image image = *uluaGetImage( L, 2 );
|
||||
|
||||
glyph->image = image;
|
||||
@@ -953,8 +953,8 @@ Get glyphInfo character value (Unicode)
|
||||
|
||||
- Success return int
|
||||
*/
|
||||
int ltextGetGlyphInfoValue( lua_State *L ) {
|
||||
GlyphInfo *glyph = uluaGetGlyphInfo( L, 1 );
|
||||
int ltextGetGlyphInfoValue( lua_State* L ) {
|
||||
GlyphInfo* glyph = uluaGetGlyphInfo( L, 1 );
|
||||
|
||||
lua_pushinteger( L, glyph->value );
|
||||
|
||||
@@ -968,8 +968,8 @@ Get glyphInfo character offset when drawing
|
||||
|
||||
- Success return Vector2
|
||||
*/
|
||||
int ltextGetGlyphInfoOffset( lua_State *L ) {
|
||||
GlyphInfo *glyph = uluaGetGlyphInfo( L, 1 );
|
||||
int ltextGetGlyphInfoOffset( lua_State* L ) {
|
||||
GlyphInfo* glyph = uluaGetGlyphInfo( L, 1 );
|
||||
|
||||
uluaPushVector2( L, (Vector2){ glyph->offsetX, glyph->offsetY } );
|
||||
|
||||
@@ -983,8 +983,8 @@ Get glyphInfo character advance position X
|
||||
|
||||
- Success return int
|
||||
*/
|
||||
int ltextGetGlyphInfoAdvanceX( lua_State *L ) {
|
||||
GlyphInfo *glyph = uluaGetGlyphInfo( L, 1 );
|
||||
int ltextGetGlyphInfoAdvanceX( lua_State* L ) {
|
||||
GlyphInfo* glyph = uluaGetGlyphInfo( L, 1 );
|
||||
|
||||
lua_pushinteger( L, glyph->advanceX );
|
||||
|
||||
@@ -998,8 +998,8 @@ Get glyphInfo character image data. Return as lightuserdata
|
||||
|
||||
- Success return Image
|
||||
*/
|
||||
int ltextGetGlyphInfoImage( lua_State *L ) {
|
||||
GlyphInfo *glyph = uluaGetGlyphInfo( L, 1 );
|
||||
int ltextGetGlyphInfoImage( lua_State* L ) {
|
||||
GlyphInfo* glyph = uluaGetGlyphInfo( L, 1 );
|
||||
|
||||
lua_pushlightuserdata( L, &glyph->image );
|
||||
|
||||
@@ -1017,7 +1017,7 @@ Load UTF-8 text encoded from codepoints array
|
||||
|
||||
- Success return string
|
||||
*/
|
||||
int ltextLoadUTF8( lua_State *L ) {
|
||||
int ltextLoadUTF8( lua_State* L ) {
|
||||
int codepointCount = uluaGetTableLen( L, 1 );
|
||||
int codepoints[ codepointCount ];
|
||||
getCodepoints( L, codepoints, 1 );
|
||||
@@ -1036,7 +1036,7 @@ Load all codepoints from a UTF-8 text string
|
||||
|
||||
- Success return int{}
|
||||
*/
|
||||
int ltextLoadCodepoints( lua_State *L ) {
|
||||
int ltextLoadCodepoints( lua_State* L ) {
|
||||
const char* text = luaL_checkstring( L, 1 );
|
||||
|
||||
int count = 0;
|
||||
@@ -1060,7 +1060,7 @@ Get total number of codepoints in a UTF-8 encoded string
|
||||
|
||||
- Success return int
|
||||
*/
|
||||
int ltextGetCodepointCount( lua_State *L ) {
|
||||
int ltextGetCodepointCount( lua_State* L ) {
|
||||
const char* text = luaL_checkstring( L, 1 );
|
||||
|
||||
lua_pushinteger( L, GetCodepointCount( text ) );
|
||||
@@ -1075,7 +1075,7 @@ Get codepoint in a UTF-8 encoded string, 0x3f('?') is returned on failure
|
||||
|
||||
- Success return int, int
|
||||
*/
|
||||
int ltextGetCodepoint( lua_State *L ) {
|
||||
int ltextGetCodepoint( lua_State* L ) {
|
||||
const char* text = luaL_checkstring( L, 1 );
|
||||
|
||||
int codepointSize = 0;
|
||||
@@ -1092,7 +1092,7 @@ Get next codepoint in a UTF-8 encoded string, 0x3f('?') is returned on failure
|
||||
|
||||
- Success return int, int
|
||||
*/
|
||||
int ltextGetCodepointNext( lua_State *L ) {
|
||||
int ltextGetCodepointNext( lua_State* L ) {
|
||||
const char* text = luaL_checkstring( L, 1 );
|
||||
|
||||
int codepointSize = 0;
|
||||
@@ -1109,7 +1109,7 @@ Get previous codepoint in a UTF-8 encoded string, 0x3f('?') is returned on failu
|
||||
|
||||
- Success return int, int
|
||||
*/
|
||||
int ltextGetCodepointPrevious( lua_State *L ) {
|
||||
int ltextGetCodepointPrevious( lua_State* L ) {
|
||||
const char* text = luaL_checkstring( L, 1 );
|
||||
|
||||
int codepointSize = 0;
|
||||
@@ -1126,7 +1126,7 @@ Encode one codepoint into UTF-8 byte array
|
||||
|
||||
- Success return string
|
||||
*/
|
||||
int ltextCodepointToUTF8( lua_State *L ) {
|
||||
int ltextCodepointToUTF8( lua_State* L ) {
|
||||
int codepoint = luaL_checkinteger( L, 1 );
|
||||
|
||||
int utf8Size = 0;
|
||||
@@ -1150,7 +1150,7 @@ Insert text in a specific position, moves all text forward
|
||||
|
||||
- Success return string
|
||||
*/
|
||||
int ltextTextInsert( lua_State *L ) {
|
||||
int ltextTextInsert( lua_State* L ) {
|
||||
const char* text = luaL_checkstring( L, 1 );
|
||||
const char* insert = luaL_checkstring( L, 2 );
|
||||
int position = luaL_checkinteger( L, 3 );
|
||||
@@ -1180,7 +1180,7 @@ Split text into multiple strings
|
||||
|
||||
- Success return string{}
|
||||
*/
|
||||
int ltextTextSplit( lua_State *L ) {
|
||||
int ltextTextSplit( lua_State* L ) {
|
||||
const char* text = luaL_checkstring( L, 1 );
|
||||
const char* delimiter = luaL_checkstring( L, 2 );
|
||||
|
||||
|
||||
396
src/textures.c
396
src/textures.c
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user