displayer

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package displayer provides a simple implementation for viewing a Tetris game

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewBlockImg

func NewBlockImg(color color.Color) image.Image

NewBlockImg creates a new block for given color

Types

type BlockImg

type BlockImg struct {
	Color color.Color
}

BlockImg block with given color

func (*BlockImg) At

func (t *BlockImg) At(x, y int) color.Color

At implementation of image.Image

func (*BlockImg) Bounds

func (t *BlockImg) Bounds() image.Rectangle

Bounds implementation of image.Image

func (*BlockImg) ColorModel

func (t *BlockImg) ColorModel() color.Model

ColorModel implementation of image.Image

type Displayer

type Displayer interface {
	Render(game.Game) game.Action
	WindowClosed() bool
}

Displayer displayer of the game

func NewDisplayer

func NewDisplayer() (Displayer, error)

NewDisplayer creates a new game displayer

type GameDisplayer

type GameDisplayer struct {
	Window       *pixelgl.Window
	SpriteActive *pixel.Sprite
}

GameDisplayer implementation of the game displayer

func (*GameDisplayer) Render

func (g *GameDisplayer) Render(tetris game.Game) game.Action

Render displays the current game for the given window

func (*GameDisplayer) WindowClosed

func (g *GameDisplayer) WindowClosed() bool

WindowClosed reports if window is closed

Jump to

Keyboard shortcuts

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