scene

package module
Version: v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2019 License: MIT Imports: 1 Imported by: 0

README

ebiten-scene

GoDoc License Go Report Card

A simple scene manager for ebiten.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

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.

Types

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.

Source Files

Jump to

Keyboard shortcuts

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