spritesheet8x8x256

package module
v0.0.0-...-802eeab Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2020 License: MIT Imports: 2 Imported by: 1

README

go-spritesheet8x8x256

Package spritesheet8x8x256 provides a type that represents a sprite sheet of 256 8×8 sprites, that seamlessly works with Go's built-in "image", "image/color", and "image/draw" packages.

Documention

Online documentation, which includes examples, can be found at: http://godoc.org/github.com/reiver/go-spritesheet8x8x256

GoDoc

Documentation

Overview

Package spritesheet8x8x256 provides a type that represents a sprite sheet of 256 8×8 sprites, that seamlessly works with Go's built-in "image", "image/color", and "image/draw" packages.

The slice- and array- indexing of the pixels / pels in each sprite is as follows:

 0  1  2  3
 4  5  6  7
 8  9 10 11
12 13 14 15

Index

Constants

View Source
const (
	Width  = 8   // The width of each sprite.
	Height = 8   // The height of each sprite.
	Length = 256 // The total number of sprites.
	Depth  = 1   // The number of types used to represent each pixel / pel in the sprite.
)
View Source
const ByteSize = Width * Height * Length * Depth

Variables

This section is empty.

Functions

This section is empty.

Types

type Palette

type Palette interface {
	color.Model
	Color(uint8) color.Color
	Index(color.Color) uint8
}

type Paletted

type Paletted struct {
	// Pix holds the pixel data, as palette indices.
	Pix []uint8

	// Palette is the color palette used to resolve the colors.
	Palette Palette

	// Sheet is the name of the sprite sheet.
	Category string
}

func (Paletted) Sprite

func (receiver Paletted) Sprite(id uint8) sprite8x8.Paletted

Jump to

Keyboard shortcuts

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