From d4796cd3bf7fdb395fcd850ecd160a1ada58c275 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Fri, 19 Jan 2018 03:17:14 +0900 Subject: [PATCH] examples/flood: Simplify logic --- examples/flood/main.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/examples/flood/main.go b/examples/flood/main.go index cbdfdb03f..597255af8 100644 --- a/examples/flood/main.go +++ b/examples/flood/main.go @@ -68,15 +68,14 @@ func update(screen *ebiten.Image) error { y := i/4 + 1 op.GeoM.Translate(ox+float64(dx*x), oy+float64(dy*y)) - // Set RGB (not Alpha) 1 forcibly + // Reset RGB (not Alpha) 0 forcibly op.ColorM.Scale(0, 0, 0, 1) - op.ColorM.Translate(1, 1, 1, 0) - // Set color by scaling + // Set color r := float64(c.R) / 0xff g := float64(c.G) / 0xff b := float64(c.B) / 0xff - op.ColorM.Scale(r, g, b, 1) + op.ColorM.Translate(r, g, b, 0) screen.DrawImage(ebitenImage, op) } return nil