mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 10:48:53 +01:00
examples/vector: improve readability of the debug message
This commit is contained in:
parent
5d9acfe7ec
commit
010bf69f5a
@ -47,7 +47,7 @@ const (
|
|||||||
screenHeight = 480
|
screenHeight = 480
|
||||||
)
|
)
|
||||||
|
|
||||||
func drawEbitenText(screen *ebiten.Image, scale float32) {
|
func drawEbitenText(screen *ebiten.Image, x, y int, scale float32) {
|
||||||
var path vector.Path
|
var path vector.Path
|
||||||
|
|
||||||
// E
|
// E
|
||||||
@ -118,8 +118,8 @@ func drawEbitenText(screen *ebiten.Image, scale float32) {
|
|||||||
}
|
}
|
||||||
vs, is := path.AppendVerticesAndIndicesForFilling(nil, nil)
|
vs, is := path.AppendVerticesAndIndicesForFilling(nil, nil)
|
||||||
for i := range vs {
|
for i := range vs {
|
||||||
vs[i].DstX *= scale
|
vs[i].DstX = (vs[i].DstX + float32(x)) * scale
|
||||||
vs[i].DstY *= scale
|
vs[i].DstY = (vs[i].DstY + float32(y)) * scale
|
||||||
vs[i].SrcX = 1
|
vs[i].SrcX = 1
|
||||||
vs[i].SrcY = 1
|
vs[i].SrcY = 1
|
||||||
vs[i].ColorR = 0xdb / float32(0xff)
|
vs[i].ColorR = 0xdb / float32(0xff)
|
||||||
@ -133,35 +133,34 @@ func drawEbitenLogo(screen *ebiten.Image, x, y int, scale float32) {
|
|||||||
const unit = 16
|
const unit = 16
|
||||||
|
|
||||||
var path vector.Path
|
var path vector.Path
|
||||||
xf, yf := float32(x), float32(y)
|
|
||||||
|
|
||||||
// TODO: Add curves
|
// TODO: Add curves
|
||||||
path.MoveTo(xf, yf+4*unit)
|
path.MoveTo(0, 4*unit)
|
||||||
path.LineTo(xf, yf+6*unit)
|
path.LineTo(0, 6*unit)
|
||||||
path.LineTo(xf+2*unit, yf+6*unit)
|
path.LineTo(2*unit, 6*unit)
|
||||||
path.LineTo(xf+2*unit, yf+5*unit)
|
path.LineTo(2*unit, 5*unit)
|
||||||
path.LineTo(xf+3*unit, yf+5*unit)
|
path.LineTo(3*unit, 5*unit)
|
||||||
path.LineTo(xf+3*unit, yf+4*unit)
|
path.LineTo(3*unit, 4*unit)
|
||||||
path.LineTo(xf+4*unit, yf+4*unit)
|
path.LineTo(4*unit, 4*unit)
|
||||||
path.LineTo(xf+4*unit, yf+2*unit)
|
path.LineTo(4*unit, 2*unit)
|
||||||
path.LineTo(xf+6*unit, yf+2*unit)
|
path.LineTo(6*unit, 2*unit)
|
||||||
path.LineTo(xf+6*unit, yf+1*unit)
|
path.LineTo(6*unit, 1*unit)
|
||||||
path.LineTo(xf+5*unit, yf+1*unit)
|
path.LineTo(5*unit, 1*unit)
|
||||||
path.LineTo(xf+5*unit, yf)
|
path.LineTo(5*unit, 0)
|
||||||
path.LineTo(xf+4*unit, yf)
|
path.LineTo(4*unit, 0)
|
||||||
path.LineTo(xf+4*unit, yf+2*unit)
|
path.LineTo(4*unit, 2*unit)
|
||||||
path.LineTo(xf+2*unit, yf+2*unit)
|
path.LineTo(2*unit, 2*unit)
|
||||||
path.LineTo(xf+2*unit, yf+3*unit)
|
path.LineTo(2*unit, 3*unit)
|
||||||
path.LineTo(xf+unit, yf+3*unit)
|
path.LineTo(unit, 3*unit)
|
||||||
path.LineTo(xf+unit, yf+4*unit)
|
path.LineTo(unit, 4*unit)
|
||||||
|
|
||||||
op := &ebiten.DrawTrianglesOptions{
|
op := &ebiten.DrawTrianglesOptions{
|
||||||
FillRule: ebiten.EvenOdd,
|
FillRule: ebiten.EvenOdd,
|
||||||
}
|
}
|
||||||
vs, is := path.AppendVerticesAndIndicesForFilling(nil, nil)
|
vs, is := path.AppendVerticesAndIndicesForFilling(nil, nil)
|
||||||
for i := range vs {
|
for i := range vs {
|
||||||
vs[i].DstX *= scale
|
vs[i].DstX = (vs[i].DstX + float32(x)) * scale
|
||||||
vs[i].DstY *= scale
|
vs[i].DstY = (vs[i].DstY + float32(y)) * scale
|
||||||
vs[i].SrcX = 1
|
vs[i].SrcX = 1
|
||||||
vs[i].SrcY = 1
|
vs[i].SrcY = 1
|
||||||
vs[i].ColorR = 0xdb / float32(0xff)
|
vs[i].ColorR = 0xdb / float32(0xff)
|
||||||
@ -284,9 +283,9 @@ func (g *Game) Draw(screen *ebiten.Image) {
|
|||||||
dst = g.offscreen
|
dst = g.offscreen
|
||||||
}
|
}
|
||||||
|
|
||||||
dst.Fill(color.White)
|
dst.Fill(color.RGBA{0xe0, 0xe0, 0xe0, 0xe0})
|
||||||
drawEbitenText(dst, scale)
|
drawEbitenText(dst, 0, 50, scale)
|
||||||
drawEbitenLogo(dst, 20, 90, scale)
|
drawEbitenLogo(dst, 20, 150, scale)
|
||||||
drawArc(dst, g.counter, scale)
|
drawArc(dst, g.counter, scale)
|
||||||
drawWave(dst, g.counter, scale)
|
drawWave(dst, g.counter, scale)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user