2024-05-28 11:24:12 +03:00
|
|
|
package ox
|
|
|
|
|
2024-06-01 16:07:28 +03:00
|
|
|
//import "surdeus.su/core/gg/mx"
|
2024-05-28 11:24:12 +03:00
|
|
|
import "surdeus.su/core/gg"
|
2024-06-01 16:07:28 +03:00
|
|
|
import "github.com/hajimehoshi/ebiten/v2/text"
|
|
|
|
import "github.com/hajimehoshi/ebiten/v2"
|
2024-05-28 11:24:12 +03:00
|
|
|
|
|
|
|
// The type implements basic drawable text.
|
|
|
|
// (Now needs to implement rotation, scaling etc, cause now only position)
|
|
|
|
type Text struct {
|
2024-06-01 16:07:28 +03:00
|
|
|
Transform
|
2024-06-01 22:01:17 +03:00
|
|
|
Drawity
|
2024-06-01 16:07:28 +03:00
|
|
|
Face gg.Face
|
|
|
|
Data string
|
2024-05-28 11:24:12 +03:00
|
|
|
}
|
|
|
|
|
2024-06-01 16:07:28 +03:00
|
|
|
func (txt *Text) Draw(c gg.Context) *gg.Drawing {
|
|
|
|
m := txt.Transform.GetMatrice()
|
|
|
|
if !txt.IsFloating() {
|
|
|
|
m.Concat(c.Camera().GetRealMatrice(c))
|
|
|
|
}
|
2024-05-28 11:24:12 +03:00
|
|
|
//x, y := txt.Position.XY()
|
|
|
|
//text.Draw(c.Image)
|
2024-06-01 16:07:28 +03:00
|
|
|
text.DrawWithOptions(
|
|
|
|
c.Image(),
|
|
|
|
txt.Data,
|
|
|
|
txt.Face,
|
2024-05-28 11:24:12 +03:00
|
|
|
&ebiten.DrawImageOptions{
|
|
|
|
GeoM: m,
|
|
|
|
},
|
|
|
|
)
|
|
|
|
return nil
|
|
|
|
}
|