Merge pull request #258 from JupiterRider/master

Add new functions (4.5.0 Update)
This commit is contained in:
Milan Nikolic 2023-05-09 23:22:00 +02:00 committed by GitHub
commit 3fb1258932
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 66 additions and 1 deletions

View file

@ -157,12 +157,19 @@ func RestoreWindow() {
C.RestoreWindow()
}
// SetWindowIcon - Set icon for window (only PLATFORM_DESKTOP)
// SetWindowIcon - Set icon for window (single image, RGBA 32bit, only PLATFORM_DESKTOP)
func SetWindowIcon(image Image) {
cimage := image.cptr()
C.SetWindowIcon(*cimage)
}
// SetWindowIcons - Set icon for window (multiple images, RGBA 32bit, only PLATFORM_DESKTOP)
func SetWindowIcons(images []Image, count int32) {
cimages := (&images[0]).cptr()
cimagesCount := C.int(count)
C.SetWindowIcons(cimages, cimagesCount)
}
// SetWindowTitle - Set title for window (only PLATFORM_DESKTOP)
func SetWindowTitle(title string) {
ctitle := C.CString(title)

View file

@ -60,6 +60,14 @@ func LoadShaderFromMemory(vsCode string, fsCode string) Shader {
return v
}
// IsShaderReady - Check if a shader is ready
func IsShaderReady(shader Shader) bool {
cshader := shader.cptr()
ret := C.IsShaderReady(*cshader)
v := bool(ret)
return v
}
// UnloadShader - Unload a custom shader from memory
func UnloadShader(shader Shader) {
cshader := shader.cptr()

View file

@ -420,6 +420,18 @@ func CheckCollisionPointTriangle(point, p1, p2, p3 Vector2) bool {
return v
}
// CheckCollisionPointPoly - Check if point is within a polygon described by array of vertices
//
// NOTE: Based on http://jeffreythompson.org/collision-detection/poly-point.php
func CheckCollisionPointPoly(point Vector2, points []Vector2, pointCount int32) bool {
cpoint := point.cptr()
cpoints := (&points[0]).cptr()
cpointCount := C.int(pointCount)
ret := C.CheckCollisionPointPoly(*cpoint, cpoints, cpointCount)
v := bool(ret)
return v
}
// CheckCollisionLines - Check the collision between two lines defined by two points each, returns collision point by reference
func CheckCollisionLines(startPos1, endPos1, startPos2, endPos2 Vector2, point *Vector2) bool {
cstartPos1 := startPos1.cptr()

View file

@ -84,6 +84,21 @@ func LoadImageFromMemory(fileType string, fileData []byte, dataSize int32) *Imag
return v
}
// LoadImageFromScreen - Load image from screen buffer (screenshot)
func LoadImageFromScreen() *Image {
ret := C.LoadImageFromScreen()
v := newImageFromPointer(unsafe.Pointer(&ret))
return v
}
// IsImageReady - Check if an image is ready
func IsImageReady(image *Image) bool {
cimage := image.cptr()
ret := C.IsImageReady(*cimage)
v := bool(ret)
return v
}
// LoadTexture - Load an image as texture into GPU memory
func LoadTexture(fileName string) Texture2D {
cfileName := C.CString(fileName)
@ -116,12 +131,28 @@ func UnloadImage(image *Image) {
C.UnloadImage(*cimage)
}
// IsTextureReady - Check if a texture is ready
func IsTextureReady(texture Texture2D) bool {
ctexture := texture.cptr()
ret := C.IsTextureReady(*ctexture)
v := bool(ret)
return v
}
// UnloadTexture - Unload texture from GPU memory
func UnloadTexture(texture Texture2D) {
ctexture := texture.cptr()
C.UnloadTexture(*ctexture)
}
// IsRenderTextureReady - Check if a render texture is ready
func IsRenderTextureReady(target RenderTexture2D) bool {
ctarget := target.cptr()
ret := C.IsRenderTextureReady(*ctarget)
v := bool(ret)
return v
}
// UnloadRenderTexture - Unload render texture from GPU memory
func UnloadRenderTexture(target RenderTexture2D) {
ctarget := target.cptr()
@ -248,6 +279,13 @@ func ImageAlphaPremultiply(image *Image) {
C.ImageAlphaPremultiply(cimage)
}
// ImageBlurGaussian - Apply box blur
func ImageBlurGaussian(image *Image, blurSize int32) {
cimage := image.cptr()
cblurSize := C.int(blurSize)
C.ImageBlurGaussian(cimage, cblurSize)
}
// ImageResize - Resize an image (bilinear filtering)
func ImageResize(image *Image, newWidth, newHeight int32) {
cimage := image.cptr()