From ff18bb497b4db35c71cf4e5746179065e5c53908 Mon Sep 17 00:00:00 2001 From: JupiterRider <60042618+JupiterRider@users.noreply.github.com> Date: Sat, 23 Nov 2024 20:56:02 +0100 Subject: [PATCH] GetShapesTexture() and GetShapesTextureRectangle() added --- raylib/raylib_purego.go | 18 ++++++++++++++++++ raylib/rshapes.go | 14 ++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/raylib/raylib_purego.go b/raylib/raylib_purego.go index 498d4b1..854bf9f 100644 --- a/raylib/raylib_purego.go +++ b/raylib/raylib_purego.go @@ -190,6 +190,8 @@ var getGestureDragAngle func() float32 var getGesturePinchVector func() uintptr var getGesturePinchAngle func() float32 var setShapesTexture func(texture uintptr, source uintptr) +var getShapesTexture func(texture uintptr) +var getShapesTextureRectangle func(rec uintptr) var drawPixel func(posX int32, posY int32, col uintptr) var drawPixelV func(position uintptr, col uintptr) var drawLine func(startPosX int32, startPosY int32, endPosX int32, endPosY int32, col uintptr) @@ -691,6 +693,8 @@ func init() { purego.RegisterLibFunc(&getGesturePinchVector, raylibDll, "GetGesturePinchVector") purego.RegisterLibFunc(&getGesturePinchAngle, raylibDll, "GetGesturePinchAngle") purego.RegisterLibFunc(&setShapesTexture, raylibDll, "SetShapesTexture") + purego.RegisterLibFunc(&getShapesTexture, raylibDll, "GetShapesTexture") + purego.RegisterLibFunc(&getShapesTextureRectangle, raylibDll, "GetShapesTextureRectangle") purego.RegisterLibFunc(&drawPixel, raylibDll, "DrawPixel") purego.RegisterLibFunc(&drawPixelV, raylibDll, "DrawPixelV") purego.RegisterLibFunc(&drawLine, raylibDll, "DrawLine") @@ -1975,6 +1979,20 @@ func SetShapesTexture(texture Texture2D, source Rectangle) { setShapesTexture(uintptr(unsafe.Pointer(&texture)), uintptr(unsafe.Pointer(&source))) } +// GetShapesTexture - Get texture that is used for shapes drawing +func GetShapesTexture() Texture2D { + var texture Texture2D + getShapesTexture(uintptr(unsafe.Pointer(&texture))) + return texture +} + +// GetShapesTextureRectangle - Get texture source rectangle that is used for shapes drawing +func GetShapesTextureRectangle() Rectangle { + var rec Rectangle + getShapesTextureRectangle(uintptr(unsafe.Pointer(&rec))) + return rec +} + // DrawPixel - Draw a pixel func DrawPixel(posX int32, posY int32, col color.RGBA) { drawPixel(posX, posY, *(*uintptr)(unsafe.Pointer(&col))) diff --git a/raylib/rshapes.go b/raylib/rshapes.go index 587b3a0..66a5558 100644 --- a/raylib/rshapes.go +++ b/raylib/rshapes.go @@ -17,6 +17,20 @@ func SetShapesTexture(texture Texture2D, source Rectangle) { C.SetShapesTexture(*ctexture, *csource) } +// GetShapesTexture - Get texture that is used for shapes drawing +func GetShapesTexture() Texture2D { + ret := C.GetShapesTexture() + v := newTexture2DFromPointer(unsafe.Pointer(&ret)) + return v +} + +// GetShapesTextureRectangle - Get texture source rectangle that is used for shapes drawing +func GetShapesTextureRectangle() Rectangle { + ret := C.GetShapesTextureRectangle() + v := newRectangleFromPointer(unsafe.Pointer(&ret)) + return v +} + // DrawPixel - Draw a pixel func DrawPixel(posX, posY int32, col color.RGBA) { cposX := (C.int)(posX)