examples/additive: Refactoring

This commit is contained in:
Hajime Hoshi 2018-01-21 19:43:48 +09:00
parent 96c5621879
commit a6a1c51df7

View File

@ -38,17 +38,24 @@ func update(screen *ebiten.Image) error {
if ebiten.IsRunningSlowly() { if ebiten.IsRunningSlowly() {
return nil return nil
} }
w, _ := ebitenImage.Size()
const ox = 10 const (
const oy = 10 ox = 10
oy = 10
)
screen.Fill(color.NRGBA{0x00, 0x40, 0x80, 0xff}) screen.Fill(color.NRGBA{0x00, 0x40, 0x80, 0xff})
op := &ebiten.DrawImageOptions{} op := &ebiten.DrawImageOptions{}
op.GeoM.Translate(ox, oy) op.GeoM.Translate(ox, oy)
screen.DrawImage(ebitenImage, op) screen.DrawImage(ebitenImage, op)
op = &ebiten.DrawImageOptions{} op = &ebiten.DrawImageOptions{}
w, _ := ebitenImage.Size()
op.GeoM.Translate(ox+float64(w), oy) op.GeoM.Translate(ox+float64(w), oy)
op.CompositeMode = ebiten.CompositeModeLighter op.CompositeMode = ebiten.CompositeModeLighter
screen.DrawImage(ebitenImage, op) screen.DrawImage(ebitenImage, op)
return nil return nil
} }