mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 02:38:53 +01:00
example/blocks: Use FillRect (imageEmpty is no longer needed)
This commit is contained in:
parent
26358f3e63
commit
c892f84816
@ -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}
|
||||
|
Loading…
Reference in New Issue
Block a user