ADDED: IsShaderReady()
, IsImageReady()
, IsFontReady()
, IsWaveReady()
, IsSoundReady()
, IsMusicReady()
(#2892)
These IsReady() functions provide a method in order to verify whether or not the object was loaded successfully. They're useful to make sure the assets are there prior to using them.
This commit is contained in:
parent
81ca2f0bf3
commit
83ff7b2466
5 changed files with 49 additions and 0 deletions
24
src/raudio.c
24
src/raudio.c
|
@ -836,6 +836,12 @@ Wave LoadWaveFromMemory(const char *fileType, const unsigned char *fileData, int
|
|||
return wave;
|
||||
}
|
||||
|
||||
// Checks if wave data is ready
|
||||
bool IsWaveReady(Wave wave)
|
||||
{
|
||||
return wave.data != NULL;
|
||||
}
|
||||
|
||||
// Load sound from file
|
||||
// NOTE: The entire file is loaded to memory to be played (no-streaming)
|
||||
Sound LoadSound(const char *fileName)
|
||||
|
@ -892,6 +898,12 @@ Sound LoadSoundFromWave(Wave wave)
|
|||
return sound;
|
||||
}
|
||||
|
||||
// Checks if a sound is ready
|
||||
bool IsSoundReady(Sound sound)
|
||||
{
|
||||
return sound.stream.buffer != NULL;
|
||||
}
|
||||
|
||||
// Unload wave data
|
||||
void UnloadWave(Wave wave)
|
||||
{
|
||||
|
@ -1614,6 +1626,12 @@ Music LoadMusicStreamFromMemory(const char *fileType, const unsigned char *data,
|
|||
return music;
|
||||
}
|
||||
|
||||
// Checks if a music stream is ready
|
||||
bool IsMusicReady(Music music)
|
||||
{
|
||||
return music.ctxData != NULL;
|
||||
}
|
||||
|
||||
// Unload music stream
|
||||
void UnloadMusicStream(Music music)
|
||||
{
|
||||
|
@ -1967,6 +1985,12 @@ AudioStream LoadAudioStream(unsigned int sampleRate, unsigned int sampleSize, un
|
|||
return stream;
|
||||
}
|
||||
|
||||
// Checks if an audio stream is ready
|
||||
RLAPI bool IsAudioStreamReady(AudioStream stream)
|
||||
{
|
||||
return stream.buffer != NULL;
|
||||
}
|
||||
|
||||
// Unload audio stream and free memory
|
||||
void UnloadAudioStream(AudioStream stream)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue