16 lines
357 B
Go
16 lines
357 B
Go
|
package buf2d
|
||
|
|
||
|
import "fmt"
|
||
|
|
||
|
// 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
|
||
|
}
|
||
|
fmt.Println(x+dx, y, string(r))
|
||
|
b.Set(x+dx, y, r)
|
||
|
}
|
||
|
}
|