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-29 17:07:38 +10:00
|
|
|
func (PerfDisplay) Draw(screen *ebiten.Image, _ ebiten.GeoM) {
|
2021-07-25 15:03:10 +10:00
|
|
|
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
|
|
|
}
|