screen2

package
v0.0.0-...-5a9de04 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2021 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AddrSpriteAttrs = 0x1b00
	AddrColorTable1 = 0x2000
	AddrSpriteGen   = 0x3800
)

Screen 2 VRAM addresses

View Source
const (
	PixelsWidth  = 256
	PixelsHeight = 192
)

screen size

View Source
const (
	// number of patterns per tile
	TilePatterns = 8
	// number of tiles for the each pattern name table
	TableTiles = 256
)

Variables

View Source
var InversePalette = map[img.RGB]uint8{

	0x010101: 1,
	0x3eb849: 2,
	0x74d07d: 3,
	0x5955e0: 4,
	0x8076f1: 5,
	0xb95e51: 6,
	0x65dbef: 7,
	0xdb6559: 8,
	0xff897d: 9,
	0xccc35e: 10,
	0xded087: 11,
	0x3aa241: 12,
	0xb766b5: 13,
	0xcccccc: 14,
	0xffffff: 15,
}
View Source
var Palette = color.Palette{
	img.RGB(0x000000),
	img.RGB(0x010101),
	img.RGB(0x3eb849),
	img.RGB(0x74d07d),
	img.RGB(0x5955e0),
	img.RGB(0x8076f1),
	img.RGB(0xb95e51),
	img.RGB(0x65dbef),
	img.RGB(0xdb6559),
	img.RGB(0xff897d),
	img.RGB(0xccc35e),
	img.RGB(0xded087),
	img.RGB(0x3aa241),
	img.RGB(0xb766b5),
	img.RGB(0xcccccc),
	img.RGB(0xffffff),
}

Functions

func ToRGB

func ToRGB(c color.Color) img.RGB

Types

type Pattern

type Pattern struct {
	// Bitmap where each bit represents a pixel
	Bitmap uint8
	// Color in :
	// bits 3-0: Background color
	// bits 7-4: Foreground color
	Color uint8
}

Pattern represent the 8-pixel line of a tile

func Sample

func Sample(bitmap image.Image, x, y int) Pattern

type Tile

type Tile [TilePatterns]Pattern

Tile is formed by 8 patterns, representing an 8x8 pixels tile

Jump to

Keyboard shortcuts

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