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()

51
main.go
View File

@@ -10,34 +10,8 @@ import (
) )
func main() { func main() {
s := entity.Settings{
Name: "Game",
Screen: &entity.ScreenSettings{
Width: 640,
Height: 480,
},
KeyMap: entity.KeyMap{
Up: ebiten.KeyUp,
Down: ebiten.KeyDown,
Right: ebiten.KeyRight,
Left: ebiten.KeyLeft,
Action0: ebiten.KeySpace,
Action1: ebiten.KeyAlt,
Action2: ebiten.KeyControl,
Action3: ebiten.KeyEscape,
},
}
k := konstructor.Konstructor{ k := konstructor.Konstructor{
EngineWrapper: &engine.EngineWrapper{}, EngineWrapper: &engine.EngineWrapper{},
KContext: &entity.KContext{
Screen: entity.KContextScreen{
Type: "menu",
Value: "MainMenu",
},
CurrentLevel: 0,
},
Domain: &domain.Domain{ Domain: &domain.Domain{
Context: domain.Context{ Context: domain.Context{
PlayerState: domain.PlayerState{ PlayerState: domain.PlayerState{
@@ -48,7 +22,30 @@ func main() {
}, },
}, },
}, },
Settings: s, KContext: &entity.KContext{
Screen: entity.KContextScreen{
Type: "menu",
Value: "MainMenu",
},
CurrentLevel: 0,
},
Settings: entity.Settings{
Name: "Game",
Screen: &entity.ScreenSettings{
Width: 640,
Height: 480,
},
KeyMap: entity.KeyMap{
Up: ebiten.KeyUp,
Down: ebiten.KeyDown,
Right: ebiten.KeyRight,
Left: ebiten.KeyLeft,
Action0: ebiten.KeySpace,
Action1: ebiten.KeyAlt,
Action2: ebiten.KeyControl,
Action3: ebiten.KeyEscape,
},
},
} }
k.Init() k.Init()
} }