diff options
author | Logan Hunt <loganhunt@simponic.xyz> | 2023-01-13 17:02:31 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-13 17:02:31 -0700 |
commit | b1b62f154ab5f74a9217dbf5a6422640ac929df3 (patch) | |
tree | 6fa3b6e8d7e9219decda28948bf3f02c3cf2dab2 /lib/chessh/ssh/client/screen.ex | |
parent | fdc22875284b78f9fb98993cbe44ce893c0de413 (diff) | |
parent | 3a6c603b0b12964d8a04ae4f78fb61bc094adf12 (diff) | |
download | chessh-b1b62f154ab5f74a9217dbf5a6422640ac929df3.tar.gz chessh-b1b62f154ab5f74a9217dbf5a6422640ac929df3.zip |
Merge pull request #3 from Simponic/draw_board
Draw board
Diffstat (limited to 'lib/chessh/ssh/client/screen.ex')
-rw-r--r-- | lib/chessh/ssh/client/screen.ex | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/chessh/ssh/client/screen.ex b/lib/chessh/ssh/client/screen.ex new file mode 100644 index 0000000..0437b23 --- /dev/null +++ b/lib/chessh/ssh/client/screen.ex @@ -0,0 +1,18 @@ +defmodule Chessh.SSH.Client.Screen do + @callback render(width :: integer(), height :: integer(), state :: any()) :: any() + @callback input(width :: integer(), height :: integer(), action :: any(), state :: any()) :: + any() + + defmacro __using__(_) do + quote do + @behaviour Chessh.SSH.Client.Screen + use GenServer + + def handle_info({:render, width, height}, state), + do: {:noreply, render(width, height, state)} + + def handle_info({:input, width, height, action}, state), + do: {:noreply, input(width, height, action, state)} + end + end +end |