Made screen.Draw() to accept variable number of arguments

master
Michael Dvorkin 12 years ago
parent 9695ec3ad0
commit c7e2456ced
  1. 4
      lib/screen.go
  2. 6
      mop.go

@ -62,7 +62,8 @@ func (self *Screen) Close() {
}
//-----------------------------------------------------------------------------
func (self *Screen) Draw(ptr interface{}) {
func (self *Screen) Draw(objects ...interface{}) {
for _, ptr := range objects {
switch ptr.(type) {
case *Market:
object := ptr.(*Market)
@ -71,6 +72,7 @@ func (self *Screen) Draw(ptr interface{}) {
object := ptr.(*Quotes)
self.draw(object.Fetch().Format())
}
}
}
//-----------------------------------------------------------------------------

@ -24,8 +24,7 @@ func mainLoop(screen *mop.Screen, profile *mop.Profile) {
market := new(mop.Market).Initialize().Fetch()
quotes := new(mop.Quotes).Initialize(market, profile)
screen.Draw(market)
screen.Draw(quotes)
screen.Draw(market, quotes)
loop:
for {
@ -48,8 +47,7 @@ loop:
}
case termbox.EventResize:
screen.Resize()
screen.Draw(market)
screen.Draw(quotes)
screen.Draw(market, quotes)
}
case <-timestamp_queue.C:

Loading…
Cancel
Save