Files
gorpg/domain/menu.go
2023-07-05 21:33:59 +02:00

99 lines
1.7 KiB
Go

package domain
import (
"fmt"
"game/konstructor/entity"
"image/color"
"os"
)
func (d *Domain) InitMenu() {
d.MenuMap = entity.MenuMap{
"MainMenu": {
CurrentSelected: 0,
Layout: entity.MenuLayout{
MenuItemFont: entity.FontLayout{
DPI: 72,
Size: 24,
Color: color.White,
SelectedColor: color.RGBA{R: 0, G: 255, B: 0, A: 100},
},
},
MenuItems: []entity.MenuItem{
{
ID: "start",
Label: "Start Game",
Handler: d.StartGame,
},
{
ID: "load",
Label: "Load Game",
Handler: d.LoadtGame,
},
{
ID: "exit",
Label: "Exit Game",
Handler: d.ExitGame,
},
},
},
"GameMenu": {
CurrentSelected: 0,
Layout: entity.MenuLayout{
MenuItemFont: entity.FontLayout{
DPI: 72,
Size: 24,
Color: color.White,
SelectedColor: color.RGBA{R: 0, G: 255, B: 0, A: 100},
},
},
MenuItems: []entity.MenuItem{
{
ID: "save",
Label: "Save Game",
Handler: d.SaveGame,
},
{
ID: "close",
Label: "Close Game",
Handler: d.CloseGame,
},
},
},
}
}
func (d *Domain) GetMenuMap() entity.MenuMap {
return d.MenuMap
}
func (d *Domain) GetMenu(name string) entity.Menu {
value, _ := d.MenuMap[name]
return value
}
func (d *Domain) SetMenu(name string, menu entity.Menu) {
d.MenuMap[name] = menu
}
func (d *Domain) CloseGame() {
fmt.Println("Close game")
}
func (d *Domain) LoadtGame() {
fmt.Println("Load game")
}
func (d *Domain) SaveGame() {
fmt.Println("Save game")
}
func (d *Domain) StartGame() {
fmt.Println("Start game")
}
func (d *Domain) ExitGame() {
fmt.Println("Exit game")
os.Exit(1)
}