master
Jordan Orelli 4 years ago
parent 3f6f825c4c
commit a470e30a41

@ -18,7 +18,7 @@ func (s *statusBar) draw(b *buffer) {
if s.ui == nil {
return
}
line := fmt.Sprintf("shown: %08d cleared: %08d", s.ui.showCount, s.ui.clearCount)
line := fmt.Sprintf("shown: %08d cleared: %08d messages: %08d", s.ui.showCount, s.ui.clearCount, s.ui.msgCount)
b.writeString(line, math.Vec{0, 0}, tcell.StyleDefault)
}

@ -17,6 +17,8 @@ type UI struct {
screen tcell.Screen
room *wire.Room
client *wire.Client
msgCount int
showCount int
clearCount int
@ -122,6 +124,7 @@ func (ui *UI) clearTerminal() {
func (ui *UI) handleNotifications(c <-chan wire.Response) {
for n := range c {
ui.msgCount++
if ui.handleNotification(n.Body) {
if ui.gameView != nil {
ui.render()

@ -76,7 +76,7 @@ func newWorld(log *blammo.Log) *world {
Log: log.Child("hall"),
name: "hall",
Rect: math.CreateRect(20, 4),
tiles: make([]tile, bounds.Area()),
tiles: make([]tile, 80),
players: make(map[string]*player),
}
@ -91,12 +91,43 @@ func newWorld(log *blammo.Log) *world {
},
})
kitchen := room{
Log: log.Child("kitchen"),
name: "kitchen",
Rect: math.CreateRect(6, 12),
tiles: make([]tile, 72),
players: make(map[string]*player),
}
foyer.addEntity(&entity{
ID: -6,
Position: math.Vec{9, 7},
Glyph: '◇',
behavior: &door{
Log: log.Child("door"),
to: "kitchen",
exit: -7,
},
})
kitchen.addEntity(&entity{
ID: -7,
Position: math.Vec{0, 2},
Glyph: '◇',
behavior: &door{
Log: log.Child("door"),
to: "foyer",
exit: -6,
},
})
log.Info("created foyer with bounds: %#v having width: %d height: %d area: %d", foyer.Rect, foyer.Width, foyer.Height, foyer.Area())
return &world{
Log: log,
rooms: map[string]*room{
"foyer": &foyer,
"hall": &hall,
"kitchen": &kitchen,
},
done: make(chan bool),
inbox: make(chan Request),

Loading…
Cancel
Save