package score

import (
	"fmt"
	"image/color"

	"github.com/hajimehoshi/ebiten/v2"
	"github.com/hajimehoshi/ebiten/v2/text"
	"golang.org/x/image/font"

	//"golang.org/x/image/font/gofont/gobold"
	"src.robn.tv/MrDonuts/RGB/assets"
	geom "src.robn.tv/MrDonuts/RGB/geometry"
)

var ScoreMngr ScoreManager
var smallFace = assets.LoadFontFace("fonts/robot.otf", 12)
var bigFace = assets.LoadFontFace("fonts/robot.otf", 20)

type ScoreManager struct{}

func (sm *ScoreManager) Update() {
}

func (sm *ScoreManager) Draw(screen *ebiten.Image) {

	w, h := ebiten.WindowSize()

	levelStr := fmt.Sprintf("Level: %v", geom.CurrentLevel)

	//draw current level
	text.Draw(screen, levelStr, smallFace, geom.HighScoreOffset, h-geom.HighScoreOffset, color.White)

	//draw energy at the top
	energyStr := fmt.Sprintf("Energy: %v", geom.CurrentEnergy)
	stringWidth := font.MeasureString(bigFace, energyStr).Ceil()
	text.Draw(screen, energyStr, bigFace, w/2-stringWidth/2, geom.ScoreOffset, color.White)

}
