Documentation ¶
Index ¶
- Variables
- type Animation
- type AssetStore
- func (a *AssetStore) Animation(groupIdx int, recId int, compass int) (*Animation, error)
- func (a *AssetStore) AnimationsIndex() (*idx.Idx, error)
- func (a *AssetStore) AnimationsObject() (*Object, error)
- func (a *AssetStore) CharacterAnimation(ctype data.CharacterType, action data.AnimAction, compass int) (*Animation, error)
- func (a *AssetStore) Cursor(name CursorName) (*Cursor, error)
- func (a *AssetStore) DefaultOptions() (*config.Options, error)
- func (a *AssetStore) Font(name string) (*Font, error)
- func (a *AssetStore) Generic() (*data.Generic, error)
- func (a *AssetStore) HasAction() (*data.HasAction, error)
- func (a *AssetStore) Image(name string) (*ebiten.Image, error)
- func (a *AssetStore) Map(name string) (*Map, error)
- func (a *AssetStore) Menu(name string) (*Menu, error)
- func (a *AssetStore) Object(name string) (*Object, error)
- func (a *AssetStore) ObjectByPath(path string) (*Object, error)
- func (a *AssetStore) Refresh() error
- func (a *AssetStore) Set(name string) (*Set, error)
- func (a *AssetStore) Sound(name string) (*Sound, error)
- type Cursor
- type CursorName
- type Font
- type Map
- type Menu
- type Object
- type Set
- type Sound
- type Sprite
Constants ¶
This section is empty.
Variables ¶
var (
ErrOutOfBounds = errors.New("Out of bounds")
)
Functions ¶
This section is empty.
Types ¶
type AssetStore ¶
type AssetStore struct { RootDir string Palette color.Palette // contains filtered or unexported fields }
type AssetStore is responsible for lazily loading game data when it is required. Applications shouldn't need to do anything except set one of these up, pointing at the game dir root, to access all assets for that game.
Assets should be loaded on-demand to keep memory costs as low as possible. Cross-platform differences such as filename case sensitivity are also dealt with here.
We assume the directory is read-only. You can run Refresh() if you make a change.
To mix assets from different games, either construct a synthetic directory or instantiate two separate asset stores.
func (*AssetStore) AnimationsIndex ¶
func (a *AssetStore) AnimationsIndex() (*idx.Idx, error)
func (*AssetStore) AnimationsObject ¶
func (a *AssetStore) AnimationsObject() (*Object, error)
func (*AssetStore) CharacterAnimation ¶
func (a *AssetStore) CharacterAnimation(ctype data.CharacterType, action data.AnimAction, compass int) (*Animation, error)
func (*AssetStore) Cursor ¶
func (a *AssetStore) Cursor(name CursorName) (*Cursor, error)
func (*AssetStore) DefaultOptions ¶
func (a *AssetStore) DefaultOptions() (*config.Options, error)
func (*AssetStore) Generic ¶
func (a *AssetStore) Generic() (*data.Generic, error)
Generic returns a struct containing a grab-bag of otherwise-unrelated data TODO: it would be nice if this could be cleaner
func (*AssetStore) Image ¶
func (a *AssetStore) Image(name string) (*ebiten.Image, error)
func (*AssetStore) Map ¶
func (a *AssetStore) Map(name string) (*Map, error)
Map loads a game map with the given name (e.g. "Chapter01")
func (*AssetStore) ObjectByPath ¶
func (a *AssetStore) ObjectByPath(path string) (*Object, error)
FIXME: Objects loaded by path are not cached
func (*AssetStore) Refresh ¶
func (a *AssetStore) Refresh() error
type CursorName ¶
type CursorName int
These are just offsets into the Cursors.cur file
const ( UltPointer CursorName = 0 ChaosPointer CursorName = 1 UltWaiter CursorName = 2 ChaosWaiter CursorName = 3 // I think these cursors are used in drag + drop ChaosMarine1 CursorName = 4 ChaosMarine2 CursorName = 5 ChaosMarine3 CursorName = 6 UltMarine1 CursorName = 7 UltMarine2 CursorName = 8 UltMarine3 CursorName = 9 UltMarine4 CursorName = 10 UltMarine5 CursorName = 11 ChaosHeavy1 CursorName = 12 ChaosHeavy2 CursorName = 13 UltHeavy1 CursorName = 14 UltHeavy2 CursorName = 15 UltHeavy3 CursorName = 16 UltHeavy4 CursorName = 17 UltHeavy5 CursorName = 18 UltHeavy6 CursorName = 19 ChaosTerminator1 CursorName = 20 ChaosTerminator2 CursorName = 21 UltTerminator1 CursorName = 22 UltTerminator2 CursorName = 23 UltTerminator3 CursorName = 24 UltTerminator4 CursorName = 25 UltTerminator5 CursorName = 26 Deny CursorName = 27 // Red X UltLogo CursorName = 28 UltSquadMarine CursorName = 29 UltSquadHeavy CursorName = 30 UltSquadAssault CursorName = 31 UltCaptain CursorName = 32 UltChaplain CursorName = 33 // (maybe?) UltApothecary CursorName = 34 UltTechmarine CursorName = 35 UltLibrarian CursorName = 36 DenyAgain CursorName = 37 // Identical to Deny as far as I can see *shrug* )
type Font ¶
type Font struct { Name string // contains filtered or unexported fields }
func (*Font) CalculateBounds ¶
CalculateBounds tries to work out what sort of size the string will be when rendered
type Map ¶
func (*Map) LoadSprites ¶
type Object ¶
func (*Object) LoadSprites ¶
Loads all sprites in the object eagerly