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.

20 lines
383 B
Go

4 years ago
package ui
// buffer is a rect of tiles
type buffer struct {
width int
height int
tiles []tile
}
func newBuffer(width, height int) *buffer {
return &buffer{
width: width,
height: height,
tiles: make([]tile, width*height),
}
}
func (b *buffer) set(x, y int, t tile) { b.tiles[y*b.width+x] = t }
func (b *buffer) get(x, y int) tile { return b.tiles[y*b.width+x] }