package handlers

import (
	"tetris/assets"
	"tetris/engine/audio"
	"tetris/engine/render"
	"tetris/game/state"

	rl "github.com/gen2brain/raylib-go/raylib"
)

type GameOver struct{}

func (GameOver) Enter() {
	audio.Play(assets.SFX_GAME_OVER)
}

func (GameOver) Exit() {
}

func (GameOver GameOver) Update(fsm state.Transitioner, delta float32) {
	if rl.IsKeyPressed(rl.KeyEnter) {
		fsm.Switch("gameplay")
	} else if rl.IsKeyPressed(rl.KeyQ) {
		fsm.Switch("menu")
	}
}

func (GameOver *GameOver) Render() {
	render.Begin(rl.Black)
	render.DrawTextCenter(340, 200, 32, "Game Over", rl.White)
	render.End()
}
