/* File "CS35win.h"
   This file contains defines some functions that are useful for windows.
   It also invokes the   "CS35files.h"   header, 
   		which invokes all the other CS35 functions  
   
*/

#include "CS35files.h"
#include <ncurses.h>

void beginwin ();
	/* This function initiates the C++ graphics routine.
	   For successful use, two things are necessary:
	   	a) The window must be closed at the end of the program, using endwin()
	   	b) The compilation line must be longer, of the form:
	   			$ c++ program_name.cpp -lncurses
	   cin and cout don't work well within a window; 
	   		For input,  use getch, getstr
	   		For output, use addch or addstr
	*/
		
void win_new_line ();
void w_new_line ();
	// To "flush" to the end of a line of input in stdwin

void beginwin ()
{
	WINDOW* stdscr=initscr();  // puts a window in the STanDard SCReen
	
//  The following seem to be recommended; In some cases, I'm not sure why

	cbreak();	// allows immediate character processing - no "buffering"
	echo();						// "echos" any characters you type in
	intrflush(stdscr, FALSE);
	keypad (stdscr, TRUE);		// Allows use of "function" keys
	
//  The following is CRUCIAL
	refresh();					//Clears the "window" for your use!
}

void win_new_line()
{
	char dummy;
	do
	{
		dummy = getch();
	} while (dummy != '\n');
}

void wnew_line()
{
	win_new_line();
}




