entity layer

This commit is contained in:
2023-07-04 22:58:23 +02:00
parent 93b2725c8a
commit e9c35f01ab
19 changed files with 364 additions and 353 deletions

View File

@@ -0,0 +1,14 @@
package entity
import "github.com/hajimehoshi/ebiten"
type KeyMap struct {
Up ebiten.Key
Down ebiten.Key
Right ebiten.Key
Left ebiten.Key
Action0 ebiten.Key
Action1 ebiten.Key
Action2 ebiten.Key
Action3 ebiten.Key
}

View File

@@ -0,0 +1,30 @@
package entity
import "image/color"
type DialogMap map[string]Dialog
type DialogLayout struct {
Background string
ChoiceFont FontLayout
}
type DialogChoice struct {
ID string
Label string
Handler func()
}
type Dialog struct {
CurrentSelected int
Layout DialogLayout
Choices []DialogChoice
}
func (dialog *Dialog) GetChoiceColor(i int) color.Color {
if dialog.CurrentSelected == i {
return dialog.Layout.ChoiceFont.SelectedColor
} else {
return dialog.Layout.ChoiceFont.Color
}
}

View File

@@ -0,0 +1,10 @@
package entity
import "image/color"
type FontLayout struct {
DPI float64
Size float64
Color color.Color
SelectedColor color.Color
}

View File

@@ -0,0 +1,30 @@
package entity
import "image/color"
type MenuMap map[string]Menu
type MenuLayout struct {
Background string
MenuItemFont FontLayout
}
type MenuItem struct {
ID string
Label string
Handler func()
}
type Menu struct {
CurrentSelected int
Layout MenuLayout
MenuItems []MenuItem
}
func (menu *Menu) GetMenuItemColor(i int) color.Color {
if menu.CurrentSelected == i {
return menu.Layout.MenuItemFont.SelectedColor
} else {
return menu.Layout.MenuItemFont.Color
}
}

View File

@@ -0,0 +1,65 @@
package entity
type Position struct {
X int
Y int
Z int
}
type RenderOptions struct {
Image string
Width int
Height int
}
type ObjectType struct {
ID string
RenderOptions RenderOptions
}
type Object struct {
ID string
Type ObjectType
Position Position
}
type NPCType struct {
ID string
RenderOptions RenderOptions
}
type NPC struct {
ID string
Type NPCType
Position Position
}
type Player struct {
ID string
RenderOptions RenderOptions
Position Position
}
type ItemType struct {
ID string
RenderOptions RenderOptions
}
type Item struct {
ID string
Type ItemType
Position Position
}
type Playground struct {
Background string
Objects []Object
NPCs []NPC
Items []Item
}
type Level struct {
ID string
Name string
Playgrounds []Playground
}

View File

@@ -0,0 +1,11 @@
package entity
type ScreenSettings struct {
Width int
Height int
}
type Settings struct {
Name string
Screen *ScreenSettings
}

View File

@@ -0,0 +1,11 @@
package entity
type KContextScreen struct {
Type string
Value string
}
type KContext struct {
Screen KContextScreen
CurrentLevel int
}