From 893dfa5f8539e07cd9a8118d3b54ae4ad55798dc Mon Sep 17 00:00:00 2001 From: JupiterRider <60042618+JupiterRider@users.noreply.github.com> Date: Sun, 3 Nov 2024 15:13:14 +0100 Subject: [PATCH] GenImageFontAtlas function added to cgo version as well --- raylib/rtext.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/raylib/rtext.go b/raylib/rtext.go index 25f980d..d1ffd2e 100644 --- a/raylib/rtext.go +++ b/raylib/rtext.go @@ -223,3 +223,13 @@ func GetGlyphAtlasRec(font Font, codepoint int32) Rectangle { v := newRectangleFromPointer(unsafe.Pointer(&ret)) return v } + +// GenImageFontAtlas - Generate image font atlas using chars info +func GenImageFontAtlas(glyphs []GlyphInfo, glyphRecs []*Rectangle, fontSize int32, padding int32, packMethod int32) Image { + cglyphs := (*C.GlyphInfo)(unsafe.Pointer(&glyphs[0])) + cglyphRecs := (**C.Rectangle)(unsafe.Pointer(&glyphRecs[0])) + cglyphCount := C.int(len(glyphs)) + ret := C.GenImageFontAtlas(cglyphs, cglyphRecs, cglyphCount, C.int(fontSize), C.int(padding), C.int(packMethod)) + v := newImageFromPointer(unsafe.Pointer(&ret)) + return *v +}