game

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2023 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Drawable

type Drawable interface {
	Draw()
	Update()
}

type Game

type Game struct {
	Repo string

	Screen       tcell.Screen
	DefaultStyle tcell.Style
	Style        tcell.Style
	MaxWidth     int
	// contains filtered or unexported fields
}

func (*Game) AddDrawable

func (g *Game) AddDrawable(d Drawable)

func (*Game) Destroy

func (g *Game) Destroy(d Drawable)

func (*Game) Draw

func (g *Game) Draw()

func (*Game) DrawStr

func (g *Game) DrawStr(x, y int, str string, style *tcell.Style)

func (*Game) FilterGameObjects

func (g *Game) FilterGameObjects(fn func(Drawable) bool) []Drawable

func (*Game) FindGameObject

func (g *Game) FindGameObject(fn func(Drawable) bool) Drawable

func (*Game) Update

func (g *Game) Update()

type GameObject

type GameObject struct {
	X             int
	Y             int
	W             int
	H             int
	Sprite        string
	Game          *Game
	StyleOverride *tcell.Style
}

func (*GameObject) Draw

func (g *GameObject) Draw()

func (*GameObject) Point

func (g *GameObject) Point() Point

func (*GameObject) Transform

func (g *GameObject) Transform(x, y int)

func (*GameObject) Update

func (g *GameObject) Update()

type Point

type Point struct {
	X int
	Y int
}

func (Point) Equals

func (p Point) Equals(o Point) bool

func (Point) String

func (p Point) String() string

type Ray

type Ray struct {
	Points []Point
}

func NewRay

func NewRay(a Point, b Point) *Ray

func (*Ray) AddPoint

func (r *Ray) AddPoint(x, y int)

func (*Ray) Length

func (r *Ray) Length() int

Jump to

Keyboard shortcuts

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