remove controller layer

This commit is contained in:
2023-06-28 15:41:06 +02:00
parent b688fb85d3
commit 17b2aab4fa
6 changed files with 25 additions and 34 deletions

6
Makefile Normal file
View File

@@ -0,0 +1,6 @@
dev:
go run main.go
build:
echo "install"
install:
echo "install"

View File

@@ -1,11 +0,0 @@
package controller
import "game/domain"
type Controller struct {
Context domain.Context
}
func (c Controller) Init() {
}

View File

@@ -13,12 +13,21 @@ type GameField struct {
LevelSection LevelSection
}
type Position struct {
X int
Y int
}
type Context struct {
Player Player
User User
GameField GameField
CurrentGameField GameField
CurrentPosition Position
}
func CreateContext() Context {
return Context{}
return Context{
Player: Player{},
User: User{},
}
}

View File

@@ -1,21 +1,15 @@
package domain
type ControllerInterface interface {
Init()
}
type PresenterInterface interface {
Init()
}
type Domain struct {
Context Context
Controller ControllerInterface
Presenter PresenterInterface
}
func (d Domain) Init() {
d.Controller.Init()
d.Presenter.Init()
menu_manager := MenuManager{}
menu_manager.Init()

View File

@@ -1,7 +1,6 @@
package domain
type Screen struct {
Controller ControllerInterface
}
type ScreenManager struct {

12
main.go
View File

@@ -1,7 +1,6 @@
package main
import (
"game/controller"
"game/domain"
"game/presenter"
)
@@ -9,16 +8,11 @@ import (
func main() {
context := domain.CreateContext()
controller := controller.Controller{
Context: context,
}
presenter := presenter.Presenter{
Context: context,
}
domain := domain.Domain{
Context: context,
Controller: controller,
Presenter: presenter,
Presenter: presenter.Presenter{
Context: context,
},
}
domain.Init()
}