Files
gorpg/konstructor/konstructor.go
2023-07-03 15:48:01 +02:00

57 lines
894 B
Go

package konstructor
import (
"log"
"github.com/hajimehoshi/ebiten"
)
type ContextInterface interface {
}
type DomainInterface interface {
Init()
}
type ScreenSettings struct {
Width int
Height int
}
type KContextScreen struct {
Type string
Value string
}
type KContext struct {
Screen KContextScreen
}
type Settings struct {
Name string
Screen *ScreenSettings
}
type Konstructor struct {
Domain DomainInterface
Controller *Controller
Settings *Settings
KContext *KContext
MenuMap MenuMap
}
func (k Konstructor) Init() {
k.Domain.Init()
ebiten.SetWindowSize(k.Settings.Screen.Width, k.Settings.Screen.Height)
ebiten.SetWindowTitle(k.Settings.Name)
if err := ebiten.RunGame(&Engine{
MenuMap: k.MenuMap,
KContext: k.KContext,
Domain: k.Domain,
Controller: k.Controller,
Settings: k.Settings,
}); err != nil {
log.Fatal(err)
}
}