diff options
author | Simponic <loganhunt@simponic.xyz> | 2023-01-06 22:29:01 -0700 |
---|---|---|
committer | Simponic <loganhunt@simponic.xyz> | 2023-01-06 22:29:01 -0700 |
commit | 779c75dbe44516c0e1911cf8a56698a1508466b7 (patch) | |
tree | cc6562e27d7b571c63d1fa4818f5d06492fc7f70 /lib/chessh/ssh/screens/menu.ex | |
parent | 5b8dc2cb9800ed38ba1dc02fa5a135880a2c0bac (diff) | |
download | chessh-779c75dbe44516c0e1911cf8a56698a1508466b7.tar.gz chessh-779c75dbe44516c0e1911cf8a56698a1508466b7.zip |
Highlight a square
Diffstat (limited to 'lib/chessh/ssh/screens/menu.ex')
-rw-r--r-- | lib/chessh/ssh/screens/menu.ex | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/lib/chessh/ssh/screens/menu.ex b/lib/chessh/ssh/screens/menu.ex index 9baa059..d9df1b7 100644 --- a/lib/chessh/ssh/screens/menu.ex +++ b/lib/chessh/ssh/screens/menu.ex @@ -23,15 +23,14 @@ defmodule Chessh.SSH.Client.Menu do MMMMMMMMMMM MMMMMMMMMMM MMMMMMMMMMMM" @options [ - {"Option 1", {Chessh.SSH.Client.Board, %{}}}, - {"Option 2", {Chessh.SSH.Client.Board, %{}}}, - {"Option 3", {Chessh.SSH.Client.Board, %{}}} + {"Option 1", {Chessh.SSH.Client.Board, %Chessh.SSH.Client.Board.State{}}}, + {"Option 2", {Chessh.SSH.Client.Board, %Chessh.SSH.Client.Board.State{}}} ] def render(%Client.State{ width: width, height: height, - state_stack: [{_this_module, %State{selected: selected, y: dy, x: dx}} | _tail] + state_stack: [{_this_module, %State{selected: selected, y: dy, x: dx}} | _] }) do text = String.split(@logo, "\n") {logo_width, logo_height} = Utils.text_dim(@logo) @@ -57,7 +56,7 @@ defmodule Chessh.SSH.Client.Menu do ) ++ [ANSI.home()] end - def wrap_around(index, delta, length) do + defp wrap_around(index, delta, length) do calc = index + delta if(calc < 0, do: length, else: 0) + rem(calc, length) end |