package main

import (
	"time"

	"github.com/spf13/afero"
	"opslag.de/schobers/geom"
	"opslag.de/schobers/krampus19/alui"

	"opslag.de/schobers/allg5"
	"opslag.de/schobers/fs/vfs"
)

type texture struct {
	*allg5.Bitmap

	Subs map[string]*allg5.Bitmap
}

func newTexture(bmp *allg5.Bitmap) texture {
	return texture{Bitmap: bmp, Subs: map[string]*allg5.Bitmap{}}
}

type Context struct {
	DisplaySize  geom.Point
	Resources    vfs.CopyDir
	ResourcesFs  afero.Fs
	Textures     map[string]texture
	Sprites      map[string]sprite
	Levels       *levelPacks
	Progress     progress
	SpriteDrawer SpriteDrawer
	Settings     settings
	Palette      *alui.Palette

	Tick       time.Duration
	Navigation navigation
}

func (c *Context) Destroy() {
	for _, bmp := range c.Textures {
		bmp.Destroy()
	}
}
