You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
810 B
Go
34 lines
810 B
Go
package system
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"code.rocketnine.space/tslocum/etk"
|
|
|
|
"code.rocketnine.space/tslocum/gohan"
|
|
"code.rocketnine.space/tslocum/hot-cocoa-tycoon/component"
|
|
"code.rocketnine.space/tslocum/hot-cocoa-tycoon/world"
|
|
"github.com/hajimehoshi/ebiten/v2"
|
|
"github.com/hajimehoshi/ebiten/v2/ebitenutil"
|
|
)
|
|
|
|
type UISystem struct {
|
|
*component.Once
|
|
}
|
|
|
|
func (U *UISystem) Update(e gohan.Entity) error {
|
|
return etk.Update()
|
|
}
|
|
|
|
func (U *UISystem) Draw(e gohan.Entity, screen *ebiten.Image) error {
|
|
err := etk.Draw(screen)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
if world.Debug != 0 {
|
|
ebitenutil.DebugPrintAt(screen, fmt.Sprintf("ENT %d\nUPD %d\nDRA %d\nTPS %0.0f\nFPS %0.0f", gohan.CurrentEntities(), gohan.CurrentUpdates(), gohan.CurrentDraws(), ebiten.ActualTPS(), ebiten.ActualFPS()), 2, 0)
|
|
}
|
|
return nil
|
|
}
|