game

package
v0.0.0-...-06a7bdd Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// W is screen width
	W = 1280
	// H is screen height
	H = 960
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Game

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

Game implements ebiten.Game interface and stores the game state.

func NewGame

func NewGame() *Game

NewGame creates a new Game

func (*Game) Draw

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

Draw is called every frame. The frame frequency depends on the display's refresh rate, so if the display is 60 Hz, Draw will be called 60 times per second.

func (*Game) Layout

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

Layout accepts the window size on desktop as the outside size, and return's the game's internal or pixel screen size, which is then scaled up to fit in the outside size. This does more for resizeable windows.

func (*Game) Update

func (g *Game) Update(screen *ebiten.Image) error

Update function is called every tick and updates the game's logical state.

Jump to

Keyboard shortcuts

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