Documentation ¶
Index ¶
- func Animate(frame, tick int, ft FrameTags) int
- func LoadFont(name string) *etxt.Font
- func LoadImage(name string) *ebiten.Image
- func LoadSoundFile(name string, sampleRate int) *vorbis.Stream
- func NewMusicPlayer(music *vorbis.Stream, context *audio.Context) *audio.Player
- func NewSoundPlayer(audioFile *vorbis.Stream, context *audio.Context) *audio.Player
- type Frame
- type FramePosition
- type FrameTags
- type Frames
- type Sound
- type Sounds
- type SpriteMeta
- type SpriteSheet
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LoadImage ¶
func LoadImage(name string) *ebiten.Image
Load an image from embedded FS into an ebiten Image object
func LoadSoundFile ¶
Load an OGG Vorbis sound file with 44100 sample rate and return its stream
func NewMusicPlayer ¶
NewMusicPlayer loads a sound into an audio player that can be used to play it as an infinite loop of music without any additional setup required
Types ¶
type Frame ¶
type Frame struct { Duration int `json:"duration"` Position FramePosition `json:"frame"` }
Frame is a single frame of an animation, usually a sub-image of a larger image containing several frames
type FramePosition ¶
FramePosition represents the position of a frame, including the top-left coordinates and its dimensions (width and height)
type FrameTags ¶
type FrameTags struct { Name string `json:"name"` From int `json:"from"` To int `json:"to"` Direction string `json:"direction"` }
FrameTags contains tag data about frames to identify different parts of an animation, e.g. idle animation, jump animation frames etc.
type Sound ¶
Sound stores and plays all the sound variants for one single soundType
type SpriteMeta ¶
SpriteMeta contains sprite meta-data, basically everything except frame data
type SpriteSheet ¶
type SpriteSheet struct { Sprite Frames `json:"frames"` Meta SpriteMeta `json:"meta"` Image *ebiten.Image }
SpriteSheet is the root-node of sprite data, it contains frames and meta data about them
func LoadSprite ¶ added in v0.3.0
func LoadSprite(name string) *SpriteSheet
Load a sprite image and associated meta-data given a file name (without extension)