remove unused EngineInterface

This commit is contained in:
2023-07-05 18:45:17 +02:00
parent ad30de96d9
commit 8775464c25
3 changed files with 26 additions and 54 deletions

View File

@@ -1,31 +1,6 @@
package entity package entity
type EngineInterface interface {
ClearKeyPresed()
UpPressed() bool
DownPressed() bool
RightPressed() bool
LeftPressed() bool
Action0Pressed() bool
Action1Pressed() bool
Action2Pressed() bool
Action3Pressed() bool
ScreenTypeIs(name string) bool
Update(screen any) error
Draw(screen any)
AddToInventory(item *Item)
RemoveFromInventory(item *Item)
UseInventoryItem(item *Item)
DialogDraw(screen any)
DialogUpdate()
MenuDraw(screen any)
MenuUpdate()
PlaygroundDraw(screen any)
PlaygroundUpdate()
}
type EngineOptions struct { type EngineOptions struct {
Engine EngineInterface
Domain DomainInterface Domain DomainInterface
KContext KContext KContext KContext
Settings Settings Settings Settings

View File

@@ -6,16 +6,16 @@ import (
type Konstructor struct { type Konstructor struct {
Domain entity.DomainInterface Domain entity.DomainInterface
Settings entity.Settings
KContext *entity.KContext KContext *entity.KContext
Settings entity.Settings
EngineWrapper entity.EngineWrapperInterface EngineWrapper entity.EngineWrapperInterface
} }
func (k Konstructor) Init() { func (k Konstructor) Init() {
k.Domain.Init() k.Domain.Init()
k.EngineWrapper.Init(entity.EngineOptions{ k.EngineWrapper.Init(entity.EngineOptions{
KContext: *k.KContext,
Domain: k.Domain, Domain: k.Domain,
KContext: *k.KContext,
Settings: k.Settings, Settings: k.Settings,
}) })
k.EngineWrapper.Run() k.EngineWrapper.Run()

43
main.go
View File

@@ -10,8 +10,26 @@ import (
) )
func main() { func main() {
k := konstructor.Konstructor{
s := entity.Settings{ EngineWrapper: &engine.EngineWrapper{},
Domain: &domain.Domain{
Context: domain.Context{
PlayerState: domain.PlayerState{
Name: "Player One",
},
User: domain.User{
Name: "John Doe",
},
},
},
KContext: &entity.KContext{
Screen: entity.KContextScreen{
Type: "menu",
Value: "MainMenu",
},
CurrentLevel: 0,
},
Settings: entity.Settings{
Name: "Game", Name: "Game",
Screen: &entity.ScreenSettings{ Screen: &entity.ScreenSettings{
Width: 640, Width: 640,
@@ -27,28 +45,7 @@ func main() {
Action2: ebiten.KeyControl, Action2: ebiten.KeyControl,
Action3: ebiten.KeyEscape, Action3: ebiten.KeyEscape,
}, },
}
k := konstructor.Konstructor{
EngineWrapper: &engine.EngineWrapper{},
KContext: &entity.KContext{
Screen: entity.KContextScreen{
Type: "menu",
Value: "MainMenu",
}, },
CurrentLevel: 0,
},
Domain: &domain.Domain{
Context: domain.Context{
PlayerState: domain.PlayerState{
Name: "Player One",
},
User: domain.User{
Name: "John Doe",
},
},
},
Settings: s,
} }
k.Init() k.Init()
} }