func (g *Game) getKeys() *KeyEventMap {
	stuff := screenData[g.state].Keys
	if g.state == gameStateHardPaused {
		stuff = screenData[g.lastState].Keys
	}
	return &stuff
}
Gets the current active key map.
package main
import (
	"time"
)
type Game struct {
	ui           *UIHandler
	input        *InputHandler
	players      *Players
	activeEvents *[]Event
	keyDisp      chan StateEvent
	ticker       *time.Ticker
	state        GameState
	lastState    GameState
	started      bool
	aiActive     bool
}
type GameSettings struct {
	BgHidden bool
}
func CreateGame(options *GameSettings) (*Game, error) {
	g := Game{}
	if err := g.Init(options); err != nil {
		return nil, err
	}
	return &g, nil
}
func (g *Game) Init(optns *GameSettings) error {
	var err error
	defer func() {
		if err != nil {
			g.End()
		}
	}()
	if g.ui, err = NewUIHandler(optns.BgHidden); err != nil {
		return err
	}
	if g.input, err = NewInputHandler(g.getKeys); err != nil {
		return err
	}
	w, h := g.ui.screen.Size()
	g.players = newPlayers(w, h, padding)
	g.activeEvents = new([]Event)
	g.keyDisp = make(chan StateEvent)
	g.ticker = time.NewTicker(1000000 / framerate * time.Microsecond)
	g.state = gameStateStarting
	return nil
}
func (g *Game) Loop() {
	defer g.End()
	go g.input.Listen(g.keyDisp)
	g.SetState(gameStateMainMenu)
	for g.state != gameStateEnding && g.state != gameStateEnded {
		select {
		case <-g.ticker.C:
			g.drawGUI()
			g.updateTerminal()
		case e := <-g.keyDisp:
			g.dispatchEvent(e)
		}
	}
}
func (g *Game) EndLoop() {
	g.SetState(gameStateEnding)
}
func (g *Game) Start() {
	if !g.started {
		g.ui.ball.Reset()
		g.SetState(gameStateInGame)
		g.started = true
	}
}
func (g *Game) End() {
	g.ui.Destroy()
}
func (g *Game) Reset() {
	g.ui.ball.Reset()
	for _, p := range g.players.GetAll() {
		p.Reset()
	}
}
func (g *Game) SetState(s GameState) {
	g.lastState = g.state
	g.state = s
}
func (g *Game) __tpause(state GameState) {
	if !g.started && state == gameStatePaused {
		return
	}
	if g.state == state {
		g.SetState(g.lastState)
	} else {
		g.SetState(state)
	}
}
func (g *Game) togglePause() {
	g.__tpause(gameStatePaused)
}
func (g *Game) toggleHardPause() {
	g.__tpause(gameStateHardPaused)
}
func (g *Game) switchTheme() {
	g.ui.theme.Switch()
}
func (g *Game) toggleBackground() {
	g.ui.theme.ToggleBg()
}
func (g *Game) toggleAI() {
	g.aiActive = !g.aiActive
}