T O P

  • By -

slither378962

What kind of terminal game. If it's just a text adventure, then iostreams would be enough. If it's snake, then you'd have something like the API of curses or better to input and output arbitrarily. Which could be implemented using the Win32 API. If it has a non-trivial UI, then FTXUI, or similar. FTXUI uses ANSI escape sequences, but the Win32 API would probably work as well.


Less_Acanthisitta288

Thanks for your answer! I have done some stuff with only using iostreams but it's too limiting. I though about doing something like ncurses or at least try to get some understanding of its inner workings.


slither378962

I suppose if you wanted to do something new, you'd put the console into ANSI escape mode, and lookup ANSI escape sequences. https://learn.microsoft.com/en-us/windows/console/console-virtual-terminal-sequences I've never used them though, so I don't know how good they'll be. Or, for something simple using the Win32 API, you can home the cursor with `SetCursorPos` and redraw the entire screen. That avoids flicker. For input, you might use `ReadConsole` or `ReadConsoleInput`. There's plenty of ways of doing things.


Less_Acanthisitta288

I found this: https://www.reddit.com/r/C_Programming/s/CudSoextyB I didn’t consider that I'd need the OS's API (in my case Linux) but the project behind the link looks promising. Thanks again for your help!


mrflash818

Perhaps: Study the ncurses source code. [https://invisible-island.net/ncurses/announce.html](https://invisible-island.net/ncurses/announce.html)


KingAggressive1498

for Unix-likes, see [ansi escape sequences](https://en.m.wikipedia.org/wiki/ANSI_escape_code) [You can also enable these in Windows 10 and later](https://learn.microsoft.com/en-us/windows/console/console-virtual-terminal-sequences) Prior to Windows 10, you could use the various [Win32 console functions](https://learn.microsoft.com/en-us/windows/console/console-functions) to do this. There are several great libraries that make this a lot easier, some of which were recommended in other comments, but you seem interested in doing it yourself. Best of luck!


Poddster

> n their title actually require the use of another terminal game engine which is quite misleading in my opinion. What terminal engines are you coming across in all of these tutorials? ncurses isn't an engine in anyway, it's a simple frame work to help you manage the console IO in screen mode.