d2cof

package
v0.0.0-...-7f92c57 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2021 License: GPL-3.0 Imports: 3 Imported by: 3

Documentation

Overview

Package d2cof contains the logic for loading and processing COF files.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Dir64ToCof

func Dir64ToCof(direction, numDirections int) int

Dir64ToCof returns the cof direction based on the actual direction

func Marshal

func Marshal(c *COF) []byte

Marshal a COF to a new byte slice

Types

type COF

type COF struct {
	NumberOfDirections int
	FramesPerDirection int
	NumberOfLayers     int
	Speed              int
	CofLayers          []CofLayer
	CompositeLayers    map[d2enum.CompositeType]int
	AnimationFrames    []d2enum.AnimationFrame
	Priority           [][][]d2enum.CompositeType
	// contains filtered or unexported fields
}

COF is a structure that represents a COF file.

func New

func New() *COF

New creates a new COF

func Unmarshal

func Unmarshal(data []byte) (*COF, error)

Unmarshal a byte slice to a new COF

func (*COF) Duration

func (c *COF) Duration() float64

Duration returns animation's duration

func (*COF) FPS

func (c *COF) FPS() float64

FPS returns FPS value basing on cof's speed

func (*COF) Marshal

func (c *COF) Marshal() []byte

Marshal this COF to a byte slice

func (*COF) Unmarshal

func (c *COF) Unmarshal(fileData []byte) error

Unmarshal a byte slice to this COF

type CofLayer

type CofLayer struct {
	Type        d2enum.CompositeType
	Shadow      byte
	Selectable  bool
	Transparent bool
	DrawEffect  d2enum.DrawEffect
	WeaponClass d2enum.WeaponClass
}

CofLayer is a structure that represents a single layer in a COF file.

Jump to

Keyboard shortcuts

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