key.To/FromChar

This commit is contained in:
Bel LaPointe
2023-03-02 09:25:19 -07:00
parent 5d30297ec4
commit 5f59054366
10 changed files with 135 additions and 44 deletions

View File

@@ -4,6 +4,7 @@ import (
"context"
"mayhem-party/src/device/input"
"mayhem-party/src/device/output"
"mayhem-party/src/device/output/key"
"time"
)
@@ -22,13 +23,13 @@ func Main(ctx context.Context) error {
}
}
state := map[output.Key]bool{}
state := map[key.Key]bool{}
for block() {
delta := reader.Read()
for _, button := range delta {
state[output.Key(button.Char)] = button.Down
state[key.FromChar(button.Char)] = button.Down
}
keys := make([]output.Key, 0)
keys := make([]key.Key, 0)
for k, v := range state {
if v {
keys = append(keys, k)