Thread overview
How do I use ncurses library with D? are there any wrapper?
Jan 03
Marc
January 03
Long time ago, IIRC, I read somewhere there was a ncurses for D but now I can't find it are there any wrapper or am I mistaken? anyway, I'm doing it from scratch and not porting anything so even a library with same functionality as ncurses for D is welcome.
January 03
On Wednesday, January 03, 2018 15:47:58 Marc via Digitalmars-d-learn wrote:
> Long time ago, IIRC, I read somewhere there was a ncurses for D but now I can't find it are there any wrapper or am I mistaken? anyway, I'm doing it from scratch and not porting anything so even a library with same functionality as ncurses for D is welcome.

There appear to be two which might be of use (maybe three, but the one called sf sounds more like it's using it than providing a wrapper or bindings):

http://code.dlang.org/search?q=ncurses

IIRC, I have a project which uses the one called ncurses so that it could take a password at the command-line without showing it.

- Jonathan M Davis

January 03
On Wed, Jan 03, 2018 at 03:47:58PM +0000, Marc via Digitalmars-d-learn wrote:
> Long time ago, IIRC, I read somewhere there was a ncurses for D but now I can't find it are there any wrapper or am I mistaken? anyway, I'm doing it from scratch and not porting anything so even a library with same functionality as ncurses for D is welcome.

Depending on what you want to do, this might be just the ticket:

	https://github.com/adamdruppe/arsd/blob/master/terminal.d

I've used this for several of my CLI programs, and it works quite well, and is relatively easy to use.  Best of all: zero dependencies, just copy terminal.d into a subdirectory called arsd, and `import arsd.terminal;` and off you go.

Depending on what you want, you could also tack on eventloop.d from the same repo, with an appropriate version=with_eventloop compiler option, and you'll get a very nice event-driven API to handle keystrokes, etc..


T

-- 
When solving a problem, take care that you do not become part of the problem.
January 03
On Wednesday, 3 January 2018 at 19:15:18 UTC, H. S. Teoh wrote:
> 	https://github.com/adamdruppe/arsd/blob/master/terminal.d

indeed. some dox here http://dpldocs.info/arsd.terminal

> Best of all: zero dependencies, just copy terminal.d into a subdirectory called arsd, and `import arsd.terminal;` and off you go.

You still need to link it in. I suggest just listing the module on the command line with the rest of your build. If you are using rdmd or dub though I think they both automatically do, but with plain dmd you are best off just listing yourself: `dmd yourfile.d terminal.d`

> Depending on what you want, you could also tack on eventloop.d from the same repo, with an appropriate version=with_eventloop compiler option, and you'll get a very nice event-driven API to handle keystrokes, etc..

Note that is Linux only and I might remove support for it in a couple years. I'm working on a new event loop design...
January 03
On Wed, Jan 03, 2018 at 09:04:00PM +0000, Adam D. Ruppe via Digitalmars-d-learn wrote:
> On Wednesday, 3 January 2018 at 19:15:18 UTC, H. S. Teoh wrote:
> > 	https://github.com/adamdruppe/arsd/blob/master/terminal.d
[...]
> > Depending on what you want, you could also tack on eventloop.d from the same repo, with an appropriate version=with_eventloop compiler option, and you'll get a very nice event-driven API to handle keystrokes, etc..
> 
> Note that is Linux only and I might remove support for it in a couple years.  I'm working on a new event loop design...

Thanks for the heads up.  I don't mind updating my code to a new event loop design, if the new design makes sense for me.

What we *really* need is a standard event loop in Phobos, so that everyone can just adhere to that API instead of reinventing event loops all over the place (I've done it myself, multiple times).


T

-- 
Meat: euphemism for dead animal. -- Flora