You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
731 B
Go

package app
import (
"fmt"
"github.com/gdamore/tcell/v2"
"github.com/jordanorelli/astro-domu/internal/math"
)
type inventory struct {
items []item
}
type item struct {
name string
}
type inventoryView struct {
}
func (v *inventoryView) handleEvent(e tcell.Event) change {
return nil
}
func (v *inventoryView) draw(img canvas, st *state) {
writeString(img, "Inventory", math.Vec{0, 0}, tcell.StyleDefault)
for i, item := range st.inventory.items {
line := fmt.Sprintf("- %s", item.name)
writeString(img, line, math.Vec{0, i + 2}, tcell.StyleDefault)
}
}
type openInventory struct{}
func (openInventory) exec(ui *UI) {
if ui.root == inGameView {
ui.state.detail = &inventoryView{}
inGameView.focus(1)
}
}