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.

43 lines
1.0 KiB

//go:build example
// +build example
package system
import (
type printInfoSystem struct {
img *ebiten.Image
op *ebiten.DrawImageOptions
player gohan.Entity
func NewPrintInfoSystem(player gohan.Entity) *printInfoSystem {
p := &printInfoSystem{
img: ebiten.NewImage(200, 100),
op: &ebiten.DrawImageOptions{},
player: player,
p.op.GeoM.Scale(2, 2)
return p
func (s *printInfoSystem) Matches(e gohan.Entity) bool {
return e == s.player
func (s *printInfoSystem) Update(_ gohan.Entity) error {
return gohan.ErrSystemWithoutUpdate
func (s *printInfoSystem) Draw(_ gohan.Entity, screen *ebiten.Image) error {
ebitenutil.DebugPrint(s.img, fmt.Sprintf("KEY WASD+MOUSE\nENT %d\nUPD %d\nDRA %d\nTPS %0.0f\nFPS %0.0f", gohan.ActiveEntities(), gohan.UpdatedEntities(), gohan.DrawnEntities(), ebiten.CurrentTPS(), ebiten.CurrentFPS()))
screen.DrawImage(s.img, s.op)
return nil