diff --git a/src/device/input/wrap/protocol.go b/src/device/input/wrap/protocol.go new file mode 100644 index 0000000..a240e77 --- /dev/null +++ b/src/device/input/wrap/protocol.go @@ -0,0 +1,21 @@ +package wrap + +import "mayhem-party/src/device/input/raw" + +type Protocol struct { + src raw.Raw +} + +func NewProtocol(src raw.Raw) Protocol { + return Protocol{ + src: src, + } +} + +func (p Protocol) Close() { + p.src.Close() +} + +func (p Protocol) Read() []Button { + panic(nil) +} diff --git a/src/device/input/wrap/wrap.go b/src/device/input/wrap/wrap.go index 3bae9c4..0d700ad 100644 --- a/src/device/input/wrap/wrap.go +++ b/src/device/input/wrap/wrap.go @@ -16,6 +16,11 @@ func New(ctx context.Context, src raw.Raw) Wrap { maker := func() Wrap { return explicit{src: src} } + if os.Getenv("WRAP_PROTOCOL") == "true" { + maker = func() Wrap { + return NewProtocol(src) + } + } if os.Getenv("WRAP_BUFFERED") == "true" { oldMaker := maker maker = func() Wrap { diff --git a/src/device/input/wrap/wrap_test.go b/src/device/input/wrap/wrap_test.go index e03c574..4cab6b4 100644 --- a/src/device/input/wrap/wrap_test.go +++ b/src/device/input/wrap/wrap_test.go @@ -7,4 +7,5 @@ func TestWrap(t *testing.T) { var _ Wrap = &Refresh{} var _ Wrap = &Buffered{} var _ Wrap = &Remap{} + var _ Wrap = Protocol{} } diff --git a/todo.yaml b/todo.yaml index d12391d..9cbc7e1 100755 --- a/todo.yaml +++ b/todo.yaml @@ -1,11 +1,9 @@ todo: -- input."Button" to interface or strings -- input.UDP as a raw provider -- input.MayhemParty as a logical wrapper -- lag via UDP formatted inputs as space-delimited TS PID buttonIdx buttonIdx buttonIdx - change from 'a','b','c' from rust to just 11,21,31,41 so playerName is known implicitly - from %10 but then gotta translate back to char for keyboard things somewhere; space - delimited? +- lag via UDP formatted inputs as space-delimited TS PID buttonIdx buttonIdx buttonIdx +- input."Button" to interface or strings +- input.MayhemParty as a logical wrapper from %10 but then gotta translate back to + char for keyboard things somewhere; space delimited? - todo: rusty configs have "name" for each client details: | 'if name == server_broadcasted_name { debug_print_in_gui(server_broadcasted_message) }' @@ -32,3 +30,11 @@ done: ts: Fri Mar 24 17:00:55 MDT 2023 - todo: '"Button" to interface or strings' ts: Fri Mar 24 17:01:01 MDT 2023 +- todo: input.UDP as a raw provider + ts: Fri Mar 24 19:58:59 MDT 2023 +- todo: input.MayhemParty as a logical wrapper + ts: Fri Mar 24 19:58:59 MDT 2023 +- todo: change from 'a','b','c' from rust to just 11,21,31,41 so playerName is known + implicitly from %10 but then gotta translate back to char for keyboard things + somewhere; space delimited? + ts: Fri Mar 24 19:58:59 MDT 2023