constructor stucture fixes
This commit is contained in:
41
constructor/constructor.go
Executable file
41
constructor/constructor.go
Executable file
@@ -0,0 +1,41 @@
|
||||
package constructor
|
||||
|
||||
import (
|
||||
"log"
|
||||
|
||||
"github.com/hajimehoshi/ebiten"
|
||||
)
|
||||
|
||||
type ContextInterface interface {
|
||||
}
|
||||
|
||||
type DomainInterface interface {
|
||||
Init()
|
||||
}
|
||||
|
||||
type ScreenSettings struct {
|
||||
Width int
|
||||
Height int
|
||||
}
|
||||
|
||||
type GameSettings struct {
|
||||
Name string
|
||||
ScreenSettings ScreenSettings
|
||||
}
|
||||
|
||||
type Constructor struct {
|
||||
Context ContextInterface
|
||||
Domain DomainInterface
|
||||
Controller Controller
|
||||
GameSettings GameSettings
|
||||
}
|
||||
|
||||
func (c Constructor) Init() {
|
||||
ebiten.SetWindowSize(c.GameSettings.ScreenSettings.Width, c.GameSettings.ScreenSettings.Height)
|
||||
ebiten.SetWindowTitle(c.GameSettings.Name)
|
||||
if err := ebiten.RunGame(&GameEngine{
|
||||
Constructor: c,
|
||||
}); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user