mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 10:48:53 +01:00
examples/additive: Refactoring
This commit is contained in:
parent
96c5621879
commit
a6a1c51df7
@ -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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user