Skip to content
Damon Getsman edited this page Jan 29, 2015 · 1 revision

mncurses

My Ncurses routines

Just in case you had problems putting that together.

Synopsis

I'm just going to keep this really simple for now, since this project is just getting cobbled together haphazardly. Right now I'm trying to push this through to the point where I can make a console-based flashcards program for my son to practice his multiplication with, where he's gotten a little bit behind due to illness. So for now I'm just pushing this library through to the point where I can center stuff on the screen and pull input back without destroying the screen format too terribly much.

Structure

Defines

  • MAX_LEN - set to 78 for a standard 80 column terminal to avoid issues with wrapping
  • DEBUGGING - currently set (derp)
  • VERBOSE - set to 1 (used in conjunction with DEBUGGING for now)

Typedefs

  • pauseType - enum: FULL, HALF -- this is as per standard ncurses pause functionality

Basal functions

  • bool init_ncurses(WINDOW *priscr) - setup for init utilizing a screen w/half second pause when displaying any error message regarding any inability to init curses mode/capability
  • void end_ncurses(WINDOW *priscr) - self-explanatory, I hope
  • int ypos_for_center(int my, int ln) - determines the y position to begin printing a block of text at for vertical centering purposes
  • int xpos_for_center(int mx, int col) - same for x
Clone this wiki locally