From 07d2a6efde4cf6f688a3590ba5cc2969279be3f7 Mon Sep 17 00:00:00 2001 From: JupiterRider <60042618+JupiterRider@users.noreply.github.com> Date: Sun, 24 Nov 2024 12:45:32 +0100 Subject: [PATCH] ImageDrawLineEx function added --- raylib/raylib_purego.go | 9 ++++++++- raylib/rtextures.go | 10 ++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/raylib/raylib_purego.go b/raylib/raylib_purego.go index 648a7a9..bd7f66b 100644 --- a/raylib/raylib_purego.go +++ b/raylib/raylib_purego.go @@ -315,6 +315,7 @@ var imageDrawPixel func(dst *Image, posX int32, posY int32, col uintptr) var imageDrawPixelV func(dst *Image, position uintptr, col uintptr) var imageDrawLine func(dst *Image, startPosX int32, startPosY int32, endPosX int32, endPosY int32, col uintptr) var imageDrawLineV func(dst *Image, start uintptr, end uintptr, col uintptr) +var imageDrawLineEx func(dst *Image, start uintptr, end uintptr, thick int32, col uintptr) var imageDrawCircle func(dst *Image, centerX int32, centerY int32, radius int32, col uintptr) var imageDrawCircleV func(dst *Image, center uintptr, radius int32, col uintptr) var imageDrawCircleLines func(dst *Image, centerX int32, centerY int32, radius int32, col uintptr) @@ -821,6 +822,7 @@ func init() { purego.RegisterLibFunc(&imageDrawPixelV, raylibDll, "ImageDrawPixelV") purego.RegisterLibFunc(&imageDrawLine, raylibDll, "ImageDrawLine") purego.RegisterLibFunc(&imageDrawLineV, raylibDll, "ImageDrawLineV") + purego.RegisterLibFunc(&imageDrawLineEx, raylibDll, "ImageDrawLineEx") purego.RegisterLibFunc(&imageDrawCircle, raylibDll, "ImageDrawCircle") purego.RegisterLibFunc(&imageDrawCircleV, raylibDll, "ImageDrawCircleV") purego.RegisterLibFunc(&imageDrawCircleLines, raylibDll, "ImageDrawCircleLines") @@ -2683,10 +2685,15 @@ func ImageDrawLine(dst *Image, startPosX int32, startPosY int32, endPosX int32, } // ImageDrawLineV - Draw line within an image (Vector version) -func ImageDrawLineV(dst *Image, start Vector2, end Vector2, col color.RGBA) { +func ImageDrawLineV(dst *Image, start, end Vector2, col color.RGBA) { imageDrawLineV(dst, *(*uintptr)(unsafe.Pointer(&start)), *(*uintptr)(unsafe.Pointer(&end)), *(*uintptr)(unsafe.Pointer(&col))) } +// ImageDrawLineEx - Draw a line defining thickness within an image +func ImageDrawLineEx(dst *Image, start, end Vector2, thick int32, col color.RGBA) { + imageDrawLineEx(dst, *(*uintptr)(unsafe.Pointer(&start)), *(*uintptr)(unsafe.Pointer(&end)), thick, *(*uintptr)(unsafe.Pointer(&col))) +} + // ImageDrawCircle - Draw a filled circle within an image func ImageDrawCircle(dst *Image, centerX int32, centerY int32, radius int32, col color.RGBA) { imageDrawCircle(dst, centerX, centerY, radius, *(*uintptr)(unsafe.Pointer(&col))) diff --git a/raylib/rtextures.go b/raylib/rtextures.go index 901fd22..5339bc6 100644 --- a/raylib/rtextures.go +++ b/raylib/rtextures.go @@ -551,6 +551,16 @@ func ImageDrawLineV(dst *Image, start, end Vector2, col color.RGBA) { C.ImageDrawLineV(cdst, *cstart, *cend, *ccolor) } +// ImageDrawLineEx - Draw a line defining thickness within an image +func ImageDrawLineEx(dst *Image, start, end Vector2, thick int32, col color.RGBA) { + cdst := dst.cptr() + cstart := start.cptr() + cend := end.cptr() + cthick := C.int(thick) + ccolor := colorCptr(col) + C.ImageDrawLineEx(cdst, *cstart, *cend, cthick, *ccolor) +} + // ImageDrawCircle - Draw a filled circle within an image func ImageDrawCircle(dst *Image, centerX, centerY, radius int32, col color.RGBA) { cdst := dst.cptr()