Back to godoc.org
github.com/fralonra/ebiten-scene

Package scene

v0.2.0
Latest Go to latest

The highest tagged major version is .

Published: Dec 19, 2019 | License: MIT | Module: github.com/fralonra/ebiten-scene

Index

func Set

func Set(key GameSceneKey, scene GameScene)

Set registers a GameScene with the given key.

func Switch

func Switch(key GameSceneKey)

Switch changes the current scene to the scene with the given key.

func SwitchWith

func SwitchWith(key GameSceneKey, withFunc func(GameScene))

SwitchWith changes the current scene to the scene with the given key. It also recieves a function which allows you to access the new scene.

func Update

func Update(screen *ebiten.Image) error

Update is the function called every frame by ebiten.

type GameScene

type GameScene interface {
	Draw(screen *ebiten.Image)
	Update()
	Start()
	Stop()
}

GameScene is the interface that all the game scene should implement.

Draw is the function where rendering takes place.

Update is the function where game logic updates. It is invoked before Draw.

Start is the function called every time you switch to the scene.

Stop is the function called every time you exit the scene.

func Scene

func Scene() GameScene

Scene returns the current scene.

type GameSceneKey

type GameSceneKey int

GameSceneKey represents the identifier of each scene.

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier