Add more new functions
This commit is contained in:
parent
3fb1258932
commit
bb7c8b3f3b
6 changed files with 118 additions and 0 deletions
|
@ -72,6 +72,14 @@ func LoadWaveFromMemory(fileType string, fileData []byte, dataSize int32) Wave {
|
|||
return v
|
||||
}
|
||||
|
||||
// IsWaveReady - Checks if wave data is ready
|
||||
func IsWaveReady(wave Wave) bool {
|
||||
cwave := wave.cptr()
|
||||
ret := C.IsWaveReady(*cwave)
|
||||
v := bool(ret)
|
||||
return v
|
||||
}
|
||||
|
||||
// LoadSound - Load sound to memory
|
||||
func LoadSound(fileName string) Sound {
|
||||
cfileName := C.CString(fileName)
|
||||
|
@ -89,6 +97,14 @@ func LoadSoundFromWave(wave Wave) Sound {
|
|||
return v
|
||||
}
|
||||
|
||||
// IsSoundReady - Checks if a sound is ready
|
||||
func IsSoundReady(sound Sound) bool {
|
||||
csound := sound.cptr()
|
||||
ret := C.IsSoundReady(*csound)
|
||||
v := bool(ret)
|
||||
return v
|
||||
}
|
||||
|
||||
// UpdateSound - Update sound buffer with new data
|
||||
func UpdateSound(sound Sound, data []byte, samplesCount int32) {
|
||||
csound := sound.cptr()
|
||||
|
@ -234,6 +250,14 @@ func LoadMusicStreamFromMemory(fileType string, fileData []byte, dataSize int32)
|
|||
return v
|
||||
}
|
||||
|
||||
// IsMusicReady - Checks if a music stream is ready
|
||||
func IsMusicReady(music Music) bool {
|
||||
cmusic := *(*C.Music)(unsafe.Pointer(&music))
|
||||
ret := C.IsMusicReady(cmusic)
|
||||
v := bool(ret)
|
||||
return v
|
||||
}
|
||||
|
||||
// UnloadMusicStream - Unload music stream
|
||||
func UnloadMusicStream(music Music) {
|
||||
cmusic := *(*C.Music)(unsafe.Pointer(&music))
|
||||
|
@ -332,6 +356,14 @@ func LoadAudioStream(sampleRate uint32, sampleSize uint32, channels uint32) Audi
|
|||
return v
|
||||
}
|
||||
|
||||
// IsAudioStreamReady - Checks if an audio stream is ready
|
||||
func IsAudioStreamReady(stream AudioStream) bool {
|
||||
cstream := stream.cptr()
|
||||
ret := C.IsAudioStreamReady(*cstream)
|
||||
v := bool(ret)
|
||||
return v
|
||||
}
|
||||
|
||||
// UnloadAudioStream - Unload audio stream and free memory
|
||||
func UnloadAudioStream(stream AudioStream) {
|
||||
cstream := stream.cptr()
|
||||
|
|
|
@ -1235,3 +1235,22 @@ const (
|
|||
MouseCursorResizeAll // The omni-directional resize/move cursor shape
|
||||
MouseCursorNotAllowed // The operation-not-allowed shape
|
||||
)
|
||||
|
||||
// N-patch layout
|
||||
type NPatchLayout int32
|
||||
|
||||
const (
|
||||
NPatchNinePatch NPatchLayout = iota // Npatch layout: 3x3 tiles
|
||||
NPatchThreePatchVertical // Npatch layout: 1x3 tiles
|
||||
NPatchThreePatchHorizontal // Npatch layout: 3x1 tiles
|
||||
)
|
||||
|
||||
// NPatchInfo type, n-patch layout info
|
||||
type NPatchInfo struct {
|
||||
Source Rectangle // Texture source rectangle
|
||||
Left int32 // Left border offset
|
||||
Top int32 // Top border offset
|
||||
Right int32 // Right border offset
|
||||
Bottom int32 // Bottom border offset
|
||||
Layout NPatchLayout // Layout of the n-patch: 3x3, 1x3 or 3x1
|
||||
}
|
||||
|
|
|
@ -560,6 +560,33 @@ func ColorFromHSV(hue, saturation, value float32) color.RGBA {
|
|||
return v
|
||||
}
|
||||
|
||||
// ColorTint - Get color multiplied with another color
|
||||
func ColorTint(col color.RGBA, tint color.RGBA) color.RGBA {
|
||||
ccolor := colorCptr(col)
|
||||
ctint := colorCptr(tint)
|
||||
ret := C.ColorTint(*ccolor, *ctint)
|
||||
v := newColorFromPointer(unsafe.Pointer(&ret))
|
||||
return v
|
||||
}
|
||||
|
||||
// ColorBrightness - Get color with brightness correction, brightness factor goes from -1.0f to 1.0f
|
||||
func ColorBrightness(col color.RGBA, factor float32) color.RGBA {
|
||||
ccolor := colorCptr(col)
|
||||
cfactor := C.float(factor)
|
||||
ret := C.ColorBrightness(*ccolor, cfactor)
|
||||
v := newColorFromPointer(unsafe.Pointer(&ret))
|
||||
return v
|
||||
}
|
||||
|
||||
// ColorContrast - Get color with contrast correction, contrast values between -1.0f and 1.0f
|
||||
func ColorContrast(col color.RGBA, contrast float32) color.RGBA {
|
||||
ccolor := colorCptr(col)
|
||||
ccontrast := C.float(contrast)
|
||||
ret := C.ColorContrast(*ccolor, ccontrast)
|
||||
v := newColorFromPointer(unsafe.Pointer(&ret))
|
||||
return v
|
||||
}
|
||||
|
||||
// ColorAlpha - Returns color with alpha applied, alpha goes from 0.0f to 1.0f
|
||||
func ColorAlpha(col color.RGBA, alpha float32) color.RGBA {
|
||||
return Fade(col, alpha)
|
||||
|
|
|
@ -230,6 +230,14 @@ func LoadModelFromMesh(data Mesh) Model {
|
|||
return v
|
||||
}
|
||||
|
||||
// IsModelReady - Check if a model is ready
|
||||
func IsModelReady(model Model) bool {
|
||||
cmodel := model.cptr()
|
||||
ret := C.IsModelReady(*cmodel)
|
||||
v := bool(ret)
|
||||
return v
|
||||
}
|
||||
|
||||
// UnloadModel - Unload model from memory (RAM and/or VRAM)
|
||||
func UnloadModel(model Model) {
|
||||
cmodel := model.cptr()
|
||||
|
@ -396,6 +404,14 @@ func LoadMaterialDefault() Material {
|
|||
return v
|
||||
}
|
||||
|
||||
// IsMaterialReady - Check if a material is ready
|
||||
func IsMaterialReady(material Material) bool {
|
||||
cmaterial := material.cptr()
|
||||
ret := C.IsMaterialReady(*cmaterial)
|
||||
v := bool(ret)
|
||||
return v
|
||||
}
|
||||
|
||||
// UnloadMaterial - Unload material textures from VRAM
|
||||
func UnloadMaterial(material Material) {
|
||||
cmaterial := material.cptr()
|
||||
|
|
|
@ -77,6 +77,14 @@ func LoadFontFromMemory(fileType string, fileData []byte, dataSize int32, fontSi
|
|||
return v
|
||||
}
|
||||
|
||||
// IsFontReady - Check if a font is ready
|
||||
func IsFontReady(font Font) bool {
|
||||
cfont := font.cptr()
|
||||
ret := C.IsFontReady(*cfont)
|
||||
v := bool(ret)
|
||||
return v
|
||||
}
|
||||
|
||||
// LoadFontData - Load font data for further use
|
||||
func LoadFontData(fileData []byte, dataSize int32, fontSize int32, fontChars *int32, charsCount, typ int32) *GlyphInfo {
|
||||
cfileData := (*C.uchar)(unsafe.Pointer(&fileData[0]))
|
||||
|
|
|
@ -734,3 +734,19 @@ func DrawTexturePro(texture Texture2D, sourceRec, destRec Rectangle, origin Vect
|
|||
ctint := colorCptr(tint)
|
||||
C.DrawTexturePro(*ctexture, *csourceRec, *cdestRec, *corigin, crotation, *ctint)
|
||||
}
|
||||
|
||||
// cptr returns C pointer
|
||||
func (n *NPatchInfo) cptr() *C.NPatchInfo {
|
||||
return (*C.NPatchInfo)(unsafe.Pointer(n))
|
||||
}
|
||||
|
||||
// DrawTextureNPatch - Draws a texture (or part of it) that stretches or shrinks nicely using n-patch info
|
||||
func DrawTextureNPatch(texture Texture2D, nPatchInfo NPatchInfo, dest Rectangle, origin Vector2, rotation float32, tint color.RGBA) {
|
||||
ctexture := texture.cptr()
|
||||
cnPatchInfo := nPatchInfo.cptr()
|
||||
cdest := dest.cptr()
|
||||
corigin := origin.cptr()
|
||||
crotation := (C.float)(rotation)
|
||||
ctint := colorCptr(tint)
|
||||
C.DrawTextureNPatch(*ctexture, *cnPatchInfo, *cdest, *corigin, crotation, *ctint)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue