22 lines
458 B
Go
22 lines
458 B
Go
package buf2d
|
|
|
|
// WriteString writes a whole string to the buffer at position (x,y)
|
|
// no word wrap is applied at all. If the string does not fit, it will be truncated
|
|
func (b *Buffer) WriteString(str string, x, y int) {
|
|
for dx, r := range str {
|
|
if x+dx >= b.width {
|
|
return
|
|
}
|
|
b.Set(x+dx, y, r)
|
|
}
|
|
}
|
|
|
|
// Fill fills the whole buffer with c
|
|
func (b *Buffer) Fill(c rune) {
|
|
for _, col := range b.data {
|
|
for ri := range col {
|
|
col[ri] = c
|
|
}
|
|
}
|
|
}
|