You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
815 B
35 lines
815 B
//go:build example |
|
// +build example |
|
|
|
package system |
|
|
|
import ( |
|
"code.rocketnine.space/tslocum/gohan" |
|
"code.rocketnine.space/tslocum/gohan/examples/twinstick/asset" |
|
"code.rocketnine.space/tslocum/gohan/examples/twinstick/component" |
|
"github.com/hajimehoshi/ebiten/v2" |
|
) |
|
|
|
type drawPlayerSystem struct { |
|
Position *component.Position |
|
Weapon *component.Weapon |
|
|
|
op *ebiten.DrawImageOptions |
|
} |
|
|
|
func NewDrawPlayerSystem() *drawPlayerSystem { |
|
return &drawPlayerSystem{ |
|
op: &ebiten.DrawImageOptions{}, |
|
} |
|
} |
|
|
|
func (s *drawPlayerSystem) Update(_ gohan.Entity) error { |
|
return gohan.ErrUnregister |
|
} |
|
|
|
func (s *drawPlayerSystem) Draw(entity gohan.Entity, screen *ebiten.Image) error { |
|
s.op.GeoM.Reset() |
|
s.op.GeoM.Translate(s.Position.X-16, s.Position.Y-16) |
|
screen.DrawImage(asset.ImgWhiteSquare, s.op) |
|
return nil |
|
}
|
|
|