diff --git a/raylib/raylib_purego.go b/raylib/raylib_purego.go index 5c584e3..6959b4c 100644 --- a/raylib/raylib_purego.go +++ b/raylib/raylib_purego.go @@ -362,6 +362,7 @@ var colorBrightness func(col uintptr, factor float32) uintptr var colorContrast func(col uintptr, contrast float32) uintptr var colorAlpha func(col uintptr, alpha float32) uintptr var colorAlphaBlend func(dst uintptr, src uintptr, tint uintptr) uintptr +var colorLerp func(col1, col2 uintptr, factor float32) uintptr var getColor func(hexValue uint32) uintptr var getPixelColor func(srcPtr unsafe.Pointer, format int32) uintptr var setPixelColor func(dstPtr unsafe.Pointer, col uintptr, format int32) @@ -874,6 +875,7 @@ func init() { purego.RegisterLibFunc(&colorContrast, raylibDll, "ColorContrast") purego.RegisterLibFunc(&colorAlpha, raylibDll, "ColorAlpha") purego.RegisterLibFunc(&colorAlphaBlend, raylibDll, "ColorAlphaBlend") + purego.RegisterLibFunc(&colorLerp, raylibDll, "ColorLerp") purego.RegisterLibFunc(&getColor, raylibDll, "GetColor") purego.RegisterLibFunc(&getPixelColor, raylibDll, "GetPixelColor") purego.RegisterLibFunc(&setPixelColor, raylibDll, "SetPixelColor") @@ -2957,6 +2959,12 @@ func ColorAlphaBlend(dst color.RGBA, src color.RGBA, tint color.RGBA) color.RGBA return *(*color.RGBA)(unsafe.Pointer(&ret)) } +// ColorLerp - Get color lerp interpolation between two colors, factor [0.0f..1.0f] +func ColorLerp(col1, col2 color.RGBA, factor float32) color.RGBA { + ret := colorLerp(*(*uintptr)(unsafe.Pointer(&col1)), *(*uintptr)(unsafe.Pointer(&col2)), factor) + return *(*color.RGBA)(unsafe.Pointer(&ret)) +} + // GetColor - Get Color structure from hexadecimal value func GetColor(hexValue uint) color.RGBA { ret := getColor(uint32(hexValue)) diff --git a/raylib/rcore.go b/raylib/rcore.go index e46215d..e385b88 100644 --- a/raylib/rcore.go +++ b/raylib/rcore.go @@ -853,6 +853,15 @@ func ColorAlphaBlend(src, dst, tint color.RGBA) color.RGBA { return v } +// ColorLerp - Get color lerp interpolation between two colors, factor [0.0f..1.0f] +func ColorLerp(col1, col2 color.RGBA, factor float32) color.RGBA { + ccol1 := colorCptr(col1) + ccol2 := colorCptr(col2) + ret := C.ColorLerp(*ccol1, *ccol2, C.float(factor)) + v := newColorFromPointer(unsafe.Pointer(&ret)) + return v +} + // GetColor - Returns a Color struct from hexadecimal value func GetColor(hexValue uint) color.RGBA { chexValue := (C.uint)(hexValue)