engine layer
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
package konstructor
|
package engine
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package konstructor
|
package engine
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"game/konstructor/entity"
|
"game/konstructor/entity"
|
||||||
@@ -8,7 +8,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type Engine struct {
|
type Engine struct {
|
||||||
Domain DomainInterface
|
Domain entity.DomainInterface
|
||||||
Controller *Controller
|
Controller *Controller
|
||||||
Settings *entity.Settings
|
Settings *entity.Settings
|
||||||
KContext *entity.KContext
|
KContext *entity.KContext
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package konstructor
|
package engine
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package konstructor
|
package engine
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/hajimehoshi/ebiten"
|
"github.com/hajimehoshi/ebiten"
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package konstructor
|
package engine
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/hajimehoshi/ebiten"
|
"github.com/hajimehoshi/ebiten"
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package konstructor
|
package engine
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/hajimehoshi/ebiten"
|
"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
|
package konstructor
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"game/konstructor/engine"
|
||||||
"game/konstructor/entity"
|
"game/konstructor/entity"
|
||||||
|
|
||||||
"github.com/hajimehoshi/ebiten"
|
"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 {
|
type Konstructor struct {
|
||||||
Domain DomainInterface
|
Domain entity.DomainInterface
|
||||||
Controller *Controller
|
Controller *engine.Controller
|
||||||
Settings *entity.Settings
|
Settings *entity.Settings
|
||||||
KContext *entity.KContext
|
KContext *entity.KContext
|
||||||
}
|
}
|
||||||
@@ -37,7 +26,7 @@ func (k Konstructor) SetWindow() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (k Konstructor) Run() {
|
func (k Konstructor) Run() {
|
||||||
ebiten.RunGame(&Engine{
|
ebiten.RunGame(&engine.Engine{
|
||||||
KContext: k.KContext,
|
KContext: k.KContext,
|
||||||
Domain: k.Domain,
|
Domain: k.Domain,
|
||||||
Controller: k.Controller,
|
Controller: k.Controller,
|
||||||
|
|||||||
3
main.go
3
main.go
@@ -3,6 +3,7 @@ package main
|
|||||||
import (
|
import (
|
||||||
"game/domain"
|
"game/domain"
|
||||||
"game/konstructor"
|
"game/konstructor"
|
||||||
|
"game/konstructor/engine"
|
||||||
"game/konstructor/entity"
|
"game/konstructor/entity"
|
||||||
|
|
||||||
"github.com/hajimehoshi/ebiten"
|
"github.com/hajimehoshi/ebiten"
|
||||||
@@ -27,7 +28,7 @@ func main() {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Controller: &konstructor.Controller{
|
Controller: &engine.Controller{
|
||||||
KeyMap: entity.KeyMap{
|
KeyMap: entity.KeyMap{
|
||||||
Up: ebiten.KeyUp,
|
Up: ebiten.KeyUp,
|
||||||
Down: ebiten.KeyDown,
|
Down: ebiten.KeyDown,
|
||||||
|
|||||||
Reference in New Issue
Block a user