Example #1
0
func (ac *autocompl) draw_onto(buf *tulib.Buffer, x, y int) {
	ac.validate_cursor()

	h := ac.desired_height()
	dst := find_place_for_rect(buf.Rect, tulib.Rect{x, y + 1, 1, h})
	ac.adjust_view(dst.Height)
	w := ac.desired_width(dst.Height)
	dst = find_place_for_rect(buf.Rect, tulib.Rect{x, y + 1, w, h})

	slider_i, slider_r := ac.slider_pos_and_rune(dst.Height)
	lp := default_label_params

	r := dst
	r.Width--
	r.Height = 1
	for i := 0; i < dst.Height; i++ {
		lp.Fg = termbox.ColorBlack
		lp.Bg = termbox.ColorWhite

		n := ac.view + i
		if n == ac.cursor {
			lp.Fg = termbox.ColorWhite
			lp.Bg = termbox.ColorBlue
		}
		buf.Fill(r, termbox.Cell{
			Fg: lp.Fg,
			Bg: lp.Bg,
			Ch: ' ',
		})
		buf.DrawLabel(r, &lp, ac.actual_proposals()[n].display)

		sr := ' '
		if i == slider_i {
			sr = slider_r
		}
		buf.Set(r.X+r.Width, r.Y, termbox.Cell{
			Fg: termbox.ColorWhite,
			Bg: termbox.ColorBlue,
			Ch: sr,
		})
		r.Y++
	}
}
Example #2
0
func (gob *GameObject) Draw(buf *tulib.Buffer, pos image.Point) {
	buf.Set(pos.X, pos.Y, gob.Glyph)
}
Example #3
0
func (t *Terrain) Draw(b *tulib.Buffer, pt image.Point) {
	b.Set(pt.X, pt.Y, t.Glyph)
}