Documentation ¶
Index ¶
- func GenerateRandomBerry(gameCFG *Config) pixel.Vec
- type Config
- func (cfg *Config) GetBorderWeight() float64
- func (cfg *Config) GetGameAreaAsRec() pixel.Rect
- func (cfg *Config) GetGameAreaAsVecs() (min pixel.Vec, max pixel.Vec)
- func (cfg *Config) GetGameAreaDims() (x float64, y float64)
- func (cfg *Config) GetGridMatrix() pixel.Matrix
- func (cfg *Config) GetGridSize() float64
- func (cfg *Config) GetWindowMatrix() pixel.Matrix
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateRandomBerry ¶
GenerateRandomBerry generates a new berry in a random location
Types ¶
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
Config is a struct used to define the configuration of the game
func NewGameConfig ¶
func NewGameConfig(xSize float64, ySize float64, borderWeight float64, gridSize float64, winCFG pixelgl.WindowConfig) Config
NewGameConfig returns and initialised Game Configuration Struct
func (*Config) GetBorderWeight ¶
GetBorderWeight returns the weight in pixels of the border of the game area
func (*Config) GetGameAreaAsRec ¶
GetGameAreaAsRec returns the rectangle representing the game area in it's native coordinates
func (*Config) GetGameAreaAsVecs ¶
GetGameAreaAsVecs returns the vectors representing the game area in it's native coordinates
func (*Config) GetGameAreaDims ¶
GetGameAreaDims returns the dimensions of the game area
func (*Config) GetGridMatrix ¶
GetGridMatrix returns the matrix for the game grid which is used to translate the snake coordinates onto the game area.
func (*Config) GetGridSize ¶
GetGridSize returns the pixel size of the game grid
func (*Config) GetWindowMatrix ¶
GetWindowMatrix returns the matrix for the game area which is used to translate the game area coordinates onto the window.