text: Add DrawWithOptions

Closes #1461
This commit is contained in:
Hajime Hoshi
2021-07-27 17:01:36 +09:00
parent 59aa41a3c2
commit 656d9dccc0
2 changed files with 68 additions and 18 deletions
+9
View File
@@ -20,6 +20,7 @@ package main
import (
"image/color"
"log"
"math"
"math/rand"
"time"
@@ -99,6 +100,14 @@ func (g *Game) Draw(screen *ebiten.Image) {
ebitenutil.DrawRect(screen, float64(b.Min.X+x), float64(b.Min.Y+y), float64(b.Dx()), float64(b.Dy()), gray)
text.Draw(screen, sampleText, mplusBigFont, x, y, color.White)
}
{
const x, y = 20, 240
op := &ebiten.DrawImageOptions{}
op.GeoM.Rotate(math.Pi / 4)
op.GeoM.Translate(x, y)
op.Filter = ebiten.FilterLinear
text.DrawWithOptions(screen, sampleText, mplusNormalFont, op)
}
}
func (g *Game) Layout(outsideWidth, outsideHeight int) (int, int) {