Documentation
¶
Overview ¶
Package d2animdata provides a file parser for AnimData files. AnimData files have the '.d2' file extension, but we do not call this package `d2d2` because multiple file types share this extension, and because the project namespace prefix makes it sound terrible.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AnimationData ¶
type AnimationData struct {
// contains filtered or unexported fields
}
AnimationData is a representation of the binary data from `data/global/AnimData.d2`
func Load ¶
func Load(data []byte) (*AnimationData, error)
Load loads the data into an AnimationData struct
func (*AnimationData) GetRecord ¶
func (ad *AnimationData) GetRecord(name string) *AnimationDataRecord
GetRecord returns a single AnimationDataRecord with the given name string. If there is more than one record with the given name string, the last record entry will be returned.
func (*AnimationData) GetRecordNames ¶
func (ad *AnimationData) GetRecordNames() []string
GetRecordNames returns a slice of all record name strings
func (*AnimationData) GetRecords ¶
func (ad *AnimationData) GetRecords(name string) []*AnimationDataRecord
GetRecords returns all records that have the given name string. The AnimData.d2 files have multiple records with the same name, but other values in the record are different.
type AnimationDataRecord ¶
type AnimationDataRecord struct {
// contains filtered or unexported fields
}
AnimationDataRecord represents a single record from the AnimData.d2 file
func (*AnimationDataRecord) FPS ¶
func (r *AnimationDataRecord) FPS() float64
FPS returns the frames per second for this animation record
func (*AnimationDataRecord) FrameDurationMS ¶
func (r *AnimationDataRecord) FrameDurationMS() float64
FrameDurationMS returns the duration in milliseconds that a frame is displayed
type AnimationEvent ¶
type AnimationEvent byte
AnimationEvent represents an event that can happen on a frame of animation
const ( AnimationEventNone AnimationEvent = iota AnimationEventAttack AnimationEventMissile AnimationEventSound AnimationEventSkill )
Animation events