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 {
	Transform
	Drawity
	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
}