Ncurses alternative in Odin

Here’s a snake game written in odin using my ncurses alternative which is also written in Odin:

This library assumes that your terminal supports ANSI escape codes (most terminals in use nowadays support it) and for mouse input uses SGR escape codes.

Right now the library works only on POSIX systems and is missing a few things on the input handling part (mostly missing key press detection on the ANSI escape parser that I’m slowly adding). The only thing missing for windows support is the syscalls necessary to change the terminal mode.

The repo is here: GitHub - RaphGL/TermCL: Terminal Control Library for Odin

8 Likes

A lot of the traffic going to the repo seems to be coming from here. So just wanted to give an update on the state of the library as of today.

The library now works on POSIX systems (Linux, BSDs, MacOS, etc) as well as on Windows. I’ve tested it and it works. On windows though you’ll either have to use the Windows Terminal or some other terminal that supports ANSI escape codes. SGR escape codes for the mouse also seems to be widely supported according to my tests.

I’ve also introduced windows with support for isolation, so if you write to a window the text will never overflow the window area.

5 Likes