lbx

package
v0.0.0-...-64ed9ee Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2025 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 ReadByte

func ReadByte(reader io.Reader) (byte, error)

func ReadUint16

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

func ReadUint16Big

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

func ReadUint32

func ReadUint32(reader io.Reader) (uint32, error)

Types

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 MakeCacheFromLbxFiles

func MakeCacheFromLbxFiles(lbxFiles map[string]*LbxFile) *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) 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