/* -*-C-*-
********************************************************************************
*
* File:         screenio.c
* RCS:          $Header: screenio.c,v 1.1 93/03/19 14:25:06 mjp Exp $
* Description:  Fancy color screen IO routines for emaxutil
* Author:       Mike Prudence, (mjp@hplb.hpl.hp.com)
* Created:      Wed Mar 17 15:04:03 1993
* Modified:     Fri Mar 19 14:10:58 1993 (Mike Prudence) mjp@prudence
* Language:     C
*
* (c) Copyright 1993, Mike Prudence
*
********************************************************************************
*/

#include <stdio.h>
#include <graph.h>
#include "screenio.h"

/*
 * Screen IO routines 
 *
 */

void write_text (x, y, c, s)
   int x, y, c;
   char *s;

{
   int oldcolor;

   _wrapon (_GWRAPOFF);

   oldcolor = _gettextcolor();

   /* write text at position (x, y), color c, string s */

   _settextcolor (c);
   _settextposition (y, x);
   _outtext(s);

   _settextcolor(oldcolor);
}

void clear_screen ()
{
   _clearscreen(_GCLEARSCREEN);

}

void new_screen (s)
   char *s;
{
    int x;

   _clearscreen (_GCLEARSCREEN);
   x=(SCREEN_WIDTH-strlen(s)) / 2;
   write_text(x, 1, 2, s);

}

void write_error (s)
   char *s;

{
  /* Write the error message, and then wait for input */

    write_text (10, 22, 12, s);
    write_text (10, 24, 12, "Hit any key to continue....");

    while (!getch()) ;

    write_text (1, 22, 1, BLANK_LINE);
    write_text (1, 24, 1, BLANK_LINE);
}

void cursor_off ()
{
   _displaycursor(_GCURSOROFF);
}

void cursor_on ()
{
   _displaycursor (_GCURSORON);
}
