Exemplo n.º 1
0
// WriteToBuffer writes the given characters and colors to the buffer with the
// given handle.
func WriteToBuffer(handle ScreenBufferHandle, chars [][]rune, colors [][]int) {
	height := len(chars)
	if height == 0 {
		return
	}

	width := len(chars[0])

	charInfoBuffer := make([]C.CHAR_INFO, height*width)
	k := 0
	for i := 0; i < height; i++ {
		for j := 0; j < width; j++ {
			info := C.MakeCharInfo(C.CHAR(chars[i][j]), C.WORD(colors[i][j]))
			charInfoBuffer[k] = info
			k++
		}
	}

	C.WriteToBuffer(handle.handle, C.SHORT(width), C.SHORT(height), &charInfoBuffer[0])
}
Exemplo n.º 2
0
// MoveTo sets the console cursor postition
func MoveTo(column int, row int) {
	C.MoveTo(C.SHORT(column), C.SHORT(row))
}