1
0
Fork 0

Initial commit

This commit is contained in:
Henrik Hautakoski 2025-09-14 08:38:30 +02:00
commit 0245a5cb43
22 changed files with 610 additions and 0 deletions

31
engine/render/text.go Normal file
View file

@ -0,0 +1,31 @@
package render
import (
"image/color"
rl "github.com/gen2brain/raylib-go/raylib"
)
func DrawText(x, y, size int32, text string, col color.RGBA) {
destRect := rl.Rectangle{
X: float32(x),
Y: float32(y),
Width: float32(size),
Height: float32(size),
}
for _, ch := range text {
if ch == ' ' {
destRect.X += float32(size)
continue
}
tile := font.GetTile(ch)
if tile == nil {
destRect.X += float32(size)
continue
}
rl.DrawTexturePro(texture, tile.GetTexRect(), destRect, rl.Vector2Zero(), 0, col)
destRect.X += float32(size)
}
}