package draw

import (
	"tetris/engine/render"
	"tetris/game/draw/grid"

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

const (
	// Border width when drawing frames
	BORDER_WIDTH = 8

	// Size for normal text
	TEXT_SIZE = 32

	// Text size for header texts
	HEADER_TEXT_SIZE = 16
)

type Renderer struct {
	Theme *Theme
}

func (r Renderer) DrawText(x int32, y int32, text string) {
	render.DrawText(x, y, TEXT_SIZE, text, r.Theme.Text)
}

func (r Renderer) DrawHeaderText(x int32, y int32, text string) {
	render.DrawText(x, y, HEADER_TEXT_SIZE, text, r.Theme.TextHeader)
}

func (r Renderer) DrawFrame(rect rl.RectangleInt32) {
	render.DrawRectBorder(rect, r.Theme.FrameBG, BORDER_WIDTH, r.Theme.FrameBorder)
}

func (r Renderer) DrawGrid(pos rl.Vector2, g grid.Grid) {
	grid.DrawBackground(pos, g, r.Theme.GridBackground, BORDER_WIDTH, r.Theme.FrameBorder)
	grid.Draw(pos, g)
}
