engine layer
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
package konstructor
|
||||
package engine
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
@@ -1,4 +1,4 @@
|
||||
package konstructor
|
||||
package engine
|
||||
|
||||
import (
|
||||
"game/konstructor/entity"
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
)
|
||||
|
||||
type Engine struct {
|
||||
Domain DomainInterface
|
||||
Domain entity.DomainInterface
|
||||
Controller *Controller
|
||||
Settings *entity.Settings
|
||||
KContext *entity.KContext
|
||||
@@ -1,4 +1,4 @@
|
||||
package konstructor
|
||||
package engine
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
@@ -1,4 +1,4 @@
|
||||
package konstructor
|
||||
package engine
|
||||
|
||||
import (
|
||||
"github.com/hajimehoshi/ebiten"
|
||||
@@ -1,4 +1,4 @@
|
||||
package konstructor
|
||||
package engine
|
||||
|
||||
import (
|
||||
"github.com/hajimehoshi/ebiten"
|
||||
@@ -1,4 +1,4 @@
|
||||
package konstructor
|
||||
package engine
|
||||
|
||||
import (
|
||||
"github.com/hajimehoshi/ebiten"
|
||||
10
konstructor/entity/entity.domain.go
Normal file
10
konstructor/entity/entity.domain.go
Normal file
@@ -0,0 +1,10 @@
|
||||
package entity
|
||||
|
||||
type DomainInterface interface {
|
||||
Init()
|
||||
GetMenu(name string) Menu
|
||||
SetMenu(name string, menu Menu)
|
||||
GetDialog(name string) Dialog
|
||||
SetDialog(name string, menu Dialog)
|
||||
GetLevel(index int) Level
|
||||
}
|
||||
@@ -1,26 +1,15 @@
|
||||
package konstructor
|
||||
|
||||
import (
|
||||
"game/konstructor/engine"
|
||||
"game/konstructor/entity"
|
||||
|
||||
"github.com/hajimehoshi/ebiten"
|
||||
)
|
||||
|
||||
type ContextInterface interface {
|
||||
}
|
||||
|
||||
type DomainInterface interface {
|
||||
Init()
|
||||
GetMenu(name string) entity.Menu
|
||||
SetMenu(name string, menu entity.Menu)
|
||||
GetDialog(name string) entity.Dialog
|
||||
SetDialog(name string, menu entity.Dialog)
|
||||
GetLevel(index int) entity.Level
|
||||
}
|
||||
|
||||
type Konstructor struct {
|
||||
Domain DomainInterface
|
||||
Controller *Controller
|
||||
Domain entity.DomainInterface
|
||||
Controller *engine.Controller
|
||||
Settings *entity.Settings
|
||||
KContext *entity.KContext
|
||||
}
|
||||
@@ -37,7 +26,7 @@ func (k Konstructor) SetWindow() {
|
||||
}
|
||||
|
||||
func (k Konstructor) Run() {
|
||||
ebiten.RunGame(&Engine{
|
||||
ebiten.RunGame(&engine.Engine{
|
||||
KContext: k.KContext,
|
||||
Domain: k.Domain,
|
||||
Controller: k.Controller,
|
||||
|
||||
3
main.go
3
main.go
@@ -3,6 +3,7 @@ package main
|
||||
import (
|
||||
"game/domain"
|
||||
"game/konstructor"
|
||||
"game/konstructor/engine"
|
||||
"game/konstructor/entity"
|
||||
|
||||
"github.com/hajimehoshi/ebiten"
|
||||
@@ -27,7 +28,7 @@ func main() {
|
||||
},
|
||||
},
|
||||
},
|
||||
Controller: &konstructor.Controller{
|
||||
Controller: &engine.Controller{
|
||||
KeyMap: entity.KeyMap{
|
||||
Up: ebiten.KeyUp,
|
||||
Down: ebiten.KeyDown,
|
||||
|
||||
Reference in New Issue
Block a user