tennis-game/internal/net.go

27 lines
513 B
Go

package internal
import (
"image/color"
"github.com/hajimehoshi/ebiten/v2"
"github.com/hajimehoshi/ebiten/v2/vector"
)
type net struct {
}
const netRectBaseWidth = 1
func (n *net) draw(img *ebiten.Image) {
bounds := img.Bounds()
dy := float32(bounds.Dy())
dx := float32(bounds.Dx())
height := dy / 29
width := netRectBaseWidth * dx / BaseWidth
for offset := float32(0); offset < dy; offset += height * 2 {
vector.DrawFilledRect(img, dx/2-width/2, offset, width, height, color.White, false)
}
}