config

package
v0.0.0-...-aabedf8 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BoardConfig

type BoardConfig struct {
	Height          int
	Width           int
	EmptyTileSymbol string
}

type Config

type Config struct {
	ScoreToWin       int `toml:"ScoreToWin"`
	TimePerFrameInMs int

	Board *BoardConfig `toml:"board"`
	Snake *SnakeConfig `toml:"snake"`
	Food  *FoodConfig  `toml:"food"`

	ActionToKeyMap *Keyboard `toml:"keyboard"`
	KeyToActionMap map[string]string
}

func NewConfig

func NewConfig(filePath string) *Config

NewConfig - parses the user-provided config file if not possible returns a default config

type FoodConfig

type FoodConfig struct {
	Color  string
	Symbol string

	X int
	Y int
}

type Keyboard

type Keyboard struct {
	Up    string
	Left  string
	Down  string
	Right string

	Quit string
}

type SnakeConfig

type SnakeConfig struct {
	HeadColor  string
	HeadSymbol string

	BodyColor  string
	BodySymbol string

	X int
	Y int

	MovementDirection string
}

Jump to

Keyboard shortcuts

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