|
|
|
@ -122,7 +122,7 @@ func (g *Game) Update() error {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (g *Game) Draw(screen *ebiten.Image) {
|
|
|
|
|
ebitenutil.DebugPrint(screen, "Press O to show/hide origins")
|
|
|
|
|
ebitenutil.DebugPrint(screen, "Press O to show/hide origins.\nRed points are the original origin positions.\nThe green points are the origin positions after applying the offset.")
|
|
|
|
|
|
|
|
|
|
gray := color.RGBA{0x80, 0x80, 0x80, 0xff}
|
|
|
|
|
|
|
|
|
@ -134,7 +134,7 @@ func (g *Game) Draw(screen *ebiten.Image) {
|
|
|
|
|
Size: 24,
|
|
|
|
|
Language: language.Arabic,
|
|
|
|
|
}
|
|
|
|
|
x, y := screenWidth-20, 40
|
|
|
|
|
x, y := screenWidth-20, 50
|
|
|
|
|
w, h := text.Measure(arabicText, f, 0)
|
|
|
|
|
// The left upper point is not x but x-w, since the text runs in the rigth-to-left direction.
|
|
|
|
|
vector.DrawFilledRect(screen, float32(x)-float32(w), float32(y), float32(w), float32(h), gray, false)
|
|
|
|
@ -145,6 +145,7 @@ func (g *Game) Draw(screen *ebiten.Image) {
|
|
|
|
|
if g.showOrigins {
|
|
|
|
|
op := &text.LayoutOptions{}
|
|
|
|
|
for _, g := range text.AppendGlyphs(nil, arabicText, f, op) {
|
|
|
|
|
vector.DrawFilledCircle(screen, float32(x)+float32(g.OriginX+g.OriginOffsetX), float32(y)+float32(g.OriginY+g.OriginOffsetY), 2, color.RGBA{0, 0xff, 0, 0xff}, true)
|
|
|
|
|
vector.DrawFilledCircle(screen, float32(x)+float32(g.OriginX), float32(y)+float32(g.OriginY), 2, color.RGBA{0xff, 0, 0, 0xff}, true)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -156,7 +157,7 @@ func (g *Game) Draw(screen *ebiten.Image) {
|
|
|
|
|
Size: 24,
|
|
|
|
|
Language: language.Hindi,
|
|
|
|
|
}
|
|
|
|
|
x, y := 20, 100
|
|
|
|
|
x, y := 20, 110
|
|
|
|
|
w, h := text.Measure(hindiText, f, 0)
|
|
|
|
|
vector.DrawFilledRect(screen, float32(x), float32(y), float32(w), float32(h), gray, false)
|
|
|
|
|
op := &text.DrawOptions{}
|
|
|
|
@ -166,6 +167,7 @@ func (g *Game) Draw(screen *ebiten.Image) {
|
|
|
|
|
if g.showOrigins {
|
|
|
|
|
op := &text.LayoutOptions{}
|
|
|
|
|
for _, g := range text.AppendGlyphs(nil, hindiText, f, op) {
|
|
|
|
|
vector.DrawFilledCircle(screen, float32(x)+float32(g.OriginX+g.OriginOffsetX), float32(y)+float32(g.OriginY+g.OriginOffsetY), 2, color.RGBA{0, 0xff, 0, 0xff}, true)
|
|
|
|
|
vector.DrawFilledCircle(screen, float32(x)+float32(g.OriginX), float32(y)+float32(g.OriginY), 2, color.RGBA{0xff, 0, 0, 0xff}, true)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -177,7 +179,7 @@ func (g *Game) Draw(screen *ebiten.Image) {
|
|
|
|
|
Size: 24,
|
|
|
|
|
Language: language.Burmese,
|
|
|
|
|
}
|
|
|
|
|
x, y := 20, 160
|
|
|
|
|
x, y := 20, 170
|
|
|
|
|
w, h := text.Measure(myanmarText, f, 0)
|
|
|
|
|
vector.DrawFilledRect(screen, float32(x), float32(y), float32(w), float32(h), gray, false)
|
|
|
|
|
op := &text.DrawOptions{}
|
|
|
|
@ -187,6 +189,7 @@ func (g *Game) Draw(screen *ebiten.Image) {
|
|
|
|
|
if g.showOrigins {
|
|
|
|
|
op := &text.LayoutOptions{}
|
|
|
|
|
for _, g := range text.AppendGlyphs(nil, myanmarText, f, op) {
|
|
|
|
|
vector.DrawFilledCircle(screen, float32(x)+float32(g.OriginX+g.OriginOffsetX), float32(y)+float32(g.OriginY+g.OriginOffsetY), 2, color.RGBA{0, 0xff, 0, 0xff}, true)
|
|
|
|
|
vector.DrawFilledCircle(screen, float32(x)+float32(g.OriginX), float32(y)+float32(g.OriginY), 2, color.RGBA{0xff, 0, 0, 0xff}, true)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -198,7 +201,7 @@ func (g *Game) Draw(screen *ebiten.Image) {
|
|
|
|
|
Size: 24,
|
|
|
|
|
Language: language.Thai,
|
|
|
|
|
}
|
|
|
|
|
x, y := 20, 220
|
|
|
|
|
x, y := 20, 230
|
|
|
|
|
w, h := text.Measure(thaiText, f, 0)
|
|
|
|
|
vector.DrawFilledRect(screen, float32(x), float32(y), float32(w), float32(h), gray, false)
|
|
|
|
|
op := &text.DrawOptions{}
|
|
|
|
@ -208,6 +211,7 @@ func (g *Game) Draw(screen *ebiten.Image) {
|
|
|
|
|
if g.showOrigins {
|
|
|
|
|
op := &text.LayoutOptions{}
|
|
|
|
|
for _, g := range text.AppendGlyphs(nil, thaiText, f, op) {
|
|
|
|
|
vector.DrawFilledCircle(screen, float32(x)+float32(g.OriginX+g.OriginOffsetX), float32(y)+float32(g.OriginY+g.OriginOffsetY), 2, color.RGBA{0, 0xff, 0, 0xff}, true)
|
|
|
|
|
vector.DrawFilledCircle(screen, float32(x)+float32(g.OriginX), float32(y)+float32(g.OriginY), 2, color.RGBA{0xff, 0, 0, 0xff}, true)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -223,7 +227,7 @@ func (g *Game) Draw(screen *ebiten.Image) {
|
|
|
|
|
Script: language.MustParseScript("Mong"),
|
|
|
|
|
}
|
|
|
|
|
const lineSpacing = 48
|
|
|
|
|
x, y := 20, 280
|
|
|
|
|
x, y := 20, 290
|
|
|
|
|
w, h := text.Measure(mongolianText, f, lineSpacing)
|
|
|
|
|
vector.DrawFilledRect(screen, float32(x), float32(y), float32(w), float32(h), gray, false)
|
|
|
|
|
op := &text.DrawOptions{}
|
|
|
|
@ -235,6 +239,7 @@ func (g *Game) Draw(screen *ebiten.Image) {
|
|
|
|
|
op := &text.LayoutOptions{}
|
|
|
|
|
op.LineSpacing = lineSpacing
|
|
|
|
|
for _, g := range text.AppendGlyphs(nil, mongolianText, f, op) {
|
|
|
|
|
vector.DrawFilledCircle(screen, float32(x)+float32(g.OriginX+g.OriginOffsetX), float32(y)+float32(g.OriginY+g.OriginOffsetY), 2, color.RGBA{0, 0xff, 0, 0xff}, true)
|
|
|
|
|
vector.DrawFilledCircle(screen, float32(x)+float32(g.OriginX), float32(y)+float32(g.OriginY), 2, color.RGBA{0xff, 0, 0, 0xff}, true)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -248,7 +253,7 @@ func (g *Game) Draw(screen *ebiten.Image) {
|
|
|
|
|
Language: language.Japanese,
|
|
|
|
|
}
|
|
|
|
|
const lineSpacing = 48
|
|
|
|
|
x, y := screenWidth-20, 280
|
|
|
|
|
x, y := screenWidth-20, 290
|
|
|
|
|
w, h := text.Measure(japaneseText, f, lineSpacing)
|
|
|
|
|
// The left upper point is not x but x-w, since the text runs in the rigth-to-left direction as the secondary direction.
|
|
|
|
|
vector.DrawFilledRect(screen, float32(x)-float32(w), float32(y), float32(w), float32(h), gray, false)
|
|
|
|
@ -262,6 +267,7 @@ func (g *Game) Draw(screen *ebiten.Image) {
|
|
|
|
|
op.LineSpacing = lineSpacing
|
|
|
|
|
for _, g := range text.AppendGlyphs(nil, japaneseText, f, op) {
|
|
|
|
|
vector.DrawFilledCircle(screen, float32(x)+float32(g.OriginX), float32(y)+float32(g.OriginY), 2, color.RGBA{0xff, 0, 0, 0xff}, true)
|
|
|
|
|
vector.DrawFilledCircle(screen, float32(x)+float32(g.OriginX+g.OriginOffsetX), float32(y)+float32(g.OriginY+g.OriginOffsetY), 2, color.RGBA{0, 0xff, 0, 0xff}, true)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|