Author Topic: ncurses and c++  (Read 23332 times)

fecal_brunch

  • Newcomer
  • Posts: 5
  • Karma: +0/-0
    • View Profile
    • Email
ncurses and c++
« on: June 20, 2008, 10:23:12 AM »
Hey there. I'm planning on writing my first roguelike soon, and was reading up on ncurses - I understand this is the library to use... Anyway, I noticed it has a bool data type built in, does this create a conflict with the c++ boolean type?

corremn

  • Rogueliker
  • ***
  • Posts: 700
  • Karma: +0/-0
  • SewerJack Extraordinaire
    • View Profile
    • Demise RogueLike Games
Re: ncurses and c++
« Reply #1 on: June 21, 2008, 03:59:05 AM »
No idea, I have never used ncurses, shouldn't be much of an issue though, as I assume they would both be ints at heart.

Another valid option instead of ncurses is the more modern SDL library, which is what the other half of C++ developers use (if they dont support both that is).  Try  to write you code so it separates the actual screen output from your core classes.  SDL is generally used to emulate ascii and therefore can be quickly adapted to use gfx.

Good luck.
corremn's Roguelikes. To admit defeat is to blaspheme against the Emperor.  Warhammer 40000 the Roguelike

fecal_brunch

  • Newcomer
  • Posts: 5
  • Karma: +0/-0
    • View Profile
    • Email
Re: ncurses and c++
« Reply #2 on: June 21, 2008, 09:18:40 AM »
Ah, I really want to use the terminal, I hate text emulation... I was planning on building a non graphical frontend and keeping the ui including input completely seperate so that perhaps one day I could make a fully graphical interface with mouse support and stuff using SDL.
I think I'll use ncurses for now, I thought that perhaps "bool" was a restricted term and would cause a conflict. I guess I should just try it out instead of talking about it! Hah. If it doesn't work I guess I could just edit it out of the library...

Anvilfolk

  • Rogueliker
  • ***
  • Posts: 374
  • Karma: +0/-0
    • View Profile
Re: ncurses and c++
« Reply #3 on: June 21, 2008, 05:14:14 PM »
I thought ncurses was Unix only? There's an alternative, pdcurses, which you might want to look into!

Personally, if I ever do get to program a roguelike, I'm probably going to opt for text simulation because I want to be able to incorporate mouse-overs and menus and stuff... I know it's not really necessary for a very traditional roguelike, but it might help.

Have you never felt that mousing-over a monster could give you some decent statistics? Rather than, say, pressing x, using the arrow keys or jumping over to the creature you want to see, then pressing enter, and esc, and so forth for every creature you want information about?
"Get it hot! Hit it harder!!!"
 - The tutor warcry

One of They Who Are Too Busy

Scautura

  • Rogueliker
  • ***
  • Posts: 55
  • Karma: +0/-0
    • View Profile
    • CyberRogue
    • Email
Re: ncurses and c++
« Reply #4 on: June 21, 2008, 05:57:02 PM »
ncurses is supported on multiple platforms, including DOS (Try DJGPP) and Cygwin... Windows is a... Let's just say it rhymes with Mitch... when it comes to curses - PDCurses doesn't have complete functionality, but you can always opt for Cygwin.

ncurses also supports mouse functions, at least, as far as I've read. Not sure how far I would go down that route though.
Duct tape is like the Force - it has a Dark side, a Light side, and it holds the Universe together.
CyberRogue

fecal_brunch

  • Newcomer
  • Posts: 5
  • Karma: +0/-0
    • View Profile
    • Email
Re: ncurses and c++
« Reply #5 on: June 22, 2008, 11:03:39 AM »
Why bother with text at all if you're going to use SDL? You'd be better off having a full tileset. I plan on leaving it open ended so I can incorporate mouse stuff in some kind of more accessable graphical mode (if I get around to doing SDL)... But I still want a traditional text mode.

I'm pretty sure ncurses does have mouse support, but usually when I play roguelikes I'm not wanting to take my hands away from the keyboard.

Z

  • Rogueliker
  • ***
  • Posts: 905
  • Karma: +0/-0
    • View Profile
    • Z's Roguelike Stuff
Re: ncurses and c++
« Reply #6 on: June 23, 2008, 11:37:40 AM »
I second your hate for text emulation... Either use real text (with Curses) or real graphics (with SDL). The best is to have both as options.

In case if there is a problem with bool, you could try this instead of modifying ncurses: (disclaimer: I have not tried it, that's just an idea)

#define bool ncurses_bool
#include <ncurses.h>
#undef bool

fecal_brunch

  • Newcomer
  • Posts: 5
  • Karma: +0/-0
    • View Profile
    • Email
Re: ncurses and c++
« Reply #7 on: June 24, 2008, 10:30:14 AM »
That is such an obvious idea I can't believe I didn't think of it, hah. I'll see how it goes. Thanks.
Still working out how the backend is going to work.