Add new text functions
This commit is contained in:
parent
635c63d7cc
commit
f75cc39078
1 changed files with 13 additions and 7 deletions
|
@ -104,6 +104,13 @@ func UnloadFont(font Font) {
|
||||||
C.UnloadFont(*cfont)
|
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)
|
// DrawText - Draw text (using default font)
|
||||||
func DrawText(text string, posX int32, posY int32, fontSize int32, col color.RGBA) {
|
func DrawText(text string, posX int32, posY int32, fontSize int32, col color.RGBA) {
|
||||||
ctext := C.CString(text)
|
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)
|
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
|
// MeasureText - Measure string width for default font
|
||||||
func MeasureText(text string, fontSize int32) int32 {
|
func MeasureText(text string, fontSize int32) int32 {
|
||||||
ctext := C.CString(text)
|
ctext := C.CString(text)
|
||||||
|
@ -175,10 +188,3 @@ func GetGlyphAtlasRec(font Font, codepoint int32) Rectangle {
|
||||||
v := newRectangleFromPointer(unsafe.Pointer(&ret))
|
v := newRectangleFromPointer(unsafe.Pointer(&ret))
|
||||||
return v
|
return v
|
||||||
}
|
}
|
||||||
|
|
||||||
// DrawFPS - Shows current FPS
|
|
||||||
func DrawFPS(posX int32, posY int32) {
|
|
||||||
cposX := (C.int)(posX)
|
|
||||||
cposY := (C.int)(posY)
|
|
||||||
C.DrawFPS(cposX, cposY)
|
|
||||||
}
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue