pointer fixes for kcontext and settings
This commit is contained in:
@@ -12,9 +12,9 @@ type EngineWrapper struct {
|
||||
|
||||
func (ew *EngineWrapper) Init(options entity.EngineOptions) {
|
||||
ew.Engine = Engine{
|
||||
KContext: &options.KContext,
|
||||
KContext: options.KContext,
|
||||
Domain: options.Domain,
|
||||
Settings: &options.Settings,
|
||||
Settings: options.Settings,
|
||||
}
|
||||
ebiten.SetWindowSize(options.Settings.Screen.Width, options.Settings.Screen.Height)
|
||||
ebiten.SetWindowTitle(options.Settings.Name)
|
||||
|
||||
@@ -5,17 +5,6 @@ import (
|
||||
"github.com/hajimehoshi/ebiten/text"
|
||||
)
|
||||
|
||||
func (e *Engine) DialogDraw(screen *ebiten.Image) {
|
||||
dialog := e.Domain.GetDialog(e.KContext.ScreenValue)
|
||||
|
||||
face := GetFontFace(dialog.Layout.ChoiceFont)
|
||||
|
||||
for i, choice := range dialog.Choices {
|
||||
offset := int(dialog.Layout.ChoiceFont.Size) * (i + 1)
|
||||
text.Draw(screen, choice.Label+"\n", face, 8, offset, dialog.GetChoiceColor(i))
|
||||
}
|
||||
}
|
||||
|
||||
func (e *Engine) DialogUpdate() {
|
||||
dialog := e.Domain.GetDialog(e.KContext.ScreenValue)
|
||||
|
||||
@@ -32,3 +21,14 @@ func (e *Engine) DialogUpdate() {
|
||||
}
|
||||
e.Domain.SetDialog(e.KContext.ScreenValue, dialog)
|
||||
}
|
||||
|
||||
func (e *Engine) DialogDraw(screen *ebiten.Image) {
|
||||
dialog := e.Domain.GetDialog(e.KContext.ScreenValue)
|
||||
|
||||
face := GetFontFace(dialog.Layout.ChoiceFont)
|
||||
|
||||
for i, choice := range dialog.Choices {
|
||||
offset := int(dialog.Layout.ChoiceFont.Size) * (i + 1)
|
||||
text.Draw(screen, choice.Label+"\n", face, 8, offset, dialog.GetChoiceColor(i))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,17 +5,6 @@ import (
|
||||
"github.com/hajimehoshi/ebiten/text"
|
||||
)
|
||||
|
||||
func (e *Engine) MenuDraw(screen *ebiten.Image) {
|
||||
menu := e.Domain.GetMenu(e.KContext.ScreenValue)
|
||||
face := GetFontFace(menu.Layout.MenuItemFont)
|
||||
|
||||
for i, menu_item := range menu.MenuItems {
|
||||
color := menu.GetMenuItemColor(i)
|
||||
offset := int(menu.Layout.MenuItemFont.Size) * (i + 1)
|
||||
text.Draw(screen, menu_item.Label+"\n", face, 8, offset, color)
|
||||
}
|
||||
}
|
||||
|
||||
func (e *Engine) MenuUpdate() {
|
||||
menu := e.Domain.GetMenu(e.KContext.ScreenValue)
|
||||
|
||||
@@ -33,3 +22,14 @@ func (e *Engine) MenuUpdate() {
|
||||
|
||||
e.Domain.SetMenu(e.KContext.ScreenValue, menu)
|
||||
}
|
||||
|
||||
func (e *Engine) MenuDraw(screen *ebiten.Image) {
|
||||
menu := e.Domain.GetMenu(e.KContext.ScreenValue)
|
||||
face := GetFontFace(menu.Layout.MenuItemFont)
|
||||
|
||||
for i, menu_item := range menu.MenuItems {
|
||||
color := menu.GetMenuItemColor(i)
|
||||
offset := int(menu.Layout.MenuItemFont.Size) * (i + 1)
|
||||
text.Draw(screen, menu_item.Label+"\n", face, 8, offset, color)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,10 +6,6 @@ import (
|
||||
"github.com/hajimehoshi/ebiten"
|
||||
)
|
||||
|
||||
func (e *Engine) PlaygroundDraw(screen *ebiten.Image) {
|
||||
e.Domain.GetLevel(e.KContext.CurrentLevel)
|
||||
}
|
||||
|
||||
func (e *Engine) PlaygroundUpdate() {
|
||||
level := e.Domain.GetLevel(e.KContext.CurrentLevel)
|
||||
e.Domain.Process(entity.DomainProcessOptions{
|
||||
@@ -17,3 +13,7 @@ func (e *Engine) PlaygroundUpdate() {
|
||||
KContext: e.KContext,
|
||||
})
|
||||
}
|
||||
|
||||
func (e *Engine) PlaygroundDraw(screen *ebiten.Image) {
|
||||
e.Domain.GetLevel(e.KContext.CurrentLevel)
|
||||
}
|
||||
|
||||
@@ -2,8 +2,8 @@ package entity
|
||||
|
||||
type EngineOptions struct {
|
||||
Domain DomainInterface
|
||||
KContext KContext
|
||||
Settings Settings
|
||||
KContext *KContext
|
||||
Settings *Settings
|
||||
}
|
||||
|
||||
type EngineWrapperInterface interface {
|
||||
|
||||
@@ -7,7 +7,7 @@ import (
|
||||
type Konstructor struct {
|
||||
Domain entity.DomainInterface
|
||||
KContext *entity.KContext
|
||||
Settings entity.Settings
|
||||
Settings *entity.Settings
|
||||
EngineWrapper entity.EngineWrapperInterface
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ func (k Konstructor) Init() {
|
||||
k.Domain.Init()
|
||||
k.EngineWrapper.Init(entity.EngineOptions{
|
||||
Domain: k.Domain,
|
||||
KContext: *k.KContext,
|
||||
KContext: k.KContext,
|
||||
Settings: k.Settings,
|
||||
})
|
||||
k.EngineWrapper.Run()
|
||||
|
||||
Reference in New Issue
Block a user