ui

package
v0.0.0-...-8520766 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2022 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DrawBoard

func DrawBoard(screen *ebiten.Image, board *game.Board)

func HandleInput

func HandleInput(g *game.State) error

Types

type Dir

type Dir int

Dir represents a direction.

const (
	DirUp Dir = iota
	DirRight
	DirDown
	DirLeft
)

func (Dir) String

func (d Dir) String() string

String returns a string representing the direction.

func (Dir) Vector

func (d Dir) Vector() (x, y int)

Vector returns a [-1, 1] value for each axis.

type Game

type Game struct {
	// contains filtered or unexported fields
}

func NewGame

func NewGame() *Game

func (*Game) CanMove

func (g *Game) CanMove() bool

func (*Game) Draw

func (g *Game) Draw(screen *ebiten.Image)

func (*Game) Initialize

func (g *Game) Initialize()

func (*Game) Layout

func (g *Game) Layout(outsideWidth, outsideHeight int) (screenWidth, screenHeight int)

func (*Game) Update

func (g *Game) Update() error

type Input

type Input struct {
	// contains filtered or unexported fields
}

Input represents the current key states.

func NewInput

func NewInput() *Input

NewInput generates a new Input object.

func (*Input) Dir

func (i *Input) Dir() (Dir, bool)

Dir returns a currently pressed direction. Dir returns false if no direction key is pressed.

func (*Input) Update

func (i *Input) Update()

Update updates the current input states.

Jump to

Keyboard shortcuts

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