snake

package module
v0.0.0-...-d795d49 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2021 License: MIT Imports: 5 Imported by: 0

README

gopher-snake

A snake game written in Go.

Documentation

Index

Constants

View Source
const ScreenHeight = 240
View Source
const ScreenWidth = 320

Variables

This section is empty.

Functions

This section is empty.

Types

type Game

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

func NewGame

func NewGame() Game

func (*Game) Draw

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

Draw draws the game screen. The given argument represents a screen image.

func (*Game) Layout

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

Layout accepts a native outside size in device-independent pixels and returns the game's logical screen size. On desktops, the outside is a window or a monitor (fullscreen mode)

Even though the outside size and the screen size differ, the rendering scale is automatically adjusted to fit with the outside.

You can return a fixed screen size if you don't care, or you can also return a calculated screen size adjusted with the given outside size.

func (*Game) Update

func (g *Game) Update() error

Update updates a game by one tick.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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