Add new core and audio functions

This commit is contained in:
Milan Nikolic 2023-11-07 13:56:05 +01:00
parent 1ffd9fb3ca
commit c0b171213e
No known key found for this signature in database
GPG key ID: 9229D0EAA3AA4E75
3 changed files with 31 additions and 1 deletions

View file

@ -1,3 +1,3 @@
module github.com/gen2brain/raylib-go/raylib
go 1.19
go 1.21

View file

@ -52,6 +52,13 @@ func SetMasterVolume(volume float32) {
C.SetMasterVolume(cvolume)
}
// GetMasterVolume - Set master volume (listener)
func GetMasterVolume() float32 {
ret := C.GetMasterVolume()
v := float32(ret)
return v
}
// LoadWave - Load wave data from file into RAM
func LoadWave(fileName string) Wave {
cfileName := C.CString(fileName)
@ -97,6 +104,14 @@ func LoadSoundFromWave(wave Wave) Sound {
return v
}
// LoadSoundAlias - Create a new sound that shares the same sample data as the source sound, does not own the sound data
func LoadSoundAlias(source Sound) Sound {
csound := source.cptr()
ret := C.LoadSoundAlias(*csound)
v := newSoundFromPointer(unsafe.Pointer(&ret))
return v
}
// IsSoundReady - Checks if a sound is ready
func IsSoundReady(sound Sound) bool {
csound := sound.cptr()

View file

@ -197,6 +197,13 @@ func SetWindowMinSize(w, h int) {
C.SetWindowMinSize(cw, ch)
}
// SetWindowMaxSize - Set window maximum dimensions (for FLAG_WINDOW_RESIZABLE)
func SetWindowMaxSize(w, h int) {
cw := (C.int)(w)
ch := (C.int)(h)
C.SetWindowMaxSize(cw, ch)
}
// SetWindowSize - Set window dimensions
func SetWindowSize(w, h int) {
cw := (C.int)(w)
@ -691,6 +698,14 @@ func IsKeyPressed(key int32) bool {
return v
}
// IsKeyPressedRepeat - Detect if a key has been pressed again (Only PLATFORM_DESKTOP)
func IsKeyPressedRepeat(key int32) bool {
ckey := (C.int)(key)
ret := C.IsKeyPressedRepeat(ckey)
v := bool(ret)
return v
}
// IsKeyDown - Detect if a key is being pressed
func IsKeyDown(key int32) bool {
ckey := (C.int)(key)