game

package
v0.0.0-...-672060c Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2024 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Canvas

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

func NewCanvas

func NewCanvas(width int, height int) *Canvas

func ReadCanvasFromFile

func ReadCanvasFromFile(path string) (*Canvas, error)

func (*Canvas) Dimensions

func (canvas *Canvas) Dimensions() (int, int)

func (*Canvas) IsInBounds

func (canvas *Canvas) IsInBounds(x int, y int) bool

func (*Canvas) Paint

func (canvas *Canvas) Paint(pixel Pixel)

func (*Canvas) ToBytes

func (canvas *Canvas) ToBytes() []byte

func (*Canvas) WriteToFile

func (canvas *Canvas) WriteToFile(path string) error

type Game

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

func NewGame

func NewGame(auth auth.Authenticator, config GameConfig) *Game

func (*Game) CanvasSavingRoutine

func (game *Game) CanvasSavingRoutine()

func (*Game) GameLoop

func (game *Game) GameLoop()

func (*Game) HandleConnection

func (game *Game) HandleConnection(w http.ResponseWriter, r *http.Request)

func (*Game) SaveCanvas

func (game *Game) SaveCanvas()

type GameConfig

type GameConfig struct {
	CanvasPath string
	Cooldown   time.Duration
	Buffer     uint64
	Width      int
	Height     int
}

type Pixel

type Pixel struct {
	Pos   [2]int   `json:"pos"`
	Color [3]uint8 `json:"color"`
}

Jump to

Keyboard shortcuts

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