Entity Component System framework for Ebitengine
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.

37 lines
868 B

//go:build example
// +build example
package system
import (
type DrawBulletsSystem struct {
Position *component.Position
Bullet *component.Bullet
op *ebiten.DrawImageOptions
func NewDrawBulletsSystem() *DrawBulletsSystem {
return &DrawBulletsSystem{
op: &ebiten.DrawImageOptions{},
func (s *DrawBulletsSystem) Update(_ gohan.Entity) error {
return gohan.ErrUnregister
func (s *DrawBulletsSystem) Draw(_ gohan.Entity, screen *ebiten.Image) error {
s.op.GeoM.Translate(-16, -16)
s.op.GeoM.Scale(0.5, 0.5)
s.op.GeoM.Translate(s.Position.X, s.Position.Y)
screen.DrawImage(asset.ImgWhiteSquare, s.op)
return nil