getch() in pure Erlang
A combination of undocumented features mentioned in issue #8037 allow you to handle keyboard events and develop simple terminal user interfaces in pure Erlang, without having to resort to something like native extensions.
The little two-puzzle Sokoban game in games/sokoban-demo handles the terminal this way.
The features:
- the
erl -user $moduleinvocation to have user code handle the interface, instead of eshell - the
prim_ttymodule itself
To do this is an escript, you need -user escript rather than your module. The non-demo games/sokoban demonstrates the rebar.config change needed for that.