Adding gif and sprite animation examples.

-Added new UpdateTextureUnsafe method to support it.
This commit is contained in:
Palessan 2024-06-28 12:50:30 +03:00
parent a997a44fb9
commit f529bc2897
6 changed files with 215 additions and 2 deletions

View file

@ -1090,8 +1090,8 @@ const (
// Image type, bpp always RGBA (32bit)
// NOTE: Data stored in CPU memory (RAM)
type Image struct {
// Image raw data
data unsafe.Pointer
// Image raw Data
Data unsafe.Pointer
// Image base width
Width int32
// Image base height

View file

@ -246,6 +246,14 @@ func UpdateTexture(texture Texture2D, pixels []color.RGBA) {
C.UpdateTexture(*ctexture, cpixels)
}
// UpdateTexture - Update GPU texture with new data
// NOTE: pixels data must match texture.format
func UpdateTextureUnsafe(texture Texture2D, pixels unsafe.Pointer) {
ctexture := texture.cptr()
cpixels := pixels
C.UpdateTexture(*ctexture, cpixels)
}
// UpdateTextureRec - Update GPU texture rectangle with new data
func UpdateTextureRec(texture Texture2D, rec Rectangle, pixels []color.RGBA) {
ctexture := texture.cptr()