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

43 lines
1022 B

//go:build example
// +build example
package system
import (
type DrawBulletsSystem struct {
op *ebiten.DrawImageOptions
func NewDrawBulletsSystem() *DrawBulletsSystem {
return &DrawBulletsSystem{
op: &ebiten.DrawImageOptions{},
func (s *DrawBulletsSystem) Components() []gohan.ComponentID {
return []gohan.ComponentID{
func (s *DrawBulletsSystem) Update(ctx *gohan.Context) error {
return gohan.ErrSystemWithoutUpdate
func (s *DrawBulletsSystem) Draw(ctx *gohan.Context, screen *ebiten.Image) error {
position := component.Position(ctx)
s.op.GeoM.Translate(-16, -16)
s.op.GeoM.Scale(0.5, 0.5)
s.op.GeoM.Translate(position.X, position.Y)
screen.DrawImage(asset.ImgWhiteSquare, s.op)
return nil