25 lines
470 B
Go
25 lines
470 B
Go
package display
|
|
|
|
import (
|
|
"image"
|
|
"image/draw"
|
|
|
|
"go.maze.io/harmon/internal/pixel"
|
|
"golang.org/x/image/font"
|
|
"golang.org/x/image/font/basicfont"
|
|
"golang.org/x/image/math/fixed"
|
|
)
|
|
|
|
func DrawText(d draw.Image, x, y int, text string) {
|
|
var (
|
|
point = fixed.Point26_6{fixed.Int26_6(x * 64), fixed.Int26_6(y * 64)}
|
|
drawer = &font.Drawer{
|
|
Dst: d,
|
|
Src: &image.Uniform{pixel.On},
|
|
Face: basicfont.Face7x13,
|
|
Dot: point,
|
|
}
|
|
)
|
|
drawer.DrawString(text)
|
|
}
|