twitchapon-anim

Basic Twitchapon Receiver/Visuals
git clone git://bsandro.tech/twitchapon-anim
Log | Files | Refs | README | LICENSE

commit 5d3a8550f6aa5a7a97a9b3a351d7839bd299ae49
parent c3873dc0ec49b3640716619b1939ee7d360c7ab4
Author: bsandro <brian.drosan@gmail.com>
Date:   Tue, 17 Nov 2020 22:36:07 +0300

alt image tiling method

Diffstat:
Mebitest.go | 14+++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/ebitest.go b/ebitest.go @@ -114,7 +114,7 @@ func (g *Game) Draw(screen *ebiten.Image) { defer g.ShowDebug(screen) // background - tileImage(screen, Images["grass.jpg"]) + tileImageAlt(screen, Images["grass.jpg"]) for _, sprite := range g.sprites { //w, h := sprite.img.Size() @@ -212,6 +212,18 @@ func tileImage(screen *ebiten.Image, img *ebiten.Image) { screen.DrawTriangles(vs, []uint16{0, 1, 2, 1, 2, 3}, img, op) } +func tileImageAlt(screen *ebiten.Image, img *ebiten.Image) { + scrW, scrH := ScreenSize.width, ScreenSize.height + imgW, imgH := img.Size() + for x := 0; x < scrW; x += imgW { + for y := 0; y < scrH; y += imgH { + op := &ebiten.DrawImageOptions{} + op.GeoM.Translate(float64(x), float64(y)) + screen.DrawImage(img, op) + } + } +} + func makeSprite(name string, x float64, y float64, angle float64) *Sprite { return &Sprite{Images[name], ebiten.DrawImageOptions{}, x, y, angle, 0.0 /* rotation */} }