From c892f8481675fbd9bf5f4a5bae12b5d1aed43899 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Sun, 18 Jan 2015 00:05:15 +0900 Subject: [PATCH] example/blocks: Use FillRect (imageEmpty is no longer needed) --- example/blocks/blocks/gamescene.go | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/example/blocks/blocks/gamescene.go b/example/blocks/blocks/gamescene.go index 0830860b8..b70994216 100644 --- a/example/blocks/blocks/gamescene.go +++ b/example/blocks/blocks/gamescene.go @@ -25,7 +25,6 @@ import ( ) var ( - imageEmpty *ebiten.Image imageGameBG *ebiten.Image imageWindows *ebiten.Image imageGameover *ebiten.Image @@ -67,12 +66,6 @@ func linesTextBoxPosition() (x, y int) { func init() { var err error - imageEmpty, err = ebiten.NewImage(16, 16, ebiten.FilterNearest) - if err != nil { - panic(err) - } - imageEmpty.Fill(color.White) - // Background imageGameBG, _, err = ebitenutil.NewImageFromFile("images/gophers.jpg", ebiten.FilterLinear) if err != nil { @@ -127,12 +120,7 @@ func init() { } func drawWindow(r *ebiten.Image, x, y, width, height int) error { - w, h := imageEmpty.Size() - op := &ebiten.DrawImageOptions{} - op.GeoM.Scale(float64(width)/float64(w), float64(height)/float64(h)) - op.GeoM.Translate(float64(x), float64(y)) - op.ColorM.Scale(0.0, 0.0, 0.0, 0.75) - return r.DrawImage(imageEmpty, op) + return r.FillRect(x, y, width, height, color.NRGBA{0, 0, 0, 0xc0}) } var fontColor = color.NRGBA{0x40, 0x40, 0xff, 0xff}