render

package
v0.0.0-...-775f653 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2021 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ASCIIEmpty     = " "
	ASCIIFood      = "*"
	ASCIISnakeHead = "H"
	ASCIISnakeBody = "O"
	ASCIISnakeTail = "T"
)
View Source
const (
	BoardSquareEmpty     = 0 // Zero State (Default)
	BoardSquareFood      = 1
	BoardSquareSnakeBody = 2
	BoardSquareSnakeHead = 3
	BoardSquareSnakeTail = 4
	BoardSquareDeadSnake = 5
)
View Source
const (
	GIFFrameDelay = 8
	GIFLoopDelay  = 200
)
View Source
const (
	BoardBorder        = 2
	BoardBorderBottom  = 15
	SquareSizePixels   = 20
	SquareBorderPixels = 1
	SquareFoodRadius   = SquareSizePixels / 3
)

Variables

This section is empty.

Functions

func GameFrameToASCII

func GameFrameToASCII(w io.Writer, g *engine.Game, gf *engine.GameFrame) error

func GameFrameToGIF

func GameFrameToGIF(w io.Writer, g *engine.Game, gf *engine.GameFrame) error

func GameFramesToAnimatedGIF

func GameFramesToAnimatedGIF(w io.Writer, g *engine.Game, gameFrames []*engine.GameFrame, frameDelay, loopDelay int) error

Types

type Board

type Board struct {
	Width   int
	Height  int
	Squares [][]BoardSquare
}

func GameFrameToBoard

func GameFrameToBoard(g *engine.Game, gf *engine.GameFrame) *Board

func NewBoard

func NewBoard(w int, h int) *Board

type BoardSquare

type BoardSquare struct {
	Content   BoardSquareContent
	HexColor  string
	SnakeType string
	Direction string
	Corner    string
}

type BoardSquareContent

type BoardSquareContent int

Directories

Path Synopsis
Package gif implements a GIF image decoder and encoder.
Package gif implements a GIF image decoder and encoder.

Jump to

Keyboard shortcuts

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