diff --git a/raylib/raylib.go b/raylib/raylib.go index 43278a4..5b5401b 100644 --- a/raylib/raylib.go +++ b/raylib/raylib.go @@ -575,8 +575,8 @@ type Rectangle struct { } // NewRectangle - Returns new Rectangle -func NewRectangle(x, y, width, height float32) Rectangle { - return Rectangle{x, y, width, height} +func NewRectangle[XT, YT, WT, HT CoordinateT](x XT, y YT, width WT, height HT) Rectangle { + return Rectangle{float32(x), float32(y), float32(width), float32(height)} } func (r *Rectangle) Delta(x, y, width, height float32) Rectangle { diff --git a/raylib/rshapes.go b/raylib/rshapes.go index 25fb1b7..791e52d 100644 --- a/raylib/rshapes.go +++ b/raylib/rshapes.go @@ -18,7 +18,7 @@ func SetShapesTexture(texture Texture2D, source Rectangle) { } // DrawPixel - Draw a pixel -func DrawPixel(posX, posY int32, col color.RGBA) { +func DrawPixel[XT, YT CoordinateT](posX XT, posY YT, col color.RGBA) { cposX := (C.int)(posX) cposY := (C.int)(posY) ccolor := colorCptr(col) @@ -33,7 +33,7 @@ func DrawPixelV(position Vector2, col color.RGBA) { } // DrawLine - Draw a line -func DrawLine(startPosX, startPosY, endPosX, endPosY int32, col color.RGBA) { +func DrawLine[SXT, SYT, EXT, EYT CoordinateT](startPosX SXT, startPosY SYT, endPosX EXT, endPosY EYT, col color.RGBA) { cstartPosX := (C.int)(startPosX) cstartPosY := (C.int)(startPosY) cendPosX := (C.int)(endPosX) diff --git a/raylib/rtext.go b/raylib/rtext.go index 6dd56eb..8d1402e 100644 --- a/raylib/rtext.go +++ b/raylib/rtext.go @@ -126,14 +126,14 @@ func UnloadFont(font Font) { } // DrawFPS - Shows current FPS -func DrawFPS[PT CoordinateT](posX PT, posY PT) { +func DrawFPS[XT, YT CoordinateT](posX XT, posY YT) { cposX := (C.int)(posX) cposY := (C.int)(posY) C.DrawFPS(cposX, cposY) } // DrawText - Draw text (using default font) -func DrawText[PT CoordinateT](text string, posX PT, posY PT, fontSize int32, col color.RGBA) { +func DrawText[XT, YT CoordinateT](text string, posX XT, posY YT, fontSize int32, col color.RGBA) { ctext := C.CString(text) defer C.free(unsafe.Pointer(ctext)) cposX := (C.int)(posX)