Skip to content

Commit

Permalink
Add new text functions
Browse files Browse the repository at this point in the history
  • Loading branch information
gen2brain committed Nov 8, 2023
1 parent 635c63d commit f75cc39
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions raylib/rtext.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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)
}

0 comments on commit f75cc39

Please sign in to comment.