package lib import ( "github.com/hajimehoshi/ebiten/v2" "github.com/hajimehoshi/ebiten/v2/ebitenutil" ) // Scenes: Main Menu // Game Mode type GameEvent struct { Type int } type HandleResult int const ( EventNoOp int = iota EventKeyRelease ) const ( DoNothing HandleResult = iota EndProgram ) // Scene is the highest level organization unit of a Game. It handles events. // A game has a currently active scene, and can transition type Scene interface { // Handles a game event and returns a result. HandleEvent(*GameEvent) HandleResult Draw(screen *ebiten.Image) } type MainMenuScene struct { selections [1]string currentSelectionIndex int } func (menu *MainMenuScene) HandleEvent(e *GameEvent) HandleResult { if e.Type == 1 { if menu.selections[menu.currentSelectionIndex] == "Quit" { return EndProgram } } return DoNothing } func (menu *MainMenuScene) Draw(screen *ebiten.Image) { ebitenutil.DebugPrint(screen, menu.selections[menu.currentSelectionIndex]) }