res

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package res provides functionality for loading resources from figure part and furni libraries.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Animation

type Animation struct {
	Id           int
	TransitionTo *Animation
	Layers       map[int]*AnimationLayer
}

type AnimationLayer

type AnimationLayer struct {
	Id             int
	LoopCount      int
	FrameRepeat    int
	Random         int
	FrameSequences []FrameSequence // A list of frame sequences.
}

type Asset

type Asset struct {
	Name   string      // The asset's name.
	Source *Asset      // The source asset.
	FlipH  bool        // Whether the asset is flipped horizontally.
	FlipV  bool        // Whether the asset is flipped vertically.
	Offset image.Point // The asset's image offset.
	Image  image.Image // The asset's image.
}

func (*Asset) SourceImage

func (asset *Asset) SourceImage() image.Image

type AssetLibrary

type AssetLibrary interface {
	Name() string
	Asset(name string) (*Asset, error)
	Assets() []string
	AssetExists(name string) bool
}

func LoadFigureLibrarySwf

func LoadFigureLibrarySwf(swf *swfx.Swf) (lib AssetLibrary, err error)

type Assets

type Assets map[string]*Asset

func (*Assets) UnmarshalBytes

func (a *Assets) UnmarshalBytes(b []byte) (err error)

type Color

type Color struct {
	Id     int
	Layers map[int]*ColorLayer
}

type ColorLayer

type ColorLayer struct {
	Id    int
	Color string
}

type Dimensions

type Dimensions struct {
	X float64
	Y float64
	Z float64
}

type FrameSequence

type FrameSequence []int

FrameSequence represents a list of frame IDs for an animation.

type FurniAssetSpec

type FurniAssetSpec struct {
	Name      string
	Size      int
	Layer     int // The layer index. A negative value represents the `sd` (shadow) layer.
	Direction int
	Frame     int // The frame index.
}

FurniAssetSpec represents an asset specifier for a furni library.

func (*FurniAssetSpec) String

func (spec *FurniAssetSpec) String() string

type FurniLibrary

type FurniLibrary interface {
	AssetLibrary
	Index() *Index
	Manifest() *Manifest
	Logic() *Logic
	Visualizations() map[int]*Visualization
}

func LoadFurniLibraryNitro

func LoadFurniLibraryNitro(archive nitro.Archive) (furniLibrary FurniLibrary, err error)

func LoadFurniLibrarySwf

func LoadFurniLibrarySwf(swf *swfx.Swf) (furniLibrary FurniLibrary, err error)

type FurniLibraryLoader

type FurniLibraryLoader interface {
	Load() (FurniLibrary, error)
}

type Index

type Index struct {
	Type          string
	Visualization string
	Logic         string
}

An Index describes the furni visualization and logic types.

func (*Index) UnmarshalBytes

func (index *Index) UnmarshalBytes(b []byte) (err error)

type Layer

type Layer struct {
	Id          int
	Z           int
	Alpha       int
	Ink         string
	IgnoreMouse bool
	Color       int
}

type LibraryManager

type LibraryManager interface {
	Library(name string) AssetLibrary
	Libraries() []string
	LibraryExists(name string) bool
	AddLibrary(AssetLibrary) bool
}

func NewManager

func NewManager() LibraryManager

type Logic

type Logic struct {
	Type            string
	Model           *Model
	ParticleSystems map[int]*ParticleSystem // Particle systems mapped by size.
}

func (*Logic) UnmarshalBytes

func (logic *Logic) UnmarshalBytes(b []byte) (err error)

type Manifest

type Manifest struct {
	Name    string
	Version string
	Assets  Assets
}

A manifest describing the library and assets contained.

func (*Manifest) Unmarshal

func (m *Manifest) Unmarshal(data []byte) (err error)

type Model

type Model struct {
	Dimensions Dimensions
	Directions []int
}

type ParticleSystem

type ParticleSystem struct {
	Size int
}

type Visualization

type Visualization struct {
	Size       int
	LayerCount int
	Angle      int
	Directions map[int]struct{} // A map of directions.
	Layers     map[int]*Layer   // Layers mapped by ID.
	Colors     map[int]*Color   // Colors mapped by ID.
	Animations map[int]*Animation
}

type VisualizationData

type VisualizationData struct {
	Type           string         // The furni type for the visualization.
	Visualizations Visualizations // A map of visualizations by size.
}

func (*VisualizationData) UnmarshalBytes

func (visualizationData *VisualizationData) UnmarshalBytes(b []byte) (err error)

type Visualizations

type Visualizations map[int]*Visualization

Jump to

Keyboard shortcuts

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