Thread overview | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
October 17, 2004 ncurses bindings for D? | ||||
---|---|---|---|---|
| ||||
Does anyone know if there are any ncurses bindings around for D? I'm looking to develop a roguelike using D, and it would save me a lot of time if someone has already done all the nasty work of converting ncurses.h to a D module -- particularly as there are so many macro functions in there that I have no idea how to tackle parts of it. For example: extern NCURSES_EXPORT_VAR(chtype) acs_map[]; #define NCURSES_ACS(c) (acs_map[(unsigned char)c]) /* VT100 symbols begin here */ #define ACS_ULCORNER NCURSES_ACS('l') /* upper left corner */ #define ACS_LLCORNER NCURSES_ACS('m') /* lower left corner */ .. etc. Does D support exported variables like this? Would the declaration become something like this? export chtype *acs_map; |
October 17, 2004 Re: ncurses bindings for D? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Tabris | To use ncurses (and all it's macros) you would have to convert the macros to functions. As it is, I'm doing a port of PDCurses to D. Currently some of the functionality works on Windows. If you want to use curses for something useful (e.g. rogue), you'll probably be better off using ncurses (or PDCurses as it has a native Windows implementation) yet. I think it'll be a while until dcurses is ready. It's mostly a learning experience for me.
Lars Ivar Igesund
Tabris wrote:
> Does anyone know if there are any ncurses bindings around for D? I'm looking to
> develop a roguelike using D, and it would save me a lot of time if someone has
> already done all the nasty work of converting ncurses.h to a D module --
> particularly as there are so many macro functions in there that I have no idea
> how to tackle parts of it. For example:
>
> extern NCURSES_EXPORT_VAR(chtype) acs_map[];
>
> #define NCURSES_ACS(c) (acs_map[(unsigned char)c])
>
> /* VT100 symbols begin here */
> #define ACS_ULCORNER NCURSES_ACS('l') /* upper left corner */
> #define ACS_LLCORNER NCURSES_ACS('m') /* lower left corner */
> ..
> etc.
>
> Does D support exported variables like this?
> Would the declaration become something like this?
> export chtype *acs_map;
>
>
|
October 18, 2004 Re: ncurses bindings for D? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Lars Ivar Igesund | In article <ckt849$2sfu$1@digitaldaemon.com>, Lars Ivar Igesund says... > >To use ncurses (and all it's macros) you would have to convert the macros to functions. As it is, I'm doing a port of PDCurses to D. Currently some of the functionality works on Windows. If you want to use curses for something useful (e.g. rogue), you'll probably be better off using ncurses (or PDCurses as it has a native Windows implementation) yet. I think it'll be a while until dcurses is ready. It's mostly a learning experience for me. > >Lars Ivar Igesund > >Tabris wrote: >> Does anyone know if there are any ncurses bindings around for D? I'm looking to develop a roguelike using D, and it would save me a lot of time if someone has already done all the nasty work of converting ncurses.h to a D module -- particularly as there are so many macro functions in there that I have no idea how to tackle parts of it. For example: >> >> extern NCURSES_EXPORT_VAR(chtype) acs_map[]; >> >> #define NCURSES_ACS(c) (acs_map[(unsigned char)c]) >> >> /* VT100 symbols begin here */ >> #define ACS_ULCORNER NCURSES_ACS('l') /* upper left corner */ >> #define ACS_LLCORNER NCURSES_ACS('m') /* lower left corner */ >> .. >> etc. >> >> Does D support exported variables like this? >> Would the declaration become something like this? >> export chtype *acs_map; >> >> Can't wait to see your D implementation of curses :) If I manage to create a D ncurses binding successfully, I'll bump this thread with it, since there must be a few other people in this position. |
October 19, 2004 Re: ncurses bindings for D? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Tabris Attachments: | I wrote an ncurses translation and it works pretty well. It doesn't support all the functions, but you can fill them in as you wish. The only small problem is the C macros for the ACS characters. In C you would do: putchar(ACS_BULLET) I couldn't get that to work in D so i do this instead: putchar(acs_map[ACS_BULLET]); wish is good enough for me. Good luck, Jaap |
October 19, 2004 Re: ncurses bindings for D? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Tabris | Hi Tabris, Is Rogue a screen widget library? Actually I developed one. It's not complete, it's not very efficient, but the basics are working and it does what I currently need. (windows, buttons, editboxes, tables, pulldown, listbox, radio, checkbox, progressbar). It can do UTF-8 too. If you are interested let me know. Jaap "Tabris" <Tabris_member@pathlink.com> wrote in message news:cksd0c$2322$1@digitaldaemon.com... > Does anyone know if there are any ncurses bindings around for D? I'm looking to > develop a roguelike using D, and it would save me a lot of time if someone has > already done all the nasty work of converting ncurses.h to a D module -- particularly as there are so many macro functions in there that I have no idea > how to tackle parts of it. For example: > > extern NCURSES_EXPORT_VAR(chtype) acs_map[]; > > #define NCURSES_ACS(c) (acs_map[(unsigned char)c]) > > /* VT100 symbols begin here */ > #define ACS_ULCORNER NCURSES_ACS('l') /* upper left corner */ > #define ACS_LLCORNER NCURSES_ACS('m') /* lower left corner */ > .. > etc. > > Does D support exported variables like this? > Would the declaration become something like this? > export chtype *acs_map; > > |
October 19, 2004 Re: ncurses bindings for D? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jaap Geurts Attachments: | Please ignore the attachment in the last post. It won't compile because it had some windows stuff in it. Here is the ncurses pure one. Jaap |
October 19, 2004 Re: ncurses bindings for D? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jaap Geurts | Jaap Geurts wrote:
> Hi Tabris,
>
> Is Rogue a screen widget library?
Rogue was an early consolebased game. NetHack, Angband and others are classified as Rogue-likes.
Lars Ivar Igesund
|
October 25, 2004 Re: ncurses bindings for D? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jaap Geurts | In article <cl3don$6uj$1@digitaldaemon.com>, Jaap Geurts says... > >Please ignore the attachment in the last post. It won't compile because it had some windows stuff in it. > >Here is the ncurses pure one. > >Jaap > > Many thanks, this has saved me a fair amount of work :) |
Copyright © 1999-2021 by the D Language Foundation