some inventory improvements

This commit is contained in:
anton.gurov
2019-11-19 17:25:24 +03:00
parent 0a6c642dc2
commit 25aad1c2f5
6 changed files with 201 additions and 132 deletions

View File

@ -133,7 +133,7 @@ func main() {
}).MakeList(),
)
screenMgr.AddScreen("inventory", screens.InventoryScreen{
inv := screens.InventoryScreen{
MenuScreen: screens.NewMenuScreen(
mw,
screenMgr,
@ -144,10 +144,8 @@ func main() {
types.NewCenteredRect(mw.Rect, 70, 25),
true, ).
SetBgColor("#ef305c70").
SetFgColor("white").
SetItems([]interface{}{}).MakeList()
},
)
SetFgColor("white"),
}
screenMgr.AddScreen("devmenu", screens.NewDevmenuScreen(
mw,
@ -188,6 +186,7 @@ func main() {
controller.AddComponent(potion, items.Carried{Mass:5, Bulk:3})
controller.AddComponent(potion, items.Usable{})
controller.AddComponent(potion, items.Consumable{})
controller.AddComponent(potion, ecs.Named{Name:"first potion"})
potion2 := controller.CreateEntity([]ecs.Component{})
controller.AddComponent(potion2, types.Appearance{
@ -200,11 +199,15 @@ func main() {
controller.AddComponent(potion2, items.Carried{Mass:5, Bulk:3})
controller.AddComponent(potion2, items.Usable{})
controller.AddComponent(potion2, items.Consumable{})
controller.AddComponent(potion2, ecs.Named{Name:"second potion"})
//fixme end setting up items
State.Player = player
State.Controller = controller
screenMgr.AddScreen("inventory", inv.MakeInverntory(player))
//but every call to bearlibterminal must be wrapped to closure and passed to mainfunc
var exit = false
for !exit {