- ********** the class cursWindow *************************************
- Constructor/Deconstructor
- =========================
- The constructor is overloaded by two functions:
- cursWindow(int x, int y, int x2, int y2)
- cursWindow(int x, int y)
- The first constructor takes x and y as the top right hand corner, and x2 y2 as the bottom left hand corner of the window to define.
- The second constructor again has x and y as the top right hand corner, but it defaults to a window with the size of 40X35.
- The deconstructor simply deletes all memory used by the window created.
- Create a new window at x,y (from 0,0 of SCREEN) to x2,y2 relative to SCREEN origin
- cursWindow(int x, int y, int x2, int y2);
- cursWindow(int x, int y);
- ~cursWindow();
- void clearWin(); erase everything in the window
- ACCESS METHODS:
- ===================
- int maxX() { return maxx; } tell me # of columns
- int maxY() { return maxy; } tell me # of lines
- MOVE METHODS
- ================
- Move the window within the SCREEN
- This functions takes the window inside the class and moves the top right hand corner to point x, y.
- void moveTo(int x, int y);
- Move JUST the cursor (doesn't print anything)
- void moveCursor( int x, int y);
- NEXT METHODS
- ================
- NEXT values based on any X,Y and dimensions of WINDOW
- THESE DO NOT CHANGE THEIR ARGUMENTS
- int nextX(int x); get the next X value with wrap
- int nextY(int y); get the next Y value with wrap
- int prevX(int x); get the previous X value with wrap
- int prevY(int y); get the previous Y value with wrap
- POINT: tell me the next point given the current location ( Point) and the given direction
- Point NextP( Point P, int direction );
- Point PrevP( Point P, int direction );
- OUTPUT METHODS
- ===================
- void frame(); print a frame around edge of window leaving one "blank" line at bottom for input
- Print at the current cursor location [single character, a string, or a number]
- void print(char letter);
- void print(char* string);
- void print(int number);
- put a character in the window at specified location this time x,y is relative to top left corner of window
- leaves cursor at char just printed
- void put(int x, int y, char letter);
- INPUT METHODS
- =================
- find out which character is at the given location
- leaves cursor where it was before call
- char peek( int x, int y );
- reads characters typed by user
- reads from current cursor location
- void getInput(char& inp, bool ech); ech == echo character
- void getInput(char* inp);
- The former will wait until the user hits one key and stores it into character.
- The second flag determines if the kepress is printed to the screen. This flag is defaulted to true, so no argument is required unless one does not want echo.
- The latter will take input until the user hits the enter key, and store the resulting string into str. This functions always echos to the screen. The delete key works as it would with cin.
- OUTPUT & INPUT
- =================
- char prompt(char letter); prints a prompt at bottom of screen and
- returns the character that the user typed
- leaves cursor at location of user input