lbx

package
v0.0.0-...-94f88f4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 16, 2024 License: BSD-3-Clause Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const LbxSignature = 0x0000fead

Variables

This section is empty.

Functions

func GetDefaultPalette

func GetDefaultPalette() color.Palette

func GetPaletteOverrideMap

func GetPaletteOverrideMap(cache *LbxCache, lbxFile *LbxFile, filename string) (map[int]color.Palette, error)

some lbx images implicitly use a palette from a specific entry * return a mapping from lbx entry -> palette to be used for that entry, e.g. * lbx.ReadImagesWithPalette(3, overrideMap[3])

func ReadUint16

func ReadUint16(reader io.Reader) (uint16, error)

func ReadUint16Big

func ReadUint16Big(reader io.Reader) (uint16, error)

Types

type Help

type Help struct {
	Entries []HelpEntry
	// contains filtered or unexported fields
}

func (*Help) GetEntries

func (help *Help) GetEntries(entry int) []HelpEntry

func (*Help) GetEntriesByName

func (help *Help) GetEntriesByName(name string) []HelpEntry

func (*Help) GetRawEntry

func (help *Help) GetRawEntry(entry int) HelpEntry

type HelpEntry

type HelpEntry struct {
	// shows up on top of scroll
	Headline string
	// lbx file to pull an icon out, shown at top left of scroll
	Lbx string
	// index of sprite in the lbx file
	LbxIndex int
	// extra text to append
	AppendHelpIndex int
	// text displayed in scroll
	Text string
}

stuff from help.lbx

type LbxCache

type LbxCache struct {
	Base fs.FS
	// contains filtered or unexported fields
}

func AutoCache

func AutoCache() *LbxCache

func CacheFromPath

func CacheFromPath(path string) *LbxCache

func MakeLbxCache

func MakeLbxCache(base fs.FS) *LbxCache

func (*LbxCache) GetLbxFile

func (cache *LbxCache) GetLbxFile(filename string) (*LbxFile, error)

type LbxFile

type LbxFile struct {
	Signature uint32
	Version   uint16
	Data      [][]byte
	// most lbx files have an extra strings section
	Strings []string
}

func ReadLbx

func ReadLbx(reader io.ReadSeeker) (LbxFile, error)

func (*LbxFile) GetPalette

func (lbx *LbxFile) GetPalette(entry int) (color.Palette, error)

return just the palette for a given entry, or nil if there is no custom palette

func (*LbxFile) GetReader

func (lbx *LbxFile) GetReader(entry int) (*bytes.Reader, error)

func (*LbxFile) RawData

func (lbxFile *LbxFile) RawData(entry int) ([]byte, error)

func (*LbxFile) ReadHelp

func (lbx *LbxFile) ReadHelp(entry int) (Help, error)

func (*LbxFile) ReadImages

func (lbx *LbxFile) ReadImages(entry int) ([]*image.Paletted, error)

func (*LbxFile) ReadImagesWithPalette

func (lbx *LbxFile) ReadImagesWithPalette(entry int, palette color.Palette, forcePalette bool) ([]*image.Paletted, error)

a nil palette means to use the default palette

func (*LbxFile) ReadTerrainImages

func (lbx *LbxFile) ReadTerrainImages(entry int) ([]image.Image, error)

terrain.lbx has a special format that is different from regular graphics

func (*LbxFile) TotalEntries

func (lbx *LbxFile) TotalEntries() int

type PaletteInfo

type PaletteInfo struct {
	Offset          uint16
	Count           uint16
	FirstColorIndex uint16
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL