ichigo/engine/debug.go

22 lines
469 B
Go
Raw Normal View History

2021-07-23 13:12:54 +10:00
package engine
import (
"fmt"
2021-07-23 17:05:05 +10:00
"math"
2021-07-23 13:12:54 +10:00
"github.com/hajimehoshi/ebiten/v2"
"github.com/hajimehoshi/ebiten/v2/ebitenutil"
)
2021-07-25 15:03:10 +10:00
// PerfDisplay debugprints CurrentTPS and CurrentFPS in the top left.
type PerfDisplay struct{}
2021-07-23 13:12:54 +10:00
2021-07-25 15:03:10 +10:00
func (PerfDisplay) Draw(screen *ebiten.Image) {
ebitenutil.DebugPrint(screen, fmt.Sprintf("TPS: %0.2f FPS: %0.2f", ebiten.CurrentTPS(), ebiten.CurrentFPS()))
2021-07-23 13:12:54 +10:00
}
2021-07-23 13:46:19 +10:00
2021-07-25 15:03:10 +10:00
func (PerfDisplay) Z() float64 {
2021-07-23 17:05:05 +10:00
// Always draw on top
return math.MaxFloat64
2021-07-23 13:46:19 +10:00
}