V
V
vlarkanov2019-09-30 14:03:21
linux
vlarkanov, 2019-09-30 14:03:21

Golang: how to organize keyboard control?

I am writing a console game a la roguelike, it is necessary to implement keyboard control. In C++ I used lncurses for this purpose. If something similar for th? To listen to keyboard input in an endless loop and perform some action based on the key pressed.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vladislav, 2019-09-30
@ghostiam

There is a library, look at the game examples
https://github.com/nsf/termbox-go/blob/master/READ...
Or here is another library, here is an example with moving through the list:
https://github.com/gizak /termui/blob/master/_examp...
And of course you can peep how it is implemented in these libraries and write your own implementation.

L
Leonid Nikolaev, 2019-09-30
@nikonor

maybe it's better to join the finished project?
https://github.com//anaseto/boohu/

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question