Add FromMemory functions
This commit is contained in:
parent
ad07f2586d
commit
3908769a21
3 changed files with 48 additions and 1 deletions
|
@ -58,6 +58,17 @@ func LoadWave(fileName string) Wave {
|
||||||
return v
|
return v
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// LoadWaveFromMemory - Load wave from memory buffer, fileType refers to extension: i.e. ".wav"
|
||||||
|
func LoadWaveFromMemory(fileType string, fileData []byte, dataSize int32) Wave {
|
||||||
|
cfileType := C.CString(fileType)
|
||||||
|
defer C.free(unsafe.Pointer(cfileType))
|
||||||
|
cfileData := (*C.uchar)(unsafe.Pointer(&fileData[0]))
|
||||||
|
cdataSize := (C.int)(dataSize)
|
||||||
|
ret := C.LoadWaveFromMemory(cfileType, cfileData, cdataSize)
|
||||||
|
v := newWaveFromPointer(unsafe.Pointer(&ret))
|
||||||
|
return v
|
||||||
|
}
|
||||||
|
|
||||||
// LoadSound - Load sound to memory
|
// LoadSound - Load sound to memory
|
||||||
func LoadSound(fileName string) Sound {
|
func LoadSound(fileName string) Sound {
|
||||||
cfileName := C.CString(fileName)
|
cfileName := C.CString(fileName)
|
||||||
|
@ -193,7 +204,18 @@ func LoadMusicStream(fileName string) Music {
|
||||||
cfileName := C.CString(fileName)
|
cfileName := C.CString(fileName)
|
||||||
defer C.free(unsafe.Pointer(cfileName))
|
defer C.free(unsafe.Pointer(cfileName))
|
||||||
ret := C.LoadMusicStream(cfileName)
|
ret := C.LoadMusicStream(cfileName)
|
||||||
v := *(*Music)(unsafe.Pointer(&ret))
|
v := newMusicFromPointer(unsafe.Pointer(&ret))
|
||||||
|
return v
|
||||||
|
}
|
||||||
|
|
||||||
|
// LoadMusicStreamFromMemory - Load music stream from data
|
||||||
|
func LoadMusicStreamFromMemory(fileType string, fileData []byte, dataSize int32) Music {
|
||||||
|
cfileType := C.CString(fileType)
|
||||||
|
defer C.free(unsafe.Pointer(cfileType))
|
||||||
|
cfileData := (*C.uchar)(unsafe.Pointer(&fileData[0]))
|
||||||
|
cdataSize := (C.int)(dataSize)
|
||||||
|
ret := C.LoadMusicStreamFromMemory(cfileType, cfileData, cdataSize)
|
||||||
|
v := newMusicFromPointer(unsafe.Pointer(&ret))
|
||||||
return v
|
return v
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -55,6 +55,20 @@ func LoadFontFromImage(image Image, key Color, firstChar int32) Font {
|
||||||
return v
|
return v
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// LoadFontFromMemory - Load font from memory buffer, fileType refers to extension: i.e. ".ttf"
|
||||||
|
func LoadFontFromMemory(fileType string, fileData []byte, dataSize int32, fontSize int32, fontChars *int32, charsCount int32) Font {
|
||||||
|
cfileType := C.CString(fileType)
|
||||||
|
defer C.free(unsafe.Pointer(cfileType))
|
||||||
|
cfileData := (*C.uchar)(unsafe.Pointer(&fileData[0]))
|
||||||
|
cdataSize := (C.int)(dataSize)
|
||||||
|
cfontSize := (C.int)(fontSize)
|
||||||
|
cfontChars := (*C.int)(unsafe.Pointer(fontChars))
|
||||||
|
ccharsCount := (C.int)(charsCount)
|
||||||
|
ret := C.LoadFontFromMemory(cfileType, cfileData, cdataSize, cfontSize, cfontChars, ccharsCount)
|
||||||
|
v := newFontFromPointer(unsafe.Pointer(&ret))
|
||||||
|
return v
|
||||||
|
}
|
||||||
|
|
||||||
// LoadFontData - Load font data for further use
|
// LoadFontData - Load font data for further use
|
||||||
func LoadFontData(fileData []byte, dataSize int32, fontSize int32, fontChars *int32, charsCount, typ int32) *CharInfo {
|
func LoadFontData(fileData []byte, dataSize int32, fontSize int32, fontChars *int32, charsCount, typ int32) *CharInfo {
|
||||||
cfileData := (*C.uchar)(unsafe.Pointer(&fileData[0]))
|
cfileData := (*C.uchar)(unsafe.Pointer(&fileData[0]))
|
||||||
|
|
|
@ -72,6 +72,17 @@ func LoadImageAnim(fileName string, frames *int32) *Image {
|
||||||
return v
|
return v
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// LoadImageFromMemory - Load image from memory buffer, fileType refers to extension: i.e. ".png"
|
||||||
|
func LoadImageFromMemory(fileType string, fileData []byte, dataSize int32) *Image {
|
||||||
|
cfileType := C.CString(fileType)
|
||||||
|
defer C.free(unsafe.Pointer(cfileType))
|
||||||
|
cfileData := (*C.uchar)(unsafe.Pointer(&fileData[0]))
|
||||||
|
cdataSize := (C.int)(dataSize)
|
||||||
|
ret := C.LoadImageFromMemory(cfileType, cfileData, cdataSize)
|
||||||
|
v := newImageFromPointer(unsafe.Pointer(&ret))
|
||||||
|
return v
|
||||||
|
}
|
||||||
|
|
||||||
// LoadTexture - Load an image as texture into GPU memory
|
// LoadTexture - Load an image as texture into GPU memory
|
||||||
func LoadTexture(fileName string) Texture2D {
|
func LoadTexture(fileName string) Texture2D {
|
||||||
cfileName := C.CString(fileName)
|
cfileName := C.CString(fileName)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue