Add new text functions

This commit is contained in:
Milan Nikolic 2023-11-08 20:16:56 +01:00
parent 635c63d7cc
commit f75cc39078
No known key found for this signature in database
GPG key ID: 9229D0EAA3AA4E75

View file

@ -104,6 +104,13 @@ func UnloadFont(font Font) {
C.UnloadFont(*cfont)
}
// DrawFPS - Shows current FPS
func DrawFPS(posX int32, posY int32) {
cposX := (C.int)(posX)
cposY := (C.int)(posY)
C.DrawFPS(cposX, cposY)
}
// DrawText - Draw text (using default font)
func DrawText(text string, posX int32, posY int32, fontSize int32, col color.RGBA) {
ctext := C.CString(text)
@ -127,6 +134,12 @@ func DrawTextEx(font Font, text string, position Vector2, fontSize float32, spac
C.DrawTextEx(*cfont, ctext, *cposition, cfontSize, cspacing, *ctint)
}
// SetTextLineSpacing - Set vertical line spacing when drawing with line-breaks
func SetTextLineSpacing(spacing int) {
cspacing := (C.int)(spacing)
C.SetTextLineSpacing(cspacing)
}
// MeasureText - Measure string width for default font
func MeasureText(text string, fontSize int32) int32 {
ctext := C.CString(text)
@ -175,10 +188,3 @@ func GetGlyphAtlasRec(font Font, codepoint int32) Rectangle {
v := newRectangleFromPointer(unsafe.Pointer(&ret))
return v
}
// DrawFPS - Shows current FPS
func DrawFPS(posX int32, posY int32) {
cposX := (C.int)(posX)
cposY := (C.int)(posY)
C.DrawFPS(cposX, cposY)
}