merge entity package to konstructor
This commit is contained in:
@@ -1,16 +1,16 @@
|
||||
package engine
|
||||
|
||||
import (
|
||||
"game/konstructor/entity"
|
||||
"game/konstructor"
|
||||
"os"
|
||||
|
||||
"github.com/hajimehoshi/ebiten"
|
||||
)
|
||||
|
||||
type Engine struct {
|
||||
Domain entity.DomainInterface
|
||||
Settings *entity.Settings
|
||||
KContext *entity.KContext
|
||||
Domain konstructor.DomainInterface
|
||||
Settings *konstructor.Settings
|
||||
KContext *konstructor.KContext
|
||||
PressedKey ebiten.Key
|
||||
}
|
||||
|
||||
@@ -20,32 +20,32 @@ func (e *Engine) Layout(outsideWidth, outsideHeight int) (int, int) {
|
||||
|
||||
func (e *Engine) Update(screen *ebiten.Image) error {
|
||||
e.WatchKeyPress()
|
||||
if e.KContext.ScreenTypeIs(entity.MenuScreenType) {
|
||||
if e.KContext.ScreenTypeIs(konstructor.MenuScreenType) {
|
||||
e.MenuUpdate()
|
||||
}
|
||||
if e.KContext.ScreenTypeIs(entity.DialogScreenType) {
|
||||
if e.KContext.ScreenTypeIs(konstructor.DialogScreenType) {
|
||||
e.DialogUpdate()
|
||||
}
|
||||
if e.KContext.ScreenTypeIs(entity.PlaygroundScreenType) {
|
||||
if e.KContext.ScreenTypeIs(konstructor.PlaygroundScreenType) {
|
||||
e.PlaygroundUpdate()
|
||||
}
|
||||
if e.KContext.ScreenTypeIs(entity.InventoryScreenType) {
|
||||
if e.KContext.ScreenTypeIs(konstructor.InventoryScreenType) {
|
||||
e.InventoryUpdate()
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (e *Engine) Draw(screen *ebiten.Image) {
|
||||
if e.KContext.ScreenTypeIs(entity.MenuScreenType) {
|
||||
if e.KContext.ScreenTypeIs(konstructor.MenuScreenType) {
|
||||
e.MenuDraw(screen)
|
||||
}
|
||||
if e.KContext.ScreenTypeIs(entity.DialogScreenType) {
|
||||
if e.KContext.ScreenTypeIs(konstructor.DialogScreenType) {
|
||||
e.DialogDraw(screen)
|
||||
}
|
||||
if e.KContext.ScreenTypeIs(entity.PlaygroundScreenType) {
|
||||
if e.KContext.ScreenTypeIs(konstructor.PlaygroundScreenType) {
|
||||
e.PlaygroundDraw(screen)
|
||||
}
|
||||
if e.KContext.ScreenTypeIs(entity.InventoryScreenType) {
|
||||
if e.KContext.ScreenTypeIs(konstructor.InventoryScreenType) {
|
||||
e.InventoryDraw(screen)
|
||||
}
|
||||
if e.Action3Pressed() {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package engine
|
||||
|
||||
import (
|
||||
"game/konstructor/entity"
|
||||
"game/konstructor"
|
||||
"log"
|
||||
|
||||
_ "image/png"
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
"github.com/hajimehoshi/ebiten"
|
||||
)
|
||||
|
||||
func (e *Engine) GetImage(render_options entity.Render) *ebiten.Image {
|
||||
func (e *Engine) GetImage(render_options konstructor.Render) *ebiten.Image {
|
||||
img := render_options.GetImage()
|
||||
out, err := ebiten.NewImageFromImage(img, 0)
|
||||
if err != nil {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package engine
|
||||
|
||||
import (
|
||||
"game/konstructor/entity"
|
||||
"game/konstructor"
|
||||
|
||||
"github.com/hajimehoshi/ebiten"
|
||||
)
|
||||
@@ -10,7 +10,7 @@ type EngineWrapper struct {
|
||||
Engine Engine
|
||||
}
|
||||
|
||||
func (ew *EngineWrapper) Init(options entity.EngineArgs) {
|
||||
func (ew *EngineWrapper) Init(options konstructor.EngineArgs) {
|
||||
ew.Engine = Engine{
|
||||
KContext: options.KContext,
|
||||
Domain: options.Domain,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package engine
|
||||
|
||||
import (
|
||||
"game/konstructor/entity"
|
||||
"game/konstructor"
|
||||
|
||||
"github.com/hajimehoshi/ebiten"
|
||||
)
|
||||
@@ -12,14 +12,14 @@ func (e *Engine) InventoryUpdate() {
|
||||
func (e *Engine) InventoryDraw(screen *ebiten.Image) {
|
||||
}
|
||||
|
||||
func (e *Engine) AddToInventory(item *entity.Item) {
|
||||
func (e *Engine) AddToInventory(item *konstructor.Item) {
|
||||
e.Domain.AddToInventory(item)
|
||||
}
|
||||
|
||||
func (e *Engine) RemoveFromInventory(item *entity.Item) {
|
||||
func (e *Engine) RemoveFromInventory(item *konstructor.Item) {
|
||||
e.Domain.RemoveFromInventory(item)
|
||||
}
|
||||
|
||||
func (e *Engine) UseInventoryItem(item *entity.Item) {
|
||||
func (e *Engine) UseInventoryItem(item *konstructor.Item) {
|
||||
e.Domain.UseInventoryItem(item)
|
||||
}
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
package engine
|
||||
|
||||
import (
|
||||
"game/konstructor/entity"
|
||||
"game/konstructor"
|
||||
|
||||
"github.com/hajimehoshi/ebiten"
|
||||
)
|
||||
|
||||
func (e *Engine) PlaygroundUpdate() {
|
||||
level := e.Domain.GetLevel(e.KContext.CurrentLevel)
|
||||
e.Domain.Process(entity.DomainProcessArgs{
|
||||
e.Domain.Process(konstructor.DomainProcessArgs{
|
||||
Level: &level,
|
||||
KContext: e.KContext,
|
||||
})
|
||||
@@ -38,7 +38,7 @@ func (e *Engine) PlaygroundObjectsDraw(screen *ebiten.Image) {
|
||||
}
|
||||
}
|
||||
|
||||
func (e *Engine) GetPlayground() entity.Playground {
|
||||
func (e *Engine) GetPlayground() konstructor.Playground {
|
||||
level := e.Domain.GetLevel(e.KContext.CurrentLevel)
|
||||
return level.Playgrounds[e.KContext.CurrentPlayground]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user