entity layer
This commit is contained in:
14
konstructor/entity/entity.controller.go
Normal file
14
konstructor/entity/entity.controller.go
Normal 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
|
||||
}
|
||||
30
konstructor/entity/entity.dialog.go
Normal file
30
konstructor/entity/entity.dialog.go
Normal 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
|
||||
}
|
||||
}
|
||||
10
konstructor/entity/entity.font.go
Normal file
10
konstructor/entity/entity.font.go
Normal file
@@ -0,0 +1,10 @@
|
||||
package entity
|
||||
|
||||
import "image/color"
|
||||
|
||||
type FontLayout struct {
|
||||
DPI float64
|
||||
Size float64
|
||||
Color color.Color
|
||||
SelectedColor color.Color
|
||||
}
|
||||
30
konstructor/entity/entity.menu.go
Normal file
30
konstructor/entity/entity.menu.go
Normal 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
|
||||
}
|
||||
}
|
||||
65
konstructor/entity/entity.playground.go
Normal file
65
konstructor/entity/entity.playground.go
Normal 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
|
||||
}
|
||||
11
konstructor/entity/entity.settings.go
Normal file
11
konstructor/entity/entity.settings.go
Normal file
@@ -0,0 +1,11 @@
|
||||
package entity
|
||||
|
||||
type ScreenSettings struct {
|
||||
Width int
|
||||
Height int
|
||||
}
|
||||
|
||||
type Settings struct {
|
||||
Name string
|
||||
Screen *ScreenSettings
|
||||
}
|
||||
11
konstructor/entity/konstructor.kcontext.go
Normal file
11
konstructor/entity/konstructor.kcontext.go
Normal file
@@ -0,0 +1,11 @@
|
||||
package entity
|
||||
|
||||
type KContextScreen struct {
|
||||
Type string
|
||||
Value string
|
||||
}
|
||||
|
||||
type KContext struct {
|
||||
Screen KContextScreen
|
||||
CurrentLevel int
|
||||
}
|
||||
Reference in New Issue
Block a user