Skip to content

Commit cab7881

Browse files
committed
Fix purego
1 parent d28dffb commit cab7881

File tree

1 file changed

+10
-20
lines changed

1 file changed

+10
-20
lines changed

raylib/raylib_purego.go

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
package rl
55

6-
import "C"
76
import (
87
"fmt"
98
"image"
@@ -346,8 +345,8 @@ var isTextureValid func(texture uintptr) bool
346345
var unloadTexture func(texture uintptr)
347346
var isRenderTextureValid func(target uintptr) bool
348347
var unloadRenderTexture func(target uintptr)
349-
var updateTexture func(texture uintptr, pixels *color.RGBA)
350-
var updateTextureRec func(texture uintptr, rec uintptr, pixels *color.RGBA)
348+
var updateTexture func(texture uintptr, pixels uintptr)
349+
var updateTextureRec func(texture uintptr, rec uintptr, pixels uintptr)
351350
var genTextureMipmaps func(texture *Texture2D)
352351
var setTextureFilter func(texture uintptr, filter int32)
353352
var setTextureWrap func(texture uintptr, wrap int32)
@@ -519,7 +518,7 @@ var getMusicTimePlayed func(music uintptr) float32
519518
var loadAudioStream func(audioStream uintptr, sampleRate uint32, sampleSize uint32, channels uint32)
520519
var isAudioStreamValid func(stream uintptr) bool
521520
var unloadAudioStream func(stream uintptr)
522-
var updateAudioStream func(stream uintptr, data []float32, frameCount int32)
521+
var updateAudioStream func(stream uintptr, data uintptr, frameCount int32)
523522
var isAudioStreamProcessed func(stream uintptr) bool
524523
var playAudioStream func(stream uintptr)
525524
var pauseAudioStream func(stream uintptr)
@@ -2861,11 +2860,11 @@ func UpdateTexture(texture Texture2D, pixels any) {
28612860
case []byte:
28622861
cpixels = unsafe.Pointer(&p[0])
28632862
}
2864-
updateTexture(uintptr(unsafe.Pointer(&texture)), cpixels)
2863+
updateTexture(uintptr(unsafe.Pointer(&texture)), uintptr(cpixels))
28652864
}
28662865

28672866
// UpdateTextureRec - Update GPU texture rectangle with new data
2868-
func UpdateTextureRec(texture Texture2D, rec Rectangle, pixels []color.RGBA) {
2867+
func UpdateTextureRec(texture Texture2D, rec Rectangle, pixels any) {
28692868
var cpixels unsafe.Pointer
28702869
switch p := pixels.(type) {
28712870
case []color.RGBA:
@@ -2875,7 +2874,7 @@ func UpdateTextureRec(texture Texture2D, rec Rectangle, pixels []color.RGBA) {
28752874
case []byte:
28762875
cpixels = unsafe.Pointer(&p[0])
28772876
}
2878-
updateTextureRec(uintptr(unsafe.Pointer(&texture)), uintptr(unsafe.Pointer(&rec)), cpixels)
2877+
updateTextureRec(uintptr(unsafe.Pointer(&texture)), uintptr(unsafe.Pointer(&rec)), uintptr(cpixels))
28792878
}
28802879

28812880
// GenTextureMipmaps - Generate GPU mipmaps for a texture
@@ -3851,16 +3850,16 @@ func UnloadAudioStream(stream AudioStream) {
38513850
// UpdateAudioStream - Update audio stream buffers with data ([]float32 or []int16)
38523851
func UpdateAudioStream(stream AudioStream, data any) {
38533852
var cdata unsafe.Pointer
3854-
var csamplesCount C.int
3853+
var csamplesCount int32
38553854
switch d := data.(type) {
38563855
case []float32:
38573856
cdata = unsafe.Pointer(&d[0])
3858-
csamplesCount = (C.int)(len(d))
3857+
csamplesCount = int32(len(d))
38593858
case []int16:
38603859
cdata = unsafe.Pointer(&d[0])
3861-
csamplesCount = (C.int)(len(d))
3860+
csamplesCount = int32(len(d))
38623861
}
3863-
updateAudioStream(uintptr(unsafe.Pointer(&stream)), cdata, csamplesCount)
3862+
updateAudioStream(uintptr(unsafe.Pointer(&stream)), uintptr(cdata), csamplesCount)
38643863
}
38653864

38663865
// IsAudioStreamProcessed - Check if any audio stream buffers requires refill
@@ -3993,15 +3992,6 @@ func (i *Image) ToImage() image.Image {
39933992
return img
39943993
}
39953994

3996-
// OpenAsset - Open asset
3997-
func OpenAsset(name string) (Asset, error) {
3998-
f, err := os.Open(name)
3999-
if err != nil {
4000-
return nil, err
4001-
}
4002-
return f, nil
4003-
}
4004-
40053995
// HomeDir - Returns user home directory
40063996
// NOTE: On Android this returns internal data path and must be called after InitWindow
40073997
func HomeDir() string {

0 commit comments

Comments
 (0)