remove unused EngineInterface
This commit is contained in:
@@ -1,31 +1,6 @@
|
||||
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 {
|
||||
Engine EngineInterface
|
||||
Domain DomainInterface
|
||||
KContext KContext
|
||||
Settings Settings
|
||||
|
||||
@@ -6,16 +6,16 @@ import (
|
||||
|
||||
type Konstructor struct {
|
||||
Domain entity.DomainInterface
|
||||
Settings entity.Settings
|
||||
KContext *entity.KContext
|
||||
Settings entity.Settings
|
||||
EngineWrapper entity.EngineWrapperInterface
|
||||
}
|
||||
|
||||
func (k Konstructor) Init() {
|
||||
k.Domain.Init()
|
||||
k.EngineWrapper.Init(entity.EngineOptions{
|
||||
KContext: *k.KContext,
|
||||
Domain: k.Domain,
|
||||
KContext: *k.KContext,
|
||||
Settings: k.Settings,
|
||||
})
|
||||
k.EngineWrapper.Run()
|
||||
|
||||
51
main.go
51
main.go
@@ -10,34 +10,8 @@ import (
|
||||
)
|
||||
|
||||
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{
|
||||
EngineWrapper: &engine.EngineWrapper{},
|
||||
KContext: &entity.KContext{
|
||||
Screen: entity.KContextScreen{
|
||||
Type: "menu",
|
||||
Value: "MainMenu",
|
||||
},
|
||||
CurrentLevel: 0,
|
||||
},
|
||||
Domain: &domain.Domain{
|
||||
Context: domain.Context{
|
||||
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()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user