Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/ranchblt/statemanager

Simple statemanager for ebiten games
https://github.com/ranchblt/statemanager

Last synced: 8 days ago
JSON representation

Simple statemanager for ebiten games

Awesome Lists containing this project

README

        

# StateManager [![GoDoc](https://godoc.org/github.com/ranchblt/statemanager?status.svg)](https://godoc.org/github.com/ranchblt/statemanager) [![Go Report Card](https://goreportcard.com/badge/github.com/ranchblt/statemanager)](https://goreportcard.com/report/github.com/ranchblt/statemanager)
StateManager is simple state management for ebiten games

## Documentation

Read [GoDoc](https://godoc.org/github.com/ranchblt/statemanager)

## Usage
```Go
stateManager := New()
stateManager.Add(menuState)
stateManager.SetActive(menuState.ID())

// Main game loop function
func GameLoop(screen *ebiten.Image) error {
if err := stateManager.Update(); err != nil {
return err
}

if ebiten.IsRunningSlowly() {
return nil
}

if err := stateManager.Draw(screen); err != nil {
return err
}
}
```

## License
[MIT License](LICENSE)