mirror of
https://github.com/raysan5/raylib.git
synced 2025-09-05 19:08:13 +00:00
Add safety notes to 'Update_' functions
This commit is contained in:
@@ -1033,6 +1033,8 @@ void UnloadSoundAlias(Sound alias)
|
||||
}
|
||||
|
||||
// Update sound buffer with new data
|
||||
// NOTE 1: data format must match sound.stream.sampleSize
|
||||
// NOTE 2: frameCount must not exceed sound.frameCount
|
||||
void UpdateSound(Sound sound, const void *data, int frameCount)
|
||||
{
|
||||
if (sound.stream.buffer != NULL)
|
||||
|
@@ -1422,8 +1422,8 @@ RLAPI bool IsTextureValid(Texture2D texture);
|
||||
RLAPI void UnloadTexture(Texture2D texture); // Unload texture from GPU memory (VRAM)
|
||||
RLAPI bool IsRenderTextureValid(RenderTexture2D target); // Check if a render texture is valid (loaded in GPU)
|
||||
RLAPI void UnloadRenderTexture(RenderTexture2D target); // Unload render texture from GPU memory (VRAM)
|
||||
RLAPI void UpdateTexture(Texture2D texture, const void *pixels); // Update GPU texture with new data
|
||||
RLAPI void UpdateTextureRec(Texture2D texture, Rectangle rec, const void *pixels); // Update GPU texture rectangle with new data
|
||||
RLAPI void UpdateTexture(Texture2D texture, const void *pixels); // Update GPU texture with new data (pixels should be able to fill texture)
|
||||
RLAPI void UpdateTextureRec(Texture2D texture, Rectangle rec, const void *pixels); // Update GPU texture rectangle with new data (pixels and rec should fit in texture)
|
||||
|
||||
// Texture configuration functions
|
||||
RLAPI void GenTextureMipmaps(Texture2D *texture); // Generate GPU mipmaps for a texture
|
||||
@@ -1644,7 +1644,7 @@ RLAPI Sound LoadSound(const char *fileName); // Load so
|
||||
RLAPI Sound LoadSoundFromWave(Wave wave); // Load sound from wave data
|
||||
RLAPI Sound LoadSoundAlias(Sound source); // Create a new sound that shares the same sample data as the source sound, does not own the sound data
|
||||
RLAPI bool IsSoundValid(Sound sound); // Checks if a sound is valid (data loaded and buffers initialized)
|
||||
RLAPI void UpdateSound(Sound sound, const void *data, int sampleCount); // Update sound buffer with new data
|
||||
RLAPI void UpdateSound(Sound sound, const void *data, int sampleCount); // Update sound buffer with new data (data and frame count should fit in sound)
|
||||
RLAPI void UnloadWave(Wave wave); // Unload wave data
|
||||
RLAPI void UnloadSound(Sound sound); // Unload sound
|
||||
RLAPI void UnloadSoundAlias(Sound alias); // Unload a sound alias (does not deallocate sample data)
|
||||
|
@@ -4337,14 +4337,17 @@ void UnloadRenderTexture(RenderTexture2D target)
|
||||
}
|
||||
|
||||
// Update GPU texture with new data
|
||||
// NOTE: pixels data must match texture.format
|
||||
// NOTE 1: pixels data must match texture.format
|
||||
// NOTE 2: pixels data must contain at least as many pixels as texture
|
||||
void UpdateTexture(Texture2D texture, const void *pixels)
|
||||
{
|
||||
rlUpdateTexture(texture.id, 0, 0, texture.width, texture.height, texture.format, pixels);
|
||||
}
|
||||
|
||||
// Update GPU texture rectangle with new data
|
||||
// NOTE: pixels data must match texture.format
|
||||
// NOTE 1: pixels data must match texture.format
|
||||
// NOTE 2: pixels data must contain as many pixels as rec contains
|
||||
// NOTE 3: rec must fit completely within texture's width and height
|
||||
void UpdateTextureRec(Texture2D texture, Rectangle rec, const void *pixels)
|
||||
{
|
||||
rlUpdateTexture(texture.id, (int)rec.x, (int)rec.y, (int)rec.width, (int)rec.height, texture.format, pixels);
|
||||
|
Reference in New Issue
Block a user