gg/ox/text.go
2024-06-01 18:07:28 +05:00

39 lines
723 B
Go

package ox
//import "surdeus.su/core/gg/mx"
import "surdeus.su/core/gg"
import "github.com/hajimehoshi/ebiten/v2/text"
import "github.com/hajimehoshi/ebiten/v2"
// The type implements basic drawable text.
// (Now needs to implement rotation, scaling etc, cause now only position)
type Text struct {
ObjectImpl
Transform
Colority
Visibility
Shaderity
Floatity
Face gg.Face
Data string
}
func (txt *Text) Draw(c gg.Context) *gg.Drawing {
m := txt.Transform.GetMatrice()
if !txt.IsFloating() {
m.Concat(c.Camera().GetRealMatrice(c))
}
//x, y := txt.Position.XY()
//text.Draw(c.Image)
text.DrawWithOptions(
c.Image(),
txt.Data,
txt.Face,
&ebiten.DrawImageOptions{
GeoM: m,
},
)
return nil
}