Update Go sources

This commit is contained in:
Milan Nikolic 2022-08-27 16:09:36 +02:00
parent b126ec93ee
commit 70200c3151
No known key found for this signature in database
GPG key ID: 9229D0EAA3AA4E75
10 changed files with 39 additions and 120 deletions

View file

@ -83,13 +83,13 @@ func IsFileDropped() bool {
return false
}
// GetDroppedFiles - Retrieve dropped files into window
func GetDroppedFiles(count *int32) (files []string) {
// LoadDroppedFiles - Load dropped filepaths
func LoadDroppedFiles() (files []string) {
return
}
// ClearDroppedFiles - Clear dropped files paths buffer
func ClearDroppedFiles() {
// UnloadDroppedFiles - Unload dropped filepaths
func UnloadDroppedFiles() {
return
}

View file

@ -71,13 +71,13 @@ func IsFileDropped() bool {
return v
}
// GetDroppedFiles - Retrieve dropped files into window
func GetDroppedFiles(count *int32) []string {
ccount := (*C.int)(unsafe.Pointer(count))
ret := C.GetDroppedFiles(ccount)
// LoadDroppedFiles - Load dropped filepaths
func LoadDroppedFiles() []string {
ret := C.LoadDroppedFiles()
defer C.UnloadDroppedFiles(ret)
tmpslice := (*[1 << 24]*C.char)(unsafe.Pointer(ret))[:*count:*count]
gostrings := make([]string, *count)
tmpslice := (*[1 << 24]*C.char)(unsafe.Pointer(ret.paths))[:ret.count:ret.count]
gostrings := make([]string, ret.count)
for i, s := range tmpslice {
gostrings[i] = C.GoString(s)
}
@ -85,9 +85,9 @@ func GetDroppedFiles(count *int32) []string {
return gostrings
}
// ClearDroppedFiles - Clear dropped files paths buffer
func ClearDroppedFiles() {
C.ClearDroppedFiles()
// UnloadDroppedFiles - Unload dropped filepaths
func UnloadDroppedFiles() {
return
}
// OpenAsset - Open asset

View file

@ -69,13 +69,13 @@ func IsFileDropped() bool {
return false
}
// GetDroppedFiles - Retrieve dropped files into window
func GetDroppedFiles(count *int32) (files []string) {
// LoadDroppedFiles - Load dropped filepaths
func LoadDroppedFiles() (files []string) {
return
}
// ClearDroppedFiles - Clear dropped files paths buffer
func ClearDroppedFiles() {
// UnloadDroppedFiles - Unload dropped filepaths
func UnloadDroppedFiles() {
return
}

View file

@ -69,13 +69,13 @@ func IsFileDropped() bool {
return false
}
// GetDroppedFiles - Retrieve dropped files into window
func GetDroppedFiles(count *int32) (files []string) {
// LoadDroppedFiles - Load dropped filepaths
func LoadDroppedFiles() (files []string) {
return
}
// ClearDroppedFiles - Clear dropped files paths buffer
func ClearDroppedFiles() {
// UnloadDroppedFiles - Unload dropped filepaths
func UnloadDroppedFiles() {
return
}

View file

@ -213,8 +213,8 @@ func LoadWaveSamples(wave Wave) []float32 {
ret := C.LoadWaveSamples(*cwave)
sliceHeader := (*reflect.SliceHeader)((unsafe.Pointer(&data)))
sliceHeader.Cap = int(wave.SampleCount)
sliceHeader.Len = int(wave.SampleCount)
sliceHeader.Cap = int(wave.FrameCount)
sliceHeader.Len = int(wave.FrameCount)
sliceHeader.Data = uintptr(unsafe.Pointer(ret))
return data

View file

@ -30,8 +30,6 @@ Example:
rl.CloseWindow()
}
*/
package rl
@ -56,7 +54,7 @@ func init() {
// Wave type, defines audio wave data
type Wave struct {
// Number of samples
SampleCount uint32
FrameCount uint32
// Frequency (samples per second)
SampleRate uint32
// Bit depth (bits per sample): 8, 16, 32 (24 not supported)
@ -80,9 +78,9 @@ func newWaveFromPointer(ptr unsafe.Pointer) Wave {
// Sound source type
type Sound struct {
Stream AudioStream
SampleCount uint32
_ [4]byte
Stream AudioStream
FrameCount uint32
_ [4]byte
}
// newSoundFromPointer - Returns new Sound from pointer
@ -93,11 +91,11 @@ func newSoundFromPointer(ptr unsafe.Pointer) Sound {
// Music type (file streaming from memory)
// NOTE: Anything longer than ~10 seconds should be streamed
type Music struct {
Stream AudioStream
SampleCount uint32
Looping bool
CtxType int32
CtxData unsafe.Pointer
Stream AudioStream
FrameCount uint32
Looping bool
CtxType int32
CtxData unsafe.Pointer
}
// newMusicFromPointer - Returns new Music from pointer
@ -110,6 +108,8 @@ func newMusicFromPointer(ptr unsafe.Pointer) Music {
type AudioStream struct {
// Buffer
Buffer *C.rAudioBuffer
// Processor
Processor *C.rAudioProcessor
// Frequency (samples per second)
SampleRate uint32
// Bit depth (bits per sample): 8, 16, 32 (24 not supported)

View file

@ -595,21 +595,6 @@ func TakeScreenshot(name string) {
C.TakeScreenshot(cname)
}
// SaveStorageValue - Storage save integer value (to defined position)
func SaveStorageValue(position, value int32) {
cposition := (C.uint)(position)
cvalue := (C.int)(value)
C.SaveStorageValue(cposition, cvalue)
}
// LoadStorageValue - Storage load integer value (from defined position)
func LoadStorageValue(position int32) int32 {
cposition := (C.uint)(position)
ret := C.LoadStorageValue(cposition)
v := (int32)(ret)
return v
}
// IsKeyPressed - Detect if a key has been pressed once
func IsKeyPressed(key int32) bool {
ckey := (C.int)(key)

View file

@ -558,15 +558,6 @@ func GetRayCollisionBox(ray Ray, box BoundingBox) RayCollision {
return v
}
// GetRayCollisionModel - Get collision info between ray and model
func GetRayCollisionModel(ray Ray, model Model) RayCollision {
cray := ray.cptr()
cmodel := model.cptr()
ret := C.GetRayCollisionModel(*cray, *cmodel)
v := newRayCollisionFromPointer(unsafe.Pointer(&ret))
return v
}
// GetRayCollisionMesh - Get collision info between ray and mesh
func GetRayCollisionMesh(ray Ray, mesh Mesh, transform Matrix) RayCollision {
cray := ray.cptr()