merge controller to engine

This commit is contained in:
2023-07-04 23:48:00 +02:00
parent 374f7a9acc
commit 6041c26eaa
6 changed files with 51 additions and 59 deletions

View File

@@ -9,9 +9,10 @@ import (
type Engine struct {
Domain entity.DomainInterface
Controller *Controller
Settings *entity.Settings
KContext *entity.KContext
KeyMap entity.KeyMap
PressedKey ebiten.Key
}
func (e *Engine) Layout(outsideWidth, outsideHeight int) (int, int) {
@@ -23,7 +24,7 @@ func (e *Engine) ScreenTypeIs(name string) bool {
}
func (e *Engine) Update(screen *ebiten.Image) error {
e.Controller.Watch()
e.WatchKeyPress()
if e.ScreenTypeIs("menu") {
e.MenuUpdate()
}
@@ -46,8 +47,8 @@ func (e *Engine) Draw(screen *ebiten.Image) {
if e.ScreenTypeIs("playground") {
e.PlaygroundDraw(screen)
}
if e.Controller.Action3Pressed() {
if e.Action3Pressed() {
os.Exit(1)
}
e.Controller.Clear()
e.ClearKeyPresed()
}