Thread: "real-time" user-input and graphics

  1. #1
    Registered User
    Join Date
    Dec 2008
    Posts
    19

    Question "real-time" user-input and graphics

    Hello world!
    I was wondering about what should I need to develop simple, ASCII graphics applications, that are "more interactive", than the standard input. What I mean is, like developing a console-based file browser, like norton commander. How can I achieve that kind of "real-time" input-output? How can I make the program react to pressing a button, without an enter being hit? How can I make the cursos "jump around" the screen, where I need it? I could not find anything like these, with the use of the standard library, and other stuff, like SDL provide much more, than I need. I only want some "old-school" ASCII graphics software, which would be used from console, with a simple keyboard. Well, anyone has any experiences on this topic? Thanks!

  2. #2
    Registered User
    Join Date
    Sep 2007
    Posts
    1,012
    Use curses (ncurses being the popular free implementation) if you're on a Unix-like system. I don't know about others.

  3. #3
    Registered User
    Join Date
    Dec 2008
    Posts
    19
    Thanks, I'll check it out. I would like it to be platform-independent.

  4. #4
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Quote Originally Posted by laczfinador View Post
    Thanks, I'll check it out. I would like it to be platform-independent.
    If you're using cursor moves, real time input, etc. it's not going to be very portable at all. Each OS has it's own way of displaying a CMDL interface and, for the most part, they're quite dissimilar.

    At the risk of stepping in it...
    Why on earth would anyone want to write a console mode file browser?

  5. #5
    THANK YOU KINDLY SIR Phenax's Avatar
    Join Date
    Mar 2011
    Posts
    74
    Quote Originally Posted by laczfinador View Post
    Thanks, I'll check it out. I would like it to be platform-independent.
    NCurses is pretty popular on Unix-like operating systems, but there is PDCurses for Windows. PDCurses has a lot of compatibility functions to help it act like NCurses. And a lot of the functions have the same behavior. They're both based on the same library.
    Using NCurses/PDCurses and a couple of ifdefs for which one the person is using, and you should be fine. Alternatively, you can make an NCurses application and compile it using Cygwin, which provides a POSIX environment on Windows. Your application will be linked against cygwin's POSIX library and not Microsoft's, so your application may be a little "heavier" but it's a good solution.

    Edit: Also, check this out for PDCurses. http://www.projectpluto.com/win32a.htm .
    Last edited by Phenax; 03-15-2011 at 10:58 AM.
    Quote Originally Posted by Plato
    Never discourage anyone...who continually makes progress, no matter how slow.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. help me with this c graphics program
    By arunstar008 in forum C Programming
    Replies: 11
    Last Post: 01-17-2010, 08:23 AM
  2. Turtle Graphics (debug help)
    By impact201 in forum C Programming
    Replies: 5
    Last Post: 07-14-2006, 01:45 PM
  3. text input in graphics mode
    By jamie in forum C++ Programming
    Replies: 1
    Last Post: 03-17-2003, 10:33 PM
  4. Input a string in graphics mode?
    By Vegettų in forum C++ Programming
    Replies: 3
    Last Post: 03-08-2002, 06:34 PM
  5. How to accept input in graphics mode
    By nurulsiddik in forum C Programming
    Replies: 1
    Last Post: 02-13-2002, 10:40 AM

Tags for this Thread