add input.Buffered and input.Keyboard and a binary to try combo

This commit is contained in:
Bel LaPointe
2023-03-02 15:11:57 -07:00
parent c4e1c525d1
commit bfdab392a0
6 changed files with 168 additions and 0 deletions

View File

@@ -0,0 +1,24 @@
package main
import (
"log"
"mayhem-party/src/device/input"
)
func main() {
k := input.NewBuffered(input.NewKeyboard())
defer func() {
recover()
k.Close()
}()
log.Printf("try the keyboard")
n := 5
for n > 0 {
result := k.Read()
n -= len(result)
for j := range result {
log.Printf("[%d][%d] %c|%v", n, j, result[j].Char, result[j].Down)
}
}
}