diff --git a/ebitenutil/shapes.go b/ebitenutil/shapes.go index cd827d360..bcf862460 100644 --- a/ebitenutil/shapes.go +++ b/ebitenutil/shapes.go @@ -44,16 +44,16 @@ func DrawLine(dst *ebiten.Image, x1, y1, x2, y2 float64, clr color.Color) { // // DrawRect is intended to be used mainly for debugging or prototyping purpose. // -// Deprecated: as of v2.5. Use vector.FillRect instead. +// Deprecated: as of v2.5. Use vector.DrawFilledRect instead. func DrawRect(dst *ebiten.Image, x, y, width, height float64, clr color.Color) { - vector.FillRect(dst, float32(x), float32(y), float32(width), float32(height), clr) + vector.DrawFilledRect(dst, float32(x), float32(y), float32(width), float32(height), clr) } // DrawCircle draws a circle on given destination dst. // // DrawCircle is intended to be used mainly for debugging or prototyping purpose. // -// Deprecated: as of v2.5. Use vector.FillCircle instead. +// Deprecated: as of v2.5. Use vector.DrawFilledCircle instead. func DrawCircle(dst *ebiten.Image, cx, cy, r float64, clr color.Color) { - vector.FillCircle(dst, float32(cx), float32(cy), float32(r), clr) + vector.DrawFilledCircle(dst, float32(cx), float32(cy), float32(r), clr) } diff --git a/examples/audio/main.go b/examples/audio/main.go index 6a24ba2b0..05895c28d 100644 --- a/examples/audio/main.go +++ b/examples/audio/main.go @@ -339,13 +339,13 @@ func (p *Player) seekBarIfNeeded() error { func (p *Player) draw(screen *ebiten.Image) { // Draw the bar. x, y, w, h := playerBarRect() - vector.FillRect(screen, float32(x), float32(y), float32(w), float32(h), playerBarColor) + vector.DrawFilledRect(screen, float32(x), float32(y), float32(w), float32(h), playerBarColor) // Draw the cursor on the bar. c := p.current cx := float32(x) + float32(w)*float32(p.current)/float32(p.total) cy := float32(y) + float32(h)/2 - vector.FillCircle(screen, cx, cy, 12, playerCurrentColor) + vector.DrawFilledCircle(screen, cx, cy, 12, playerCurrentColor) // Compose the curren time text. m := (c / time.Minute) % 100 diff --git a/examples/blocks/blocks/gamescene.go b/examples/blocks/blocks/gamescene.go index dae891f8f..6f805f8c6 100644 --- a/examples/blocks/blocks/gamescene.go +++ b/examples/blocks/blocks/gamescene.go @@ -107,7 +107,7 @@ func init() { } func drawWindow(r *ebiten.Image, x, y, width, height int) { - vector.FillRect(r, float32(x), float32(y), float32(width), float32(height), color.RGBA{0, 0, 0, 0xc0}) + vector.DrawFilledRect(r, float32(x), float32(y), float32(width), float32(height), color.RGBA{0, 0, 0, 0xc0}) } var fontColor = color.NRGBA{0x40, 0x40, 0xff, 0xff} diff --git a/examples/cursor/main.go b/examples/cursor/main.go index bbe182766..ee224d95d 100644 --- a/examples/cursor/main.go +++ b/examples/cursor/main.go @@ -51,7 +51,7 @@ func (g *Game) Update() error { func (g *Game) Draw(screen *ebiten.Image) { for r, c := range g.gridColors { - vector.FillRect(screen, float32(r.Min.X), float32(r.Min.Y), float32(r.Dx()), float32(r.Dy()), c) + vector.DrawFilledRect(screen, float32(r.Min.X), float32(r.Min.Y), float32(r.Dx()), float32(r.Dy()), c) } switch ebiten.CursorShape() { diff --git a/examples/piano/main.go b/examples/piano/main.go index 5f88f08d9..db6dd2208 100644 --- a/examples/piano/main.go +++ b/examples/piano/main.go @@ -150,7 +150,7 @@ func init() { for i, k := range whiteKeys { x := i*keyWidth + 36 height := 112 - vector.FillRect(pianoImage, float32(x), float32(y), float32(keyWidth-1), float32(height), color.White) + vector.DrawFilledRect(pianoImage, float32(x), float32(y), float32(keyWidth-1), float32(height), color.White) text.Draw(pianoImage, k, arcadeFont, x+8, y+height-8, color.Black) } @@ -161,7 +161,7 @@ func init() { } x := i*keyWidth + 24 height := 64 - vector.FillRect(pianoImage, float32(x), float32(y), float32(keyWidth-1), float32(height), color.Black) + vector.DrawFilledRect(pianoImage, float32(x), float32(y), float32(keyWidth-1), float32(height), color.Black) text.Draw(pianoImage, k, arcadeFont, x+8, y+height-8, color.White) } } diff --git a/examples/raycasting/main.go b/examples/raycasting/main.go index 47059f571..97ac1e2a5 100644 --- a/examples/raycasting/main.go +++ b/examples/raycasting/main.go @@ -267,8 +267,8 @@ func (g *Game) Draw(screen *ebiten.Image) { } // Draw player as a rect - vector.FillRect(screen, float32(g.px)-2, float32(g.py)-2, 4, 4, color.Black) - vector.FillRect(screen, float32(g.px)-1, float32(g.py)-1, 2, 2, color.RGBA{255, 100, 100, 255}) + vector.DrawFilledRect(screen, float32(g.px)-2, float32(g.py)-2, 4, 4, color.Black) + vector.DrawFilledRect(screen, float32(g.px)-1, float32(g.py)-1, 2, 2, color.RGBA{255, 100, 100, 255}) if g.showRays { ebitenutil.DebugPrintAt(screen, "R: hide rays", padding, 0) diff --git a/examples/shapes/main.go b/examples/shapes/main.go index 64a14e658..68b098328 100644 --- a/examples/shapes/main.go +++ b/examples/shapes/main.go @@ -48,10 +48,10 @@ func (g *Game) Draw(screen *ebiten.Image) { vector.StrokeLine(screen, 50, 150, 50, 350, 1, color.RGBA{0xff, 0xff, 0x00, 0xff}) vector.StrokeLine(screen, 50, 100+cf, 200+cf, 250, 4, color.RGBA{0x00, 0xff, 0xff, 0xff}) - vector.FillRect(screen, 50+cf, 50+cf, 100+cf, 100+cf, color.RGBA{0x80, 0x80, 0x80, 0xc0}) + vector.DrawFilledRect(screen, 50+cf, 50+cf, 100+cf, 100+cf, color.RGBA{0x80, 0x80, 0x80, 0xc0}) vector.StrokeRect(screen, 300-cf, 50, 120, 120, 10+cf/4, color.RGBA{0x00, 0x80, 0x00, 0xff}) - vector.FillCircle(screen, 400, 400, 100, color.RGBA{0x80, 0x00, 0x80, 0x80}) + vector.DrawFilledCircle(screen, 400, 400, 100, color.RGBA{0x80, 0x00, 0x80, 0x80}) vector.StrokeCircle(screen, 400, 400, 10+cf, 10+cf/2, color.RGBA{0xff, 0x80, 0xff, 0xff}) ebitenutil.DebugPrint(screen, fmt.Sprintf("TPS: %0.2f", ebiten.ActualTPS())) diff --git a/examples/snake/main.go b/examples/snake/main.go index eb2c891e3..0942ef08d 100644 --- a/examples/snake/main.go +++ b/examples/snake/main.go @@ -175,9 +175,9 @@ func (g *Game) Update() error { func (g *Game) Draw(screen *ebiten.Image) { for _, v := range g.snakeBody { - vector.FillRect(screen, float32(v.X*gridSize), float32(v.Y*gridSize), gridSize, gridSize, color.RGBA{0x80, 0xa0, 0xc0, 0xff}) + vector.DrawFilledRect(screen, float32(v.X*gridSize), float32(v.Y*gridSize), gridSize, gridSize, color.RGBA{0x80, 0xa0, 0xc0, 0xff}) } - vector.FillRect(screen, float32(g.apple.X*gridSize), float32(g.apple.Y*gridSize), gridSize, gridSize, color.RGBA{0xFF, 0x00, 0x00, 0xff}) + vector.DrawFilledRect(screen, float32(g.apple.X*gridSize), float32(g.apple.Y*gridSize), gridSize, gridSize, color.RGBA{0xFF, 0x00, 0x00, 0xff}) if g.moveDirection == dirNone { ebitenutil.DebugPrint(screen, fmt.Sprintf("Press up/down/left/right to start")) diff --git a/examples/text/main.go b/examples/text/main.go index 2885bb04b..7df1f62f2 100644 --- a/examples/text/main.go +++ b/examples/text/main.go @@ -96,13 +96,13 @@ func (g *Game) Draw(screen *ebiten.Image) { { const x, y = 20, 40 b := text.BoundString(mplusNormalFont, sampleText) - vector.FillRect(screen, float32(b.Min.X+x), float32(b.Min.Y+y), float32(b.Dx()), float32(b.Dy()), gray) + vector.DrawFilledRect(screen, float32(b.Min.X+x), float32(b.Min.Y+y), float32(b.Dx()), float32(b.Dy()), gray) text.Draw(screen, sampleText, mplusNormalFont, x, y, color.White) } { const x, y = 20, 140 b := text.BoundString(mplusBigFont, sampleText) - vector.FillRect(screen, float32(b.Min.X+x), float32(b.Min.Y+y), float32(b.Dx()), float32(b.Dy()), gray) + vector.DrawFilledRect(screen, float32(b.Min.X+x), float32(b.Min.Y+y), float32(b.Dx()), float32(b.Dy()), gray) text.Draw(screen, sampleText, mplusBigFont, x, y, color.White) } { @@ -117,7 +117,7 @@ func (g *Game) Draw(screen *ebiten.Image) { const x, y = 160, 240 const lineHeight = 80 b := text.BoundString(text.FaceWithLineHeight(mplusBigFont, lineHeight), sampleText) - vector.FillRect(screen, float32(b.Min.X+x), float32(b.Min.Y+y), float32(b.Dx()), float32(b.Dy()), gray) + vector.DrawFilledRect(screen, float32(b.Min.X+x), float32(b.Min.Y+y), float32(b.Dx()), float32(b.Dy()), gray) text.Draw(screen, sampleText, text.FaceWithLineHeight(mplusBigFont, lineHeight), x, y, color.White) } { diff --git a/vector/util.go b/vector/util.go index ac128af8c..7e89954d9 100644 --- a/vector/util.go +++ b/vector/util.go @@ -60,8 +60,8 @@ func StrokeLine(dst *ebiten.Image, x0, y0, x1, y1 float32, strokeWidth float32, drawVerticesForUtil(dst, vs, is, clr) } -// FillRect fills a rectangle with the specified width and color. -func FillRect(dst *ebiten.Image, x, y, width, height float32, clr color.Color) { +// DrawFilledRect fills a rectangle with the specified width and color. +func DrawFilledRect(dst *ebiten.Image, x, y, width, height float32, clr color.Color) { var path Path path.MoveTo(x, y) path.LineTo(x, y+height) @@ -91,8 +91,8 @@ func StrokeRect(dst *ebiten.Image, x, y, width, height float32, strokeWidth floa drawVerticesForUtil(dst, vs, is, clr) } -// FillCircle filles a circle with the specified center position (cx, cy), the radius (r), width and color. -func FillCircle(dst *ebiten.Image, cx, cy, r float32, clr color.Color) { +// DrawFilledCircle filles a circle with the specified center position (cx, cy), the radius (r), width and color. +func DrawFilledCircle(dst *ebiten.Image, cx, cy, r float32, clr color.Color) { var path Path path.Arc(float32(cx), float32(cy), float32(r), 0, 2*math.Pi, Clockwise) vs, is := path.AppendVerticesAndIndicesForFilling(nil, nil)