New object types for Wave, Sound, Music and Light.
This commit is contained in:
207
API.md
207
API.md
@@ -3879,7 +3879,7 @@ Load font from file with extended parameters. Loading the default character set
|
|||||||
|
|
||||||
> font = RL.LoadFontFromImage( Image image, Color key, int firstChar )
|
> font = RL.LoadFontFromImage( Image image, Color key, int firstChar )
|
||||||
|
|
||||||
Load font from Image ( XNA style )
|
Load font from Image ( XNA style)
|
||||||
|
|
||||||
- Success return Font
|
- Success return Font
|
||||||
|
|
||||||
@@ -4646,12 +4646,9 @@ Get collision info between ray and quad
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
> success = RL.SetMasterVolume( float volume )
|
> RL.SetMasterVolume( float volume )
|
||||||
|
|
||||||
Set master volume ( listener )
|
Set master volume (listener)
|
||||||
|
|
||||||
- Failure return false
|
|
||||||
- Success return true
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -4663,8 +4660,8 @@ Set master volume ( listener )
|
|||||||
|
|
||||||
Load sound from file
|
Load sound from file
|
||||||
|
|
||||||
- Failure return -1
|
- Failure return nil
|
||||||
- Success return int
|
- Success return Sound
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -4672,8 +4669,8 @@ Load sound from file
|
|||||||
|
|
||||||
Load wave data from file
|
Load wave data from file
|
||||||
|
|
||||||
- Failure return -1
|
- Failure return nil
|
||||||
- Success return int
|
- Success return Wave
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -4681,26 +4678,7 @@ Load wave data from file
|
|||||||
|
|
||||||
Load sound from wave data
|
Load sound from wave data
|
||||||
|
|
||||||
- Failure return -1
|
- Success return Sound
|
||||||
- Success return int
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
> success = RL.UnloadSound( Sound sound )
|
|
||||||
|
|
||||||
Unload sound
|
|
||||||
|
|
||||||
- Failure return false
|
|
||||||
- Success return true
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
> success = RL.UnloadWave( Wave wave )
|
|
||||||
|
|
||||||
Unload wave data
|
|
||||||
|
|
||||||
- Failure return false
|
|
||||||
- Success return true
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -4708,8 +4686,7 @@ Unload wave data
|
|||||||
|
|
||||||
Export wave data to file, returns true on success
|
Export wave data to file, returns true on success
|
||||||
|
|
||||||
- Failure return false
|
- Success return bool
|
||||||
- Success return true
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -4717,7 +4694,6 @@ Export wave data to file, returns true on success
|
|||||||
|
|
||||||
Export wave sample data to code (.h), returns true on success
|
Export wave sample data to code (.h), returns true on success
|
||||||
|
|
||||||
- Failure return false
|
|
||||||
- Success return true
|
- Success return true
|
||||||
|
|
||||||
---
|
---
|
||||||
@@ -4726,103 +4702,74 @@ Export wave sample data to code (.h), returns true on success
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
> success = RL.PlaySound( Sound sound )
|
> RL.PlaySound( Sound sound )
|
||||||
|
|
||||||
Play a sound
|
Play a sound
|
||||||
|
|
||||||
- Failure return false
|
|
||||||
- Success return true
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
> success = RL.StopSound( Sound sound )
|
> RL.StopSound( Sound sound )
|
||||||
|
|
||||||
Stop playing a sound
|
Stop playing a sound
|
||||||
|
|
||||||
- Failure return false
|
|
||||||
- Success return true
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
> success = RL.PauseSound( Sound sound )
|
> RL.PauseSound( Sound sound )
|
||||||
|
|
||||||
Pause a sound
|
Pause a sound
|
||||||
|
|
||||||
- Failure return false
|
|
||||||
- Success return true
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
> success = RL.ResumeSound( Sound sound )
|
> RL.ResumeSound( Sound sound )
|
||||||
|
|
||||||
Resume a paused sound
|
Resume a paused sound
|
||||||
|
|
||||||
- Failure return false
|
|
||||||
- Success return true
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
> playing = RL.IsSoundPlaying( Sound sound )
|
> playing = RL.IsSoundPlaying( Sound sound )
|
||||||
|
|
||||||
Check if a sound is currently playing
|
Check if a sound is currently playing
|
||||||
|
|
||||||
- Failure return nil
|
|
||||||
- Success return bool
|
- Success return bool
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
> success = RL.SetSoundVolume( Sound sound, float volume )
|
> RL.SetSoundVolume( Sound sound, float volume )
|
||||||
|
|
||||||
Set volume for a sound ( 1.0 is max level )
|
Set volume for a sound (1.0 is max level)
|
||||||
|
|
||||||
- Failure return false
|
|
||||||
- Success return true
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
> success = RL.SetSoundPitch( Sound sound, float pitch )
|
> RL.SetSoundPitch( Sound sound, float pitch )
|
||||||
|
|
||||||
Set pitch for a sound ( 1.0 is base level )
|
Set pitch for a sound (1.0 is base level)
|
||||||
|
|
||||||
- Failure return false
|
|
||||||
- Success return true
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
> success = RL.SetSoundPan( Sound sound, float pan )
|
> RL.SetSoundPan( Sound sound, float pan )
|
||||||
|
|
||||||
Set pan for a sound ( 0.5 is center )
|
Set pan for a sound (0.5 is center)
|
||||||
|
|
||||||
- Failure return false
|
|
||||||
- Success return true
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
> success = RL.WaveFormat( Wave wave, int sampleRate, int sampleSize, int channels )
|
> RL.WaveFormat( Wave wave, int sampleRate, int sampleSize, int channels )
|
||||||
|
|
||||||
Convert wave data to desired format
|
Convert wave data to desired format
|
||||||
|
|
||||||
- Failure return false
|
|
||||||
- Success return true
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
> wave = RL.WaveCopy( Wave wave )
|
> wave = RL.WaveCopy( Wave wave )
|
||||||
|
|
||||||
Copy a wave to a new wave
|
Copy a wave to a new wave
|
||||||
|
|
||||||
- Failure return -1
|
- Success return Wave
|
||||||
- Success return int
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
> success = RL.WaveCrop( Wave wave, int initSample, int finalSample )
|
> RL.WaveCrop( Wave wave, int initSample, int finalSample )
|
||||||
|
|
||||||
Crop a wave to defined samples range
|
Crop a wave to defined samples range
|
||||||
|
|
||||||
- Failure return false
|
|
||||||
- Success return true
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Audio - Music management
|
## Audio - Music management
|
||||||
@@ -4833,133 +4780,98 @@ Crop a wave to defined samples range
|
|||||||
|
|
||||||
Load music stream from file
|
Load music stream from file
|
||||||
|
|
||||||
- Failure return -1
|
- Success return Music
|
||||||
- Success return int
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
> success = RL.PlayMusicStream( Music music )
|
> RL.PlayMusicStream( Music music )
|
||||||
|
|
||||||
Start music playing
|
Start music playing
|
||||||
|
|
||||||
- Failure return false
|
|
||||||
- Success return true
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
> playing = RL.IsMusicStreamPlaying( Music music )
|
> playing = RL.IsMusicStreamPlaying( Music music )
|
||||||
|
|
||||||
Check if music is playing
|
Check if music is playing
|
||||||
|
|
||||||
- Failure return nil
|
|
||||||
- Success return bool
|
- Success return bool
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
> success = RL.UpdateMusicStream( Music music )
|
> RL.UpdateMusicStream( Music music )
|
||||||
|
|
||||||
Updates buffers for music streaming
|
Updates buffers for music streaming
|
||||||
|
|
||||||
- Failure return false
|
|
||||||
- Success return true
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
> success = RL.StopMusicStream( Music music )
|
> RL.StopMusicStream( Music music )
|
||||||
|
|
||||||
Stop music playing
|
Stop music playing
|
||||||
|
|
||||||
- Failure return false
|
|
||||||
- Success return true
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
> success = RL.PauseMusicStream( Music music )
|
> RL.PauseMusicStream( Music music )
|
||||||
|
|
||||||
Pause music playing
|
Pause music playing
|
||||||
|
|
||||||
- Failure return false
|
|
||||||
- Success return true
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
> success = RL.ResumeMusicStream( Music music )
|
> RL.ResumeMusicStream( Music music )
|
||||||
|
|
||||||
Resume playing paused music
|
Resume playing paused music
|
||||||
|
|
||||||
- Failure return false
|
---
|
||||||
- Success return true
|
|
||||||
|
> RL.SeekMusicStream( Music music, float position )
|
||||||
|
|
||||||
|
Seek music to a position (in seconds)
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
> success = RL.SeekMusicStream( Music music, float position )
|
> RL.SetMusicVolume( Music music, float volume )
|
||||||
|
|
||||||
Seek music to a position ( in seconds )
|
Set volume for music (1.0 is max level)
|
||||||
|
|
||||||
- Failure return false
|
|
||||||
- Success return true
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
> success = RL.SetMusicVolume( Music music, float volume )
|
> RL.SetMusicPitch( Music music, float pitch )
|
||||||
|
|
||||||
Set volume for music ( 1.0 is max level )
|
Set pitch for a music (1.0 is base level)
|
||||||
|
|
||||||
- Failure return false
|
|
||||||
- Success return true
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
> success = RL.SetMusicPitch( Music music, float pitch )
|
> RL.SetMusicPan( Music music, float pan )
|
||||||
|
|
||||||
Set pitch for a music ( 1.0 is base level )
|
Set pan for a music (0.5 is center)
|
||||||
|
|
||||||
- Failure return false
|
|
||||||
- Success return true
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
> success = RL.SetMusicPan( Music music, float pan )
|
> RL.SetMusicLooping( Music music, bool looping )
|
||||||
|
|
||||||
Set pan for a music ( 0.5 is center )
|
|
||||||
|
|
||||||
- Failure return false
|
|
||||||
- Success return true
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
> success = RL.SetMusicLooping( Music music, bool looping )
|
|
||||||
|
|
||||||
Set looping for a music
|
Set looping for a music
|
||||||
|
|
||||||
- Failure return false
|
|
||||||
- Success return true
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
> looping = RL.GetMusicLooping( Music music )
|
> looping = RL.GetMusicLooping( Music music )
|
||||||
|
|
||||||
Get looping of a music
|
Get looping of a music
|
||||||
|
|
||||||
- Failure return nil
|
|
||||||
- Success return bool
|
- Success return bool
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
> length = RL.GetMusicTimeLength( Music music )
|
> length = RL.GetMusicTimeLength( Music music )
|
||||||
|
|
||||||
Get music time length ( in seconds )
|
Get music time length (in seconds)
|
||||||
|
|
||||||
- Failure return false
|
|
||||||
- Success return float
|
- Success return float
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
> played = RL.GetMusicTimePlayed( Music music )
|
> timePlayed = RL.GetMusicTimePlayed( Music music )
|
||||||
|
|
||||||
Get current music time played ( in seconds )
|
Get current music time played (in seconds)
|
||||||
|
|
||||||
- Failure return false
|
|
||||||
- Success return float
|
- Success return float
|
||||||
|
|
||||||
---
|
---
|
||||||
@@ -6466,8 +6378,7 @@ Check icon pixel value
|
|||||||
|
|
||||||
Create a light and get shader locations
|
Create a light and get shader locations
|
||||||
|
|
||||||
- Failure return -1
|
- Success return Light
|
||||||
- Success return int
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -6477,56 +6388,40 @@ Send light properties to shader
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
> success = RL.SetLightType( Light light, int type )
|
> RL.SetLightType( Light light, int type )
|
||||||
|
|
||||||
Set light type
|
Set light type
|
||||||
|
|
||||||
- Failure return false
|
|
||||||
- Success return true
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
> success = RL.SetLightPosition( Light light, Vector3 position )
|
> RL.SetLightPosition( Light light, Vector3 position )
|
||||||
|
|
||||||
Set light position
|
Set light position
|
||||||
|
|
||||||
- Failure return false
|
|
||||||
- Success return true
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
> success = RL.SetLightTarget( Light light, Vector3 target )
|
> RL.SetLightTarget( Light light, Vector3 target )
|
||||||
|
|
||||||
Set light target
|
Set light target
|
||||||
|
|
||||||
- Failure return false
|
|
||||||
- Success return true
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
> success = RL.SetLightColor( Light light, Color color )
|
> RL.SetLightColor( Light light, Color color )
|
||||||
|
|
||||||
Set light color
|
Set light color
|
||||||
|
|
||||||
- Failure return false
|
|
||||||
- Success return true
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
> success = RL.SetLightEnabled( Light light, bool enabled )
|
> RL.SetLightEnabled( Light light, bool enabled )
|
||||||
|
|
||||||
Set light enabled
|
Set light enabled
|
||||||
|
|
||||||
- Failure return false
|
|
||||||
- Success return true
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
> type = RL.GetLightType( Light light )
|
> type = RL.GetLightType( Light light )
|
||||||
|
|
||||||
Get light type
|
Get light type
|
||||||
|
|
||||||
- Failure return false
|
|
||||||
- Success return int
|
- Success return int
|
||||||
|
|
||||||
---
|
---
|
||||||
@@ -6535,7 +6430,6 @@ Get light type
|
|||||||
|
|
||||||
Get light position
|
Get light position
|
||||||
|
|
||||||
- Failure return false
|
|
||||||
- Success return Vector3
|
- Success return Vector3
|
||||||
|
|
||||||
---
|
---
|
||||||
@@ -6544,7 +6438,6 @@ Get light position
|
|||||||
|
|
||||||
Get light target
|
Get light target
|
||||||
|
|
||||||
- Failure return false
|
|
||||||
- Success return Vector3
|
- Success return Vector3
|
||||||
|
|
||||||
---
|
---
|
||||||
@@ -6553,7 +6446,6 @@ Get light target
|
|||||||
|
|
||||||
Get light color
|
Get light color
|
||||||
|
|
||||||
- Failure return false
|
|
||||||
- Success return Color
|
- Success return Color
|
||||||
|
|
||||||
---
|
---
|
||||||
@@ -6562,7 +6454,6 @@ Get light color
|
|||||||
|
|
||||||
Get light enabled
|
Get light enabled
|
||||||
|
|
||||||
- Failure return nil
|
|
||||||
- Success return boolean
|
- Success return boolean
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|||||||
222
ReiLua_API.lua
222
ReiLua_API.lua
@@ -2814,7 +2814,7 @@ function RL.LoadFont( fileName ) end
|
|||||||
---@return any font
|
---@return any font
|
||||||
function RL.LoadFontEx( fileName, fontSize, fontChars{} ) end
|
function RL.LoadFontEx( fileName, fontSize, fontChars{} ) end
|
||||||
|
|
||||||
---Load font from Image ( XNA style )
|
---Load font from Image ( XNA style)
|
||||||
---- Success return Font
|
---- Success return Font
|
||||||
---@param image any
|
---@param image any
|
||||||
---@param key table
|
---@param key table
|
||||||
@@ -3573,60 +3573,41 @@ function RL.GetRayCollisionQuad( ray, p1, p2, p3, p4 ) end
|
|||||||
|
|
||||||
-- Audio - Audio device management
|
-- Audio - Audio device management
|
||||||
|
|
||||||
---Set master volume ( listener )
|
---Set master volume (listener)
|
||||||
---- Failure return false
|
|
||||||
---- Success return true
|
|
||||||
---@param volume number
|
---@param volume number
|
||||||
---@return any success
|
---@return any RL.SetMasterVolume
|
||||||
function RL.SetMasterVolume( volume ) end
|
function RL.SetMasterVolume( volume ) end
|
||||||
|
|
||||||
-- Audio - Wave/Sound Loading
|
-- Audio - Wave/Sound Loading
|
||||||
|
|
||||||
---Load sound from file
|
---Load sound from file
|
||||||
---- Failure return -1
|
---- Failure return nil
|
||||||
---- Success return int
|
---- Success return Sound
|
||||||
---@param fileName string
|
---@param fileName string
|
||||||
---@return any sound
|
---@return any sound
|
||||||
function RL.LoadSound( fileName ) end
|
function RL.LoadSound( fileName ) end
|
||||||
|
|
||||||
---Load wave data from file
|
---Load wave data from file
|
||||||
---- Failure return -1
|
---- Failure return nil
|
||||||
---- Success return int
|
---- Success return Wave
|
||||||
---@param fileName string
|
---@param fileName string
|
||||||
---@return any wave
|
---@return any wave
|
||||||
function RL.LoadWave( fileName ) end
|
function RL.LoadWave( fileName ) end
|
||||||
|
|
||||||
---Load sound from wave data
|
---Load sound from wave data
|
||||||
---- Failure return -1
|
---- Success return Sound
|
||||||
---- Success return int
|
|
||||||
---@param wave any
|
---@param wave any
|
||||||
---@return any sound
|
---@return any sound
|
||||||
function RL.LoadSoundFromWave( wave ) end
|
function RL.LoadSoundFromWave( wave ) end
|
||||||
|
|
||||||
---Unload sound
|
|
||||||
---- Failure return false
|
|
||||||
---- Success return true
|
|
||||||
---@param sound any
|
|
||||||
---@return any success
|
|
||||||
function RL.UnloadSound( sound ) end
|
|
||||||
|
|
||||||
---Unload wave data
|
|
||||||
---- Failure return false
|
|
||||||
---- Success return true
|
|
||||||
---@param wave any
|
|
||||||
---@return any success
|
|
||||||
function RL.UnloadWave( wave ) end
|
|
||||||
|
|
||||||
---Export wave data to file, returns true on success
|
---Export wave data to file, returns true on success
|
||||||
---- Failure return false
|
---- Success return bool
|
||||||
---- Success return true
|
|
||||||
---@param wave any
|
---@param wave any
|
||||||
---@param fileName string
|
---@param fileName string
|
||||||
---@return any success
|
---@return any success
|
||||||
function RL.ExportWave( wave, fileName ) end
|
function RL.ExportWave( wave, fileName ) end
|
||||||
|
|
||||||
---Export wave sample data to code (.h), returns true on success
|
---Export wave sample data to code (.h), returns true on success
|
||||||
---- Failure return false
|
|
||||||
---- Success return true
|
---- Success return true
|
||||||
---@param wave any
|
---@param wave any
|
||||||
---@param fileName string
|
---@param fileName string
|
||||||
@@ -3636,200 +3617,155 @@ function RL.ExportWaveAsCode( wave, fileName ) end
|
|||||||
-- Audio - Wave/Sound management
|
-- Audio - Wave/Sound management
|
||||||
|
|
||||||
---Play a sound
|
---Play a sound
|
||||||
---- Failure return false
|
|
||||||
---- Success return true
|
|
||||||
---@param sound any
|
---@param sound any
|
||||||
---@return any success
|
---@return any RL.PlaySound
|
||||||
function RL.PlaySound( sound ) end
|
function RL.PlaySound( sound ) end
|
||||||
|
|
||||||
---Stop playing a sound
|
---Stop playing a sound
|
||||||
---- Failure return false
|
|
||||||
---- Success return true
|
|
||||||
---@param sound any
|
---@param sound any
|
||||||
---@return any success
|
---@return any RL.StopSound
|
||||||
function RL.StopSound( sound ) end
|
function RL.StopSound( sound ) end
|
||||||
|
|
||||||
---Pause a sound
|
---Pause a sound
|
||||||
---- Failure return false
|
|
||||||
---- Success return true
|
|
||||||
---@param sound any
|
---@param sound any
|
||||||
---@return any success
|
---@return any RL.PauseSound
|
||||||
function RL.PauseSound( sound ) end
|
function RL.PauseSound( sound ) end
|
||||||
|
|
||||||
---Resume a paused sound
|
---Resume a paused sound
|
||||||
---- Failure return false
|
|
||||||
---- Success return true
|
|
||||||
---@param sound any
|
---@param sound any
|
||||||
---@return any success
|
---@return any RL.ResumeSound
|
||||||
function RL.ResumeSound( sound ) end
|
function RL.ResumeSound( sound ) end
|
||||||
|
|
||||||
---Check if a sound is currently playing
|
---Check if a sound is currently playing
|
||||||
---- Failure return nil
|
|
||||||
---- Success return bool
|
---- Success return bool
|
||||||
---@param sound any
|
---@param sound any
|
||||||
---@return any playing
|
---@return any playing
|
||||||
function RL.IsSoundPlaying( sound ) end
|
function RL.IsSoundPlaying( sound ) end
|
||||||
|
|
||||||
---Set volume for a sound ( 1.0 is max level )
|
---Set volume for a sound (1.0 is max level)
|
||||||
---- Failure return false
|
|
||||||
---- Success return true
|
|
||||||
---@param sound any
|
---@param sound any
|
||||||
---@param volume number
|
---@param volume number
|
||||||
---@return any success
|
---@return any RL.SetSoundVolume
|
||||||
function RL.SetSoundVolume( sound, volume ) end
|
function RL.SetSoundVolume( sound, volume ) end
|
||||||
|
|
||||||
---Set pitch for a sound ( 1.0 is base level )
|
---Set pitch for a sound (1.0 is base level)
|
||||||
---- Failure return false
|
|
||||||
---- Success return true
|
|
||||||
---@param sound any
|
---@param sound any
|
||||||
---@param pitch number
|
---@param pitch number
|
||||||
---@return any success
|
---@return any RL.SetSoundPitch
|
||||||
function RL.SetSoundPitch( sound, pitch ) end
|
function RL.SetSoundPitch( sound, pitch ) end
|
||||||
|
|
||||||
---Set pan for a sound ( 0.5 is center )
|
---Set pan for a sound (0.5 is center)
|
||||||
---- Failure return false
|
|
||||||
---- Success return true
|
|
||||||
---@param sound any
|
---@param sound any
|
||||||
---@param pan number
|
---@param pan number
|
||||||
---@return any success
|
---@return any RL.SetSoundPan
|
||||||
function RL.SetSoundPan( sound, pan ) end
|
function RL.SetSoundPan( sound, pan ) end
|
||||||
|
|
||||||
---Convert wave data to desired format
|
---Convert wave data to desired format
|
||||||
---- Failure return false
|
|
||||||
---- Success return true
|
|
||||||
---@param wave any
|
---@param wave any
|
||||||
---@param sampleRate integer
|
---@param sampleRate integer
|
||||||
---@param sampleSize integer
|
---@param sampleSize integer
|
||||||
---@param channels integer
|
---@param channels integer
|
||||||
---@return any success
|
---@return any RL.WaveFormat
|
||||||
function RL.WaveFormat( wave, sampleRate, sampleSize, channels ) end
|
function RL.WaveFormat( wave, sampleRate, sampleSize, channels ) end
|
||||||
|
|
||||||
---Copy a wave to a new wave
|
---Copy a wave to a new wave
|
||||||
---- Failure return -1
|
---- Success return Wave
|
||||||
---- Success return int
|
|
||||||
---@param wave any
|
---@param wave any
|
||||||
---@return any wave
|
---@return any wave
|
||||||
function RL.WaveCopy( wave ) end
|
function RL.WaveCopy( wave ) end
|
||||||
|
|
||||||
---Crop a wave to defined samples range
|
---Crop a wave to defined samples range
|
||||||
---- Failure return false
|
|
||||||
---- Success return true
|
|
||||||
---@param wave any
|
---@param wave any
|
||||||
---@param initSample integer
|
---@param initSample integer
|
||||||
---@param finalSample integer
|
---@param finalSample integer
|
||||||
---@return any success
|
---@return any RL.WaveCrop
|
||||||
function RL.WaveCrop( wave, initSample, finalSample ) end
|
function RL.WaveCrop( wave, initSample, finalSample ) end
|
||||||
|
|
||||||
-- Audio - Music management
|
-- Audio - Music management
|
||||||
|
|
||||||
---Load music stream from file
|
---Load music stream from file
|
||||||
---- Failure return -1
|
---- Success return Music
|
||||||
---- Success return int
|
|
||||||
---@param fileName string
|
---@param fileName string
|
||||||
---@return any music
|
---@return any music
|
||||||
function RL.LoadMusicStream( fileName ) end
|
function RL.LoadMusicStream( fileName ) end
|
||||||
|
|
||||||
---Start music playing
|
---Start music playing
|
||||||
---- Failure return false
|
|
||||||
---- Success return true
|
|
||||||
---@param music any
|
---@param music any
|
||||||
---@return any success
|
---@return any RL.PlayMusicStream
|
||||||
function RL.PlayMusicStream( music ) end
|
function RL.PlayMusicStream( music ) end
|
||||||
|
|
||||||
---Check if music is playing
|
---Check if music is playing
|
||||||
---- Failure return nil
|
|
||||||
---- Success return bool
|
---- Success return bool
|
||||||
---@param music any
|
---@param music any
|
||||||
---@return any playing
|
---@return any playing
|
||||||
function RL.IsMusicStreamPlaying( music ) end
|
function RL.IsMusicStreamPlaying( music ) end
|
||||||
|
|
||||||
---Updates buffers for music streaming
|
---Updates buffers for music streaming
|
||||||
---- Failure return false
|
|
||||||
---- Success return true
|
|
||||||
---@param music any
|
---@param music any
|
||||||
---@return any success
|
---@return any RL.UpdateMusicStream
|
||||||
function RL.UpdateMusicStream( music ) end
|
function RL.UpdateMusicStream( music ) end
|
||||||
|
|
||||||
---Stop music playing
|
---Stop music playing
|
||||||
---- Failure return false
|
|
||||||
---- Success return true
|
|
||||||
---@param music any
|
---@param music any
|
||||||
---@return any success
|
---@return any RL.StopMusicStream
|
||||||
function RL.StopMusicStream( music ) end
|
function RL.StopMusicStream( music ) end
|
||||||
|
|
||||||
---Pause music playing
|
---Pause music playing
|
||||||
---- Failure return false
|
|
||||||
---- Success return true
|
|
||||||
---@param music any
|
---@param music any
|
||||||
---@return any success
|
---@return any RL.PauseMusicStream
|
||||||
function RL.PauseMusicStream( music ) end
|
function RL.PauseMusicStream( music ) end
|
||||||
|
|
||||||
---Resume playing paused music
|
---Resume playing paused music
|
||||||
---- Failure return false
|
|
||||||
---- Success return true
|
|
||||||
---@param music any
|
---@param music any
|
||||||
---@return any success
|
---@return any RL.ResumeMusicStream
|
||||||
function RL.ResumeMusicStream( music ) end
|
function RL.ResumeMusicStream( music ) end
|
||||||
|
|
||||||
---Seek music to a position ( in seconds )
|
---Seek music to a position (in seconds)
|
||||||
---- Failure return false
|
|
||||||
---- Success return true
|
|
||||||
---@param music any
|
---@param music any
|
||||||
---@param position number
|
---@param position number
|
||||||
---@return any success
|
---@return any RL.SeekMusicStream
|
||||||
function RL.SeekMusicStream( music, position ) end
|
function RL.SeekMusicStream( music, position ) end
|
||||||
|
|
||||||
---Set volume for music ( 1.0 is max level )
|
---Set volume for music (1.0 is max level)
|
||||||
---- Failure return false
|
|
||||||
---- Success return true
|
|
||||||
---@param music any
|
---@param music any
|
||||||
---@param volume number
|
---@param volume number
|
||||||
---@return any success
|
---@return any RL.SetMusicVolume
|
||||||
function RL.SetMusicVolume( music, volume ) end
|
function RL.SetMusicVolume( music, volume ) end
|
||||||
|
|
||||||
---Set pitch for a music ( 1.0 is base level )
|
---Set pitch for a music (1.0 is base level)
|
||||||
---- Failure return false
|
|
||||||
---- Success return true
|
|
||||||
---@param music any
|
---@param music any
|
||||||
---@param pitch number
|
---@param pitch number
|
||||||
---@return any success
|
---@return any RL.SetMusicPitch
|
||||||
function RL.SetMusicPitch( music, pitch ) end
|
function RL.SetMusicPitch( music, pitch ) end
|
||||||
|
|
||||||
---Set pan for a music ( 0.5 is center )
|
---Set pan for a music (0.5 is center)
|
||||||
---- Failure return false
|
|
||||||
---- Success return true
|
|
||||||
---@param music any
|
---@param music any
|
||||||
---@param pan number
|
---@param pan number
|
||||||
---@return any success
|
---@return any RL.SetMusicPan
|
||||||
function RL.SetMusicPan( music, pan ) end
|
function RL.SetMusicPan( music, pan ) end
|
||||||
|
|
||||||
---Set looping for a music
|
---Set looping for a music
|
||||||
---- Failure return false
|
|
||||||
---- Success return true
|
|
||||||
---@param music any
|
---@param music any
|
||||||
---@param looping boolean
|
---@param looping boolean
|
||||||
---@return any success
|
---@return any RL.SetMusicLooping
|
||||||
function RL.SetMusicLooping( music, looping ) end
|
function RL.SetMusicLooping( music, looping ) end
|
||||||
|
|
||||||
---Get looping of a music
|
---Get looping of a music
|
||||||
---- Failure return nil
|
|
||||||
---- Success return bool
|
---- Success return bool
|
||||||
---@param music any
|
---@param music any
|
||||||
---@return any looping
|
---@return any looping
|
||||||
function RL.GetMusicLooping( music ) end
|
function RL.GetMusicLooping( music ) end
|
||||||
|
|
||||||
---Get music time length ( in seconds )
|
---Get music time length (in seconds)
|
||||||
---- Failure return false
|
|
||||||
---- Success return float
|
---- Success return float
|
||||||
---@param music any
|
---@param music any
|
||||||
---@return any length
|
---@return any length
|
||||||
function RL.GetMusicTimeLength( music ) end
|
function RL.GetMusicTimeLength( music ) end
|
||||||
|
|
||||||
---Get current music time played ( in seconds )
|
---Get current music time played (in seconds)
|
||||||
---- Failure return false
|
|
||||||
---- Success return float
|
---- Success return float
|
||||||
---@param music any
|
---@param music any
|
||||||
---@return any played
|
---@return any timePlayed
|
||||||
function RL.GetMusicTimePlayed( music ) end
|
function RL.GetMusicTimePlayed( music ) end
|
||||||
|
|
||||||
-- Math - Utils
|
-- Math - Utils
|
||||||
@@ -5189,8 +5125,7 @@ function RL.GuiCheckIconPixel( iconId, pos ) end
|
|||||||
-- Lights - Basics
|
-- Lights - Basics
|
||||||
|
|
||||||
---Create a light and get shader locations
|
---Create a light and get shader locations
|
||||||
---- Failure return -1
|
---- Success return Light
|
||||||
---- Success return int
|
|
||||||
---@param type integer
|
---@param type integer
|
||||||
---@param position table
|
---@param position table
|
||||||
---@param target table
|
---@param target table
|
||||||
@@ -5206,75 +5141,60 @@ function RL.CreateLight( type, position, target, color, shader ) end
|
|||||||
function RL.UpdateLightValues( shader, light ) end
|
function RL.UpdateLightValues( shader, light ) end
|
||||||
|
|
||||||
---Set light type
|
---Set light type
|
||||||
---- Failure return false
|
|
||||||
---- Success return true
|
|
||||||
---@param light any
|
---@param light any
|
||||||
---@param type integer
|
---@param type integer
|
||||||
---@return any success
|
---@return any RL.SetLightType
|
||||||
function RL.SetLightType( light, type ) end
|
function RL.SetLightType( light, type ) end
|
||||||
|
|
||||||
---Set light position
|
---Set light position
|
||||||
---- Failure return false
|
|
||||||
---- Success return true
|
|
||||||
---@param light any
|
---@param light any
|
||||||
---@param position table
|
---@param position table
|
||||||
---@return any success
|
---@return any RL.SetLightPosition
|
||||||
function RL.SetLightPosition( light, position ) end
|
function RL.SetLightPosition( light, position ) end
|
||||||
|
|
||||||
---Set light target
|
---Set light target
|
||||||
---- Failure return false
|
|
||||||
---- Success return true
|
|
||||||
---@param light any
|
---@param light any
|
||||||
---@param target table
|
---@param target table
|
||||||
---@return any success
|
---@return any RL.SetLightTarget
|
||||||
function RL.SetLightTarget( light, target ) end
|
function RL.SetLightTarget( light, target ) end
|
||||||
|
|
||||||
---Set light color
|
---Set light color
|
||||||
---- Failure return false
|
|
||||||
---- Success return true
|
|
||||||
---@param light any
|
---@param light any
|
||||||
---@param color table
|
---@param color table
|
||||||
---@return any success
|
---@return any RL.SetLightColor
|
||||||
function RL.SetLightColor( light, color ) end
|
function RL.SetLightColor( light, color ) end
|
||||||
|
|
||||||
---Set light enabled
|
---Set light enabled
|
||||||
---- Failure return false
|
|
||||||
---- Success return true
|
|
||||||
---@param light any
|
---@param light any
|
||||||
---@param enabled boolean
|
---@param enabled boolean
|
||||||
---@return any success
|
---@return any RL.SetLightEnabled
|
||||||
function RL.SetLightEnabled( light, enabled ) end
|
function RL.SetLightEnabled( light, enabled ) end
|
||||||
|
|
||||||
---Get light type
|
---Get light type
|
||||||
---- Failure return false
|
|
||||||
---- Success return int
|
---- Success return int
|
||||||
---@param light any
|
---@param light any
|
||||||
---@return any type
|
---@return any type
|
||||||
function RL.GetLightType( light ) end
|
function RL.GetLightType( light ) end
|
||||||
|
|
||||||
---Get light position
|
---Get light position
|
||||||
---- Failure return false
|
|
||||||
---- Success return Vector3
|
---- Success return Vector3
|
||||||
---@param light any
|
---@param light any
|
||||||
---@return any position
|
---@return any position
|
||||||
function RL.GetLightPosition( light ) end
|
function RL.GetLightPosition( light ) end
|
||||||
|
|
||||||
---Get light target
|
---Get light target
|
||||||
---- Failure return false
|
|
||||||
---- Success return Vector3
|
---- Success return Vector3
|
||||||
---@param light any
|
---@param light any
|
||||||
---@return any target
|
---@return any target
|
||||||
function RL.GetLightTarget( light ) end
|
function RL.GetLightTarget( light ) end
|
||||||
|
|
||||||
---Get light color
|
---Get light color
|
||||||
---- Failure return false
|
|
||||||
---- Success return Color
|
---- Success return Color
|
||||||
---@param light any
|
---@param light any
|
||||||
---@return any color
|
---@return any color
|
||||||
function RL.GetLightColor( light ) end
|
function RL.GetLightColor( light ) end
|
||||||
|
|
||||||
---Get light enabled
|
---Get light enabled
|
||||||
---- Failure return nil
|
|
||||||
---- Success return boolean
|
---- Success return boolean
|
||||||
---@param light any
|
---@param light any
|
||||||
---@return any enabled
|
---@return any enabled
|
||||||
|
|||||||
@@ -14,7 +14,9 @@ DETAILED CHANGES:
|
|||||||
- ADDED: GetRenderTextureTexture and GetRenderTextureDepthTexture.
|
- ADDED: GetRenderTextureTexture and GetRenderTextureDepthTexture.
|
||||||
- REMOVED: UnloadCamera2D and UnloadCamera3D.
|
- REMOVED: UnloadCamera2D and UnloadCamera3D.
|
||||||
- REMOVED: UnloadShader.
|
- REMOVED: UnloadShader.
|
||||||
|
- REMOVED: UnloadFont.
|
||||||
- ADDED: LoadFontEx takes also fontChars.
|
- ADDED: LoadFontEx takes also fontChars.
|
||||||
|
- REMOVED: UnloadWave and UnloadSound.
|
||||||
|
|
||||||
------------------------------------------------------------------------
|
------------------------------------------------------------------------
|
||||||
Release: ReiLua version 0.5.0 Using Raylib 4.5
|
Release: ReiLua version 0.5.0 Using Raylib 4.5
|
||||||
|
|||||||
@@ -6,8 +6,6 @@ int laudioSetMasterVolume( lua_State *L );
|
|||||||
int laudioLoadSound( lua_State *L );
|
int laudioLoadSound( lua_State *L );
|
||||||
int laudioLoadWave( lua_State *L );
|
int laudioLoadWave( lua_State *L );
|
||||||
int laudioLoadSoundFromWave( lua_State *L );
|
int laudioLoadSoundFromWave( lua_State *L );
|
||||||
int laudioUnloadSound( lua_State *L );
|
|
||||||
int laudioUnloadWave( lua_State *L );
|
|
||||||
int laudioExportWave( lua_State *L );
|
int laudioExportWave( lua_State *L );
|
||||||
int laudioExportWaveAsCode( lua_State *L );
|
int laudioExportWaveAsCode( lua_State *L );
|
||||||
/* Wave/Sound management. */
|
/* Wave/Sound management. */
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
/* Validators. */
|
|
||||||
bool validLight( size_t id );
|
|
||||||
/* Basics. */
|
/* Basics. */
|
||||||
int llightsCreateLight( lua_State *L );
|
int llightsCreateLight( lua_State *L );
|
||||||
int llightsUpdateLightValues( lua_State *L );
|
int llightsUpdateLightValues( lua_State *L );
|
||||||
|
|||||||
@@ -75,6 +75,10 @@ void uluaPushCamera2D( lua_State *L, Camera2D camera );
|
|||||||
void uluaPushCamera3D( lua_State *L, Camera3D camera );
|
void uluaPushCamera3D( lua_State *L, Camera3D camera );
|
||||||
void uluaPushShader( lua_State *L, Shader shader );
|
void uluaPushShader( lua_State *L, Shader shader );
|
||||||
void uluaPushFont( lua_State *L, Font font );
|
void uluaPushFont( lua_State *L, Font font );
|
||||||
|
void uluaPushWave( lua_State *L, Wave wave );
|
||||||
|
void uluaPushSound( lua_State *L, Sound sound );
|
||||||
|
void uluaPushMusic( lua_State *L, Music music );
|
||||||
|
void uluaPushLight( lua_State *L, Light light );
|
||||||
|
|
||||||
int uluaGetTableLen( lua_State *L );
|
int uluaGetTableLen( lua_State *L );
|
||||||
int uluaGetTableLenIndex( lua_State *L, int index );
|
int uluaGetTableLenIndex( lua_State *L, int index );
|
||||||
|
|||||||
@@ -15,18 +15,6 @@ typedef struct {
|
|||||||
Vector2 resolution;
|
Vector2 resolution;
|
||||||
int logLevelInvalid;
|
int logLevelInvalid;
|
||||||
/* Resources. */
|
/* Resources. */
|
||||||
/* Sounds. */
|
|
||||||
Wave **waves;
|
|
||||||
size_t waveCount;
|
|
||||||
size_t waveAlloc;
|
|
||||||
/* Sounds. */
|
|
||||||
Sound **sounds;
|
|
||||||
size_t soundCount;
|
|
||||||
size_t soundAlloc;
|
|
||||||
/* Music. */
|
|
||||||
Music **musics;
|
|
||||||
size_t musicCount;
|
|
||||||
size_t musicAlloc;
|
|
||||||
/* Meshes. */
|
/* Meshes. */
|
||||||
Mesh **meshes;
|
Mesh **meshes;
|
||||||
size_t meshCount;
|
size_t meshCount;
|
||||||
@@ -43,10 +31,6 @@ typedef struct {
|
|||||||
ModelAnimations **animations;
|
ModelAnimations **animations;
|
||||||
size_t animationCount;
|
size_t animationCount;
|
||||||
size_t animationAlloc;
|
size_t animationAlloc;
|
||||||
/* Lights. */
|
|
||||||
Light **lights;
|
|
||||||
size_t lightCount;
|
|
||||||
size_t lightAlloc;
|
|
||||||
/* Raylib GLFW input callback events. */
|
/* Raylib GLFW input callback events. */
|
||||||
/* Window events. */
|
/* Window events. */
|
||||||
GLFWwindowsizefun raylibWindowSizeCallback;
|
GLFWwindowsizefun raylibWindowSizeCallback;
|
||||||
|
|||||||
834
src/audio.c
834
src/audio.c
File diff suppressed because it is too large
Load Diff
2
src/gl.c
2
src/gl.c
@@ -15,7 +15,7 @@ Copy a block of pixels from one framebuffer object to another.
|
|||||||
Use -1 RenderTexture for window framebuffer.
|
Use -1 RenderTexture for window framebuffer.
|
||||||
*/
|
*/
|
||||||
int lglBlitFramebuffer( lua_State *L ) {
|
int lglBlitFramebuffer( lua_State *L ) {
|
||||||
// TOCO Currently doesn't support setting window render target because of luaL_checkudata.
|
// TODO Currently doesn't support setting window render target because of luaL_checkudata.
|
||||||
RenderTexture *srcTex = luaL_checkudata( L, 1, "RenderTexture" );
|
RenderTexture *srcTex = luaL_checkudata( L, 1, "RenderTexture" );
|
||||||
RenderTexture *dstTex = luaL_checkudata( L, 2, "RenderTexture" );
|
RenderTexture *dstTex = luaL_checkudata( L, 2, "RenderTexture" );
|
||||||
Rectangle srcRect = uluaGetRectangleIndex( L, 3 );
|
Rectangle srcRect = uluaGetRectangleIndex( L, 3 );
|
||||||
|
|||||||
233
src/lights.c
233
src/lights.c
@@ -7,45 +7,6 @@
|
|||||||
#define RLIGHTS_IMPLEMENTATION
|
#define RLIGHTS_IMPLEMENTATION
|
||||||
#include "rlights.h"
|
#include "rlights.h"
|
||||||
|
|
||||||
static void checkLightRealloc( int i ) {
|
|
||||||
if ( i == state->lightCount ) {
|
|
||||||
state->lightCount++;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( state->lightCount == state->lightAlloc ) {
|
|
||||||
state->lightAlloc += ALLOC_PAGE_SIZE;
|
|
||||||
state->lights = realloc( state->lights, state->lightAlloc * sizeof( Light* ) );
|
|
||||||
|
|
||||||
for ( i = state->lightCount; i < state->lightAlloc; i++ ) {
|
|
||||||
state->lights[i] = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool validLight( size_t id ) {
|
|
||||||
if ( id < 0 || state->lightCount < id || state->lights[ id ] == NULL ) {
|
|
||||||
TraceLog( state->logLevelInvalid, "%s %d", "Invalid light", id );
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static int newLight() {
|
|
||||||
int i = 0;
|
|
||||||
|
|
||||||
for ( i = 0; i < state->lightCount; i++ ) {
|
|
||||||
if ( state->lights[i] == NULL ) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
state->lights[i] = malloc( sizeof( Light ) );
|
|
||||||
checkLightRealloc( i );
|
|
||||||
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
## Lights - Basics
|
## Lights - Basics
|
||||||
*/
|
*/
|
||||||
@@ -55,8 +16,7 @@ static int newLight() {
|
|||||||
|
|
||||||
Create a light and get shader locations
|
Create a light and get shader locations
|
||||||
|
|
||||||
- Failure return -1
|
- Success return Light
|
||||||
- Success return int
|
|
||||||
*/
|
*/
|
||||||
int llightsCreateLight( lua_State *L ) {
|
int llightsCreateLight( lua_State *L ) {
|
||||||
int type = luaL_checkinteger( L, 1 );
|
int type = luaL_checkinteger( L, 1 );
|
||||||
@@ -65,9 +25,7 @@ int llightsCreateLight( lua_State *L ) {
|
|||||||
Color color = uluaGetColorIndex( L, 4 );
|
Color color = uluaGetColorIndex( L, 4 );
|
||||||
Shader *shader = luaL_checkudata( L, 5, "Shader" );
|
Shader *shader = luaL_checkudata( L, 5, "Shader" );
|
||||||
|
|
||||||
int i = newLight();
|
uluaPushLight( L, CreateLight( type, position, target, color, *shader ) );
|
||||||
*state->lights[i] = CreateLight( type, position, target, color, *shader );
|
|
||||||
lua_pushinteger( L, i );
|
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -79,150 +37,81 @@ Send light properties to shader
|
|||||||
*/
|
*/
|
||||||
int llightsUpdateLightValues( lua_State *L ) {
|
int llightsUpdateLightValues( lua_State *L ) {
|
||||||
Shader *shader = luaL_checkudata( L, 1, "Shader" );
|
Shader *shader = luaL_checkudata( L, 1, "Shader" );
|
||||||
size_t lightId = lua_tointeger( L, 2 );
|
Light *light = luaL_checkudata( L, 2, "Light" );
|
||||||
|
|
||||||
if ( !validLight( lightId ) ) {
|
UpdateLightValues( *shader, *light );
|
||||||
lua_pushboolean( L, false );
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
UpdateLightValues( *shader, *state->lights[ lightId ] );
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
> success = RL.SetLightType( Light light, int type )
|
> RL.SetLightType( Light light, int type )
|
||||||
|
|
||||||
Set light type
|
Set light type
|
||||||
|
|
||||||
- Failure return false
|
|
||||||
- Success return true
|
|
||||||
*/
|
*/
|
||||||
int llightsSetLightType( lua_State *L ) {
|
int llightsSetLightType( lua_State *L ) {
|
||||||
if ( !lua_isnumber( L, 1 ) || !lua_isnumber( L, 2 ) ) {
|
Light *light = luaL_checkudata( L, 1, "Light" );
|
||||||
TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.SetLightType( Light light, int type )" );
|
int type = luaL_checkinteger( L, 2 );
|
||||||
lua_pushboolean( L, false );
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
size_t lightId = lua_tointeger( L, 1 );
|
|
||||||
int type = lua_tointeger( L, 2 );
|
|
||||||
|
|
||||||
if ( !validLight( lightId ) ) {
|
light->type = type;
|
||||||
lua_pushboolean( L, false );
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
state->lights[ lightId ]->type = type;
|
|
||||||
lua_pushboolean( L, true );
|
|
||||||
|
|
||||||
return 1;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
> success = RL.SetLightPosition( Light light, Vector3 position )
|
> RL.SetLightPosition( Light light, Vector3 position )
|
||||||
|
|
||||||
Set light position
|
Set light position
|
||||||
|
|
||||||
- Failure return false
|
|
||||||
- Success return true
|
|
||||||
*/
|
*/
|
||||||
int llightsSetLightPosition( lua_State *L ) {
|
int llightsSetLightPosition( lua_State *L ) {
|
||||||
if ( !lua_isnumber( L, 1 ) || !lua_istable( L, 2 ) ) {
|
Light *light = luaL_checkudata( L, 1, "Light" );
|
||||||
TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.SetLightPosition( Light light, Vecto3 position )" );
|
|
||||||
lua_pushboolean( L, false );
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
size_t lightId = lua_tointeger( L, 1 );
|
|
||||||
Vector3 position = uluaGetVector3Index( L, 2 );
|
Vector3 position = uluaGetVector3Index( L, 2 );
|
||||||
|
|
||||||
if ( !validLight( lightId ) ) {
|
light->position = position;
|
||||||
lua_pushboolean( L, false );
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
state->lights[ lightId ]->position = position;
|
|
||||||
lua_pushboolean( L, true );
|
|
||||||
|
|
||||||
return 1;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
> success = RL.SetLightTarget( Light light, Vector3 target )
|
> RL.SetLightTarget( Light light, Vector3 target )
|
||||||
|
|
||||||
Set light target
|
Set light target
|
||||||
|
|
||||||
- Failure return false
|
|
||||||
- Success return true
|
|
||||||
*/
|
*/
|
||||||
int llightsSetLightTarget( lua_State *L ) {
|
int llightsSetLightTarget( lua_State *L ) {
|
||||||
if ( !lua_isnumber( L, 1 ) || !lua_istable( L, 2 ) ) {
|
Light *light = luaL_checkudata( L, 1, "Light" );
|
||||||
TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.SetLightTarget( Light light, Vecto3 target )" );
|
|
||||||
lua_pushboolean( L, false );
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
size_t lightId = lua_tointeger( L, 1 );
|
|
||||||
Vector3 target = uluaGetVector3Index( L, 2 );
|
Vector3 target = uluaGetVector3Index( L, 2 );
|
||||||
|
|
||||||
if ( !validLight( lightId ) ) {
|
light->target = target;
|
||||||
lua_pushboolean( L, false );
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
state->lights[ lightId ]->target = target;
|
|
||||||
lua_pushboolean( L, true );
|
|
||||||
|
|
||||||
return 1;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
> success = RL.SetLightColor( Light light, Color color )
|
> RL.SetLightColor( Light light, Color color )
|
||||||
|
|
||||||
Set light color
|
Set light color
|
||||||
|
|
||||||
- Failure return false
|
|
||||||
- Success return true
|
|
||||||
*/
|
*/
|
||||||
int llightsSetLightColor( lua_State *L ) {
|
int llightsSetLightColor( lua_State *L ) {
|
||||||
if ( !lua_isnumber( L, 1 ) || !lua_istable( L, 2 ) ) {
|
Light *light = luaL_checkudata( L, 1, "Light" );
|
||||||
TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.SetLightColor( Light light, Color color )" );
|
|
||||||
lua_pushboolean( L, false );
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
size_t lightId = lua_tointeger( L, 1 );
|
|
||||||
Color color = uluaGetColorIndex( L, 2 );
|
Color color = uluaGetColorIndex( L, 2 );
|
||||||
|
|
||||||
if ( !validLight( lightId ) ) {
|
light->color = color;
|
||||||
lua_pushboolean( L, false );
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
state->lights[ lightId ]->color = color;
|
|
||||||
lua_pushboolean( L, true );
|
|
||||||
|
|
||||||
return 1;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
> success = RL.SetLightEnabled( Light light, bool enabled )
|
> RL.SetLightEnabled( Light light, bool enabled )
|
||||||
|
|
||||||
Set light enabled
|
Set light enabled
|
||||||
|
|
||||||
- Failure return false
|
|
||||||
- Success return true
|
|
||||||
*/
|
*/
|
||||||
int llightsSetLightEnabled( lua_State *L ) {
|
int llightsSetLightEnabled( lua_State *L ) {
|
||||||
if ( !lua_isnumber( L, 1 ) || !lua_isboolean( L, 2 ) ) {
|
Light *light = luaL_checkudata( L, 1, "Light" );
|
||||||
TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.SetLightEnabled( Light light, bool enabled )" );
|
bool enabled = uluaGetBoolean( L, 2 );
|
||||||
lua_pushboolean( L, false );
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
size_t lightId = lua_tointeger( L, 1 );
|
|
||||||
bool enabled = lua_toboolean( L, 2 );
|
|
||||||
|
|
||||||
if ( !validLight( lightId ) ) {
|
light->enabled = enabled;
|
||||||
lua_pushboolean( L, false );
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
state->lights[ lightId ]->enabled = enabled;
|
|
||||||
lua_pushboolean( L, true );
|
|
||||||
|
|
||||||
return 1;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -230,22 +119,12 @@ int llightsSetLightEnabled( lua_State *L ) {
|
|||||||
|
|
||||||
Get light type
|
Get light type
|
||||||
|
|
||||||
- Failure return false
|
|
||||||
- Success return int
|
- Success return int
|
||||||
*/
|
*/
|
||||||
int llightsGetLightType( lua_State *L ) {
|
int llightsGetLightType( lua_State *L ) {
|
||||||
if ( !lua_isnumber( L, 1 ) ) {
|
Light *light = luaL_checkudata( L, 1, "Light" );
|
||||||
TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.GetLightType( Light light )" );
|
|
||||||
lua_pushboolean( L, false );
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
size_t lightId = lua_tointeger( L, 1 );
|
|
||||||
|
|
||||||
if ( !validLight( lightId ) ) {
|
lua_pushinteger( L, light->type );
|
||||||
lua_pushboolean( L, false );
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
lua_pushinteger( L, state->lights[ lightId ]->type );
|
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -255,22 +134,12 @@ int llightsGetLightType( lua_State *L ) {
|
|||||||
|
|
||||||
Get light position
|
Get light position
|
||||||
|
|
||||||
- Failure return false
|
|
||||||
- Success return Vector3
|
- Success return Vector3
|
||||||
*/
|
*/
|
||||||
int llightsGetLightPosition( lua_State *L ) {
|
int llightsGetLightPosition( lua_State *L ) {
|
||||||
if ( !lua_isnumber( L, 1 ) ) {
|
Light *light = luaL_checkudata( L, 1, "Light" );
|
||||||
TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.GetLightPosition( Light light )" );
|
|
||||||
lua_pushboolean( L, false );
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
size_t lightId = lua_tointeger( L, 1 );
|
|
||||||
|
|
||||||
if ( !validLight( lightId ) ) {
|
uluaPushVector3( L, light->position );
|
||||||
lua_pushboolean( L, false );
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
uluaPushVector3( L, state->lights[ lightId ]->position );
|
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -280,22 +149,12 @@ int llightsGetLightPosition( lua_State *L ) {
|
|||||||
|
|
||||||
Get light target
|
Get light target
|
||||||
|
|
||||||
- Failure return false
|
|
||||||
- Success return Vector3
|
- Success return Vector3
|
||||||
*/
|
*/
|
||||||
int llightsGetLightTarget( lua_State *L ) {
|
int llightsGetLightTarget( lua_State *L ) {
|
||||||
if ( !lua_isnumber( L, 1 ) ) {
|
Light *light = luaL_checkudata( L, 1, "Light" );
|
||||||
TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.GetLightTarget( Light light )" );
|
|
||||||
lua_pushboolean( L, false );
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
size_t lightId = lua_tointeger( L, 1 );
|
|
||||||
|
|
||||||
if ( !validLight( lightId ) ) {
|
uluaPushVector3( L, light->target );
|
||||||
lua_pushboolean( L, false );
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
uluaPushVector3( L, state->lights[ lightId ]->target );
|
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -305,22 +164,12 @@ int llightsGetLightTarget( lua_State *L ) {
|
|||||||
|
|
||||||
Get light color
|
Get light color
|
||||||
|
|
||||||
- Failure return false
|
|
||||||
- Success return Color
|
- Success return Color
|
||||||
*/
|
*/
|
||||||
int llightsGetLightColor( lua_State *L ) {
|
int llightsGetLightColor( lua_State *L ) {
|
||||||
if ( !lua_isnumber( L, 1 ) ) {
|
Light *light = luaL_checkudata( L, 1, "Light" );
|
||||||
TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.GetLightColor( Light light )" );
|
|
||||||
lua_pushboolean( L, false );
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
size_t lightId = lua_tointeger( L, 1 );
|
|
||||||
|
|
||||||
if ( !validLight( lightId ) ) {
|
uluaPushColor( L, light->color );
|
||||||
lua_pushboolean( L, false );
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
uluaPushColor( L, state->lights[ lightId ]->color );
|
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -330,22 +179,12 @@ int llightsGetLightColor( lua_State *L ) {
|
|||||||
|
|
||||||
Get light enabled
|
Get light enabled
|
||||||
|
|
||||||
- Failure return nil
|
|
||||||
- Success return boolean
|
- Success return boolean
|
||||||
*/
|
*/
|
||||||
int llightsIsLightEnabled( lua_State *L ) {
|
int llightsIsLightEnabled( lua_State *L ) {
|
||||||
if ( !lua_isnumber( L, 1 ) ) {
|
Light *light = luaL_checkudata( L, 1, "Light" );
|
||||||
TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.IsLightEnabled( Light light )" );
|
|
||||||
lua_pushnil( L );
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
size_t lightId = lua_tointeger( L, 1 );
|
|
||||||
|
|
||||||
if ( !validLight( lightId ) ) {
|
lua_pushboolean( L, light->enabled );
|
||||||
lua_pushnil( L );
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
lua_pushboolean( L, state->lights[ lightId ]->enabled );
|
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -140,6 +140,69 @@ static void defineFont() {
|
|||||||
lua_setfield( L, -2, "__gc" );
|
lua_setfield( L, -2, "__gc" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Wave. */
|
||||||
|
static int gcWave( lua_State *L ) {
|
||||||
|
Wave *wave = luaL_checkudata ( L, 1, "Wave" );
|
||||||
|
printf( "gcWave\n" );
|
||||||
|
|
||||||
|
UnloadWave( *wave );
|
||||||
|
}
|
||||||
|
|
||||||
|
static void defineWave() {
|
||||||
|
lua_State *L = state->luaState;
|
||||||
|
|
||||||
|
luaL_newmetatable( L, "Wave" );
|
||||||
|
lua_pushvalue( L, -1 );
|
||||||
|
lua_setfield( L, -2, "__index" );
|
||||||
|
lua_pushcfunction( L, gcWave );
|
||||||
|
lua_setfield( L, -2, "__gc" );
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Sound. */
|
||||||
|
static int gcSound( lua_State *L ) {
|
||||||
|
Sound *sound = luaL_checkudata ( L, 1, "Sound" );
|
||||||
|
printf( "gcSound\n" );
|
||||||
|
|
||||||
|
UnloadSound( *sound );
|
||||||
|
}
|
||||||
|
|
||||||
|
static void defineSound() {
|
||||||
|
lua_State *L = state->luaState;
|
||||||
|
|
||||||
|
luaL_newmetatable( L, "Sound" );
|
||||||
|
lua_pushvalue( L, -1 );
|
||||||
|
lua_setfield( L, -2, "__index" );
|
||||||
|
lua_pushcfunction( L, gcSound );
|
||||||
|
lua_setfield( L, -2, "__gc" );
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Music. */
|
||||||
|
static int gcMusic( lua_State *L ) {
|
||||||
|
Music *music = luaL_checkudata ( L, 1, "Music" );
|
||||||
|
printf( "gcMusic\n" );
|
||||||
|
|
||||||
|
UnloadMusicStream( *music );
|
||||||
|
}
|
||||||
|
|
||||||
|
static void defineMusic() {
|
||||||
|
lua_State *L = state->luaState;
|
||||||
|
|
||||||
|
luaL_newmetatable( L, "Music" );
|
||||||
|
lua_pushvalue( L, -1 );
|
||||||
|
lua_setfield( L, -2, "__index" );
|
||||||
|
lua_pushcfunction( L, gcMusic );
|
||||||
|
lua_setfield( L, -2, "__gc" );
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Music. */
|
||||||
|
static void defineLight() {
|
||||||
|
lua_State *L = state->luaState;
|
||||||
|
|
||||||
|
luaL_newmetatable( L, "Light" );
|
||||||
|
lua_pushvalue( L, -1 );
|
||||||
|
lua_setfield( L, -2, "__index" );
|
||||||
|
}
|
||||||
|
|
||||||
/* Assing globals. */
|
/* Assing globals. */
|
||||||
|
|
||||||
static void assignGlobalInt( int value, const char *name ) {
|
static void assignGlobalInt( int value, const char *name ) {
|
||||||
@@ -1162,6 +1225,10 @@ bool luaInit( int argn, const char **argc ) {
|
|||||||
defineCamera3D();
|
defineCamera3D();
|
||||||
defineShader();
|
defineShader();
|
||||||
defineFont();
|
defineFont();
|
||||||
|
defineWave();
|
||||||
|
defineSound();
|
||||||
|
defineMusic();
|
||||||
|
defineLight();
|
||||||
/* Define globals. */
|
/* Define globals. */
|
||||||
defineGlobals();
|
defineGlobals();
|
||||||
|
|
||||||
@@ -1777,8 +1844,6 @@ void luaRegister() {
|
|||||||
assingGlobalFunction( "LoadSound", laudioLoadSound );
|
assingGlobalFunction( "LoadSound", laudioLoadSound );
|
||||||
assingGlobalFunction( "LoadWave", laudioLoadWave );
|
assingGlobalFunction( "LoadWave", laudioLoadWave );
|
||||||
assingGlobalFunction( "LoadSoundFromWave", laudioLoadSoundFromWave );
|
assingGlobalFunction( "LoadSoundFromWave", laudioLoadSoundFromWave );
|
||||||
assingGlobalFunction( "UnloadSound", laudioUnloadSound );
|
|
||||||
assingGlobalFunction( "UnloadWave", laudioUnloadWave );
|
|
||||||
assingGlobalFunction( "ExportWave", laudioExportWave );
|
assingGlobalFunction( "ExportWave", laudioExportWave );
|
||||||
assingGlobalFunction( "ExportWaveAsCode", laudioExportWaveAsCode );
|
assingGlobalFunction( "ExportWaveAsCode", laudioExportWaveAsCode );
|
||||||
/* Wave/Sound management */
|
/* Wave/Sound management */
|
||||||
@@ -2899,6 +2964,30 @@ void uluaPushFont( lua_State *L, Font font ) {
|
|||||||
luaL_setmetatable( L, "Font" );
|
luaL_setmetatable( L, "Font" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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 ) );
|
||||||
|
*soundP = sound;
|
||||||
|
luaL_setmetatable( L, "Sound" );
|
||||||
|
}
|
||||||
|
|
||||||
|
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 ) );
|
||||||
|
*lightP = light;
|
||||||
|
luaL_setmetatable( L, "Light" );
|
||||||
|
}
|
||||||
|
|
||||||
int uluaGetTableLen( lua_State *L ) {
|
int uluaGetTableLen( lua_State *L ) {
|
||||||
return uluaGetTableLenIndex( L, lua_gettop( L ) );
|
return uluaGetTableLenIndex( L, lua_gettop( L ) );
|
||||||
}
|
}
|
||||||
|
|||||||
48
src/state.c
48
src/state.c
@@ -17,18 +17,6 @@ bool stateInit( int argn, const char **argc, const char *exePath ) {
|
|||||||
state->resolution = (Vector2){ 800, 600 };
|
state->resolution = (Vector2){ 800, 600 };
|
||||||
state->luaState = NULL;
|
state->luaState = NULL;
|
||||||
state->logLevelInvalid = LOG_ERROR;
|
state->logLevelInvalid = LOG_ERROR;
|
||||||
/* Waves. */
|
|
||||||
state->waveAlloc = ALLOC_PAGE_SIZE;
|
|
||||||
state->waveCount = 0;
|
|
||||||
state->waves = malloc( state->waveAlloc * sizeof( Wave* ) );
|
|
||||||
/* Sounds. */
|
|
||||||
state->soundAlloc = ALLOC_PAGE_SIZE;
|
|
||||||
state->soundCount = 0;
|
|
||||||
state->sounds = malloc( state->soundAlloc * sizeof( Sound* ) );
|
|
||||||
/* Musics. */
|
|
||||||
state->musicAlloc = ALLOC_PAGE_SIZE;
|
|
||||||
state->musicCount = 0;
|
|
||||||
state->musics = malloc( state->musicAlloc * sizeof( Music* ) );
|
|
||||||
/* Meshes. */
|
/* Meshes. */
|
||||||
state->meshAlloc = ALLOC_PAGE_SIZE;
|
state->meshAlloc = ALLOC_PAGE_SIZE;
|
||||||
state->meshCount = 0;
|
state->meshCount = 0;
|
||||||
@@ -45,18 +33,11 @@ bool stateInit( int argn, const char **argc, const char *exePath ) {
|
|||||||
state->animationAlloc = ALLOC_PAGE_SIZE;
|
state->animationAlloc = ALLOC_PAGE_SIZE;
|
||||||
state->animationCount = 0;
|
state->animationCount = 0;
|
||||||
state->animations = malloc( state->animationAlloc * sizeof( ModelAnimations* ) );
|
state->animations = malloc( state->animationAlloc * sizeof( ModelAnimations* ) );
|
||||||
/* Lights. */
|
|
||||||
state->lightAlloc = ALLOC_PAGE_SIZE;
|
|
||||||
state->lightCount = 0;
|
|
||||||
state->lights = malloc( state->lightAlloc * sizeof( Light* ) );
|
|
||||||
|
|
||||||
for ( int i = 0; i < ALLOC_PAGE_SIZE; i++ ) {
|
for ( int i = 0; i < ALLOC_PAGE_SIZE; i++ ) {
|
||||||
state->waves[i] = NULL;
|
|
||||||
state->sounds[i] = NULL;
|
|
||||||
state->meshes[i] = NULL;
|
state->meshes[i] = NULL;
|
||||||
state->models[i] = NULL;
|
state->models[i] = NULL;
|
||||||
state->animations[i] = NULL;
|
state->animations[i] = NULL;
|
||||||
state->lights[i] = NULL;
|
|
||||||
|
|
||||||
/* The ones we want to save the first. */
|
/* The ones we want to save the first. */
|
||||||
if ( 0 < i ) {
|
if ( 0 < i ) {
|
||||||
@@ -86,24 +67,6 @@ void stateInitInterpret( int argn, const char **argc ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void stateFree() {
|
void stateFree() {
|
||||||
for ( int i = 0; i < state->waveCount; ++i ) {
|
|
||||||
if ( state->waves[i] != NULL ) {
|
|
||||||
UnloadWave( *state->waves[i] );
|
|
||||||
free( state->waves[i] );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for ( int i = 0; i < state->soundCount; ++i ) {
|
|
||||||
if ( state->sounds[i] != NULL ) {
|
|
||||||
UnloadSound( *state->sounds[i] );
|
|
||||||
free( state->sounds[i] );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for ( int i = 0; i < state->musicCount; ++i ) {
|
|
||||||
if ( state->musics[i] != NULL ) {
|
|
||||||
UnloadMusicStream( *state->musics[i] );
|
|
||||||
free( state->musics[i] );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for ( int i = 0; i < state->modelCount; ++i ) {
|
for ( int i = 0; i < state->modelCount; ++i ) {
|
||||||
if ( state->models[i] != NULL ) {
|
if ( state->models[i] != NULL ) {
|
||||||
//TODO Test if UnloadModel causes segfaults on exit.
|
//TODO Test if UnloadModel causes segfaults on exit.
|
||||||
@@ -134,13 +97,6 @@ void stateFree() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !defined( PLATFORM_RPI ) || !defined( PLATFORM_DRM )
|
|
||||||
for ( int i = 0; i < state->lightCount; ++i ) {
|
|
||||||
if ( state->lights[i] != NULL ) {
|
|
||||||
free( state->lights[i] );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
if ( IsAudioDeviceReady() ) {
|
if ( IsAudioDeviceReady() ) {
|
||||||
CloseAudioDevice();
|
CloseAudioDevice();
|
||||||
}
|
}
|
||||||
@@ -151,14 +107,10 @@ void stateFree() {
|
|||||||
if ( state->hasWindow ) {
|
if ( state->hasWindow ) {
|
||||||
CloseWindow();
|
CloseWindow();
|
||||||
}
|
}
|
||||||
free( state->waves );
|
|
||||||
free( state->sounds );
|
|
||||||
free( state->musics );
|
|
||||||
free( state->meshes );
|
free( state->meshes );
|
||||||
free( state->materials );
|
free( state->materials );
|
||||||
free( state->models );
|
free( state->models );
|
||||||
free( state->animations );
|
free( state->animations );
|
||||||
free( state->lights );
|
|
||||||
free( state->exePath );
|
free( state->exePath );
|
||||||
free( state );
|
free( state );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ int ltextLoadFont( lua_State *L ) {
|
|||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
TraceLog( state->logLevelInvalid, "Invalid file path '%s'", lua_tostring( L, 1 ) );
|
TraceLog( state->logLevelInvalid, "Invalid file '%s'", lua_tostring( L, 1 ) );
|
||||||
lua_pushnil( L );
|
lua_pushnil( L );
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
@@ -73,7 +73,7 @@ int ltextLoadFontEx( lua_State *L ) {
|
|||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
TraceLog( state->logLevelInvalid, "Invalid file path '%s'", lua_tostring( L, 1 ) );
|
TraceLog( state->logLevelInvalid, "Invalid file '%s'", lua_tostring( L, 1 ) );
|
||||||
lua_pushnil( L );
|
lua_pushnil( L );
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
@@ -82,7 +82,7 @@ int ltextLoadFontEx( lua_State *L ) {
|
|||||||
/*
|
/*
|
||||||
> font = RL.LoadFontFromImage( Image image, Color key, int firstChar )
|
> font = RL.LoadFontFromImage( Image image, Color key, int firstChar )
|
||||||
|
|
||||||
Load font from Image ( XNA style )
|
Load font from Image ( XNA style)
|
||||||
|
|
||||||
- Success return Font
|
- Success return Font
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ int ltexturesLoadImage( lua_State *L ) {
|
|||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
TraceLog( state->logLevelInvalid, "Invalid file path '%s'", lua_tostring( L, 1 ) );
|
TraceLog( state->logLevelInvalid, "Invalid file '%s'", lua_tostring( L, 1 ) );
|
||||||
lua_pushnil( L );
|
lua_pushnil( L );
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
@@ -929,7 +929,7 @@ int ltexturesLoadTexture( lua_State *L ) {
|
|||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
TraceLog( state->logLevelInvalid, "Invalid file path '%s'", lua_tostring( L, 1 ) );
|
TraceLog( state->logLevelInvalid, "Invalid file '%s'", lua_tostring( L, 1 ) );
|
||||||
lua_pushnil( L );
|
lua_pushnil( L );
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
|||||||
Reference in New Issue
Block a user