pointer fixes for kcontext and settings

This commit is contained in:
2023-07-05 22:05:48 +02:00
parent 5425e0036b
commit 5e4f63aecc
7 changed files with 33 additions and 33 deletions

View File

@@ -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)

View File

@@ -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))
}
}

View File

@@ -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)
}
}

View File

@@ -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)
}