Documentation ¶
Overview ¶
Package common contains basic structures for use in engine backends.
Index ¶
Constants ¶
const AssetSignature = "Ardent"
AssetSignature is the signature prepended to all Ardent asset files.
Variables ¶
var ErrInvalidFiletype = errors.New("invalid filetype")
ErrInvalidFiletype occurs when an asset file is of an invalid type.
Functions ¶
This section is empty.
Types ¶
type Asset ¶
type Asset struct { Img Image AtlasMap map[string]AtlasRegion AnimationMap map[string]Animation AnimWidth uint16 AnimHeight uint16 Snd Sound Type AssetType }
Asset is a basic implementation of engine.Asset.
type AtlasRegion ¶
type AtlasRegion struct {
X, Y, W, H uint16
}
AtlasRegion describes a region of an Atlas.
type Camera ¶
Camera is a basic implementation of engine.Camera.
type Collider ¶
type Collider struct {
// contains filtered or unexported fields
}
Collider is a basic implementation of engine.Collider.
func (*Collider) SetTilemap ¶
SetTilemap sets the Collider's Tilemap.
type Image ¶
Image is a wrapper around image.Image that serializes as a PNG.
func (Image) MarshalBinary ¶
MarshalBinary marshals the image as a PNG or just a null byte if there's no image.
func (*Image) UnmarshalBinary ¶
UnmarshalBinary sets the image's content to nil if it's a null byte or the decoded PNG.
type InvalidAssetType ¶
type InvalidAssetType AssetType
InvalidAssetType occurs when an invalid AssetType value is encountered.
type Sound ¶
type Sound struct { // Group is the control group // the Sound belongs to. Group string // Options are the different audio // tracks that may represent the same sound. // A random option will be selected each time // the sound is played. Options [][]byte }
Sound is a collection of audio data
type Tilemap ¶
type Tilemap struct { Width int Data [2][][]int Mapper map[int]engine.Image OverlapEvent engine.TileOverlapEvent }
Tilemap is a basic implementation of engine.Tilemap.
func (*Tilemap) GetTileValue ¶
GetTileValue returns the value associated with a tile.
func (*Tilemap) IndexToIso ¶
IndexToIso converts a tile index to isometric coordinates.