Skip to content

Commit

Permalink
Merge pull request #14 from yohamta/feat/clone
Browse files Browse the repository at this point in the history
Add Clone
  • Loading branch information
yohamta authored Dec 11, 2022
2 parents d714db7 + 13f724a commit f619d96
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions sprite.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,3 +202,10 @@ func (spr *Sprite) DrawWithShader(screen *ebiten.Image, index int, opts *DrawOpt
op.Images[3] = shaderOpts.Images[2]
screen.DrawRectShader(int(w), int(h), shaderOpts.Shader, op)
}

func (spr *Sprite) Clone() *Sprite {
s := *spr
s.op = &ebiten.DrawImageOptions{}
s.shaderOp = &ebiten.DrawRectShaderOptions{}
return &s
}

0 comments on commit f619d96

Please sign in to comment.