#ifndef __SCREEN_H
#define __SCREEN_H

#ifdef __SVGALIB__
struct AreaBuffer
{
  int   width;
  int   height;
  char* buffer;
};
#endif

#ifdef __TOOLLIB__
#include "standard.h"
//typedef MEM_BILD AreaBuffer;
#define AreaBuffer MEM_BILD
#endif


// defines

#define MMOUSE_UNKNOWNBUTTON 0
#define MMOUSE_LEFTBUTTON    1
#define MMOUSE_MIDDLEBUTTON  2
#define MMOUSE_RIGHTBUTTON   3

// globals

typedef int Color;
typedef int Bool;

class Screen
{
 public:
  virtual int start( void ) = 0;

  virtual int mouseCallback( void ) { return 0; };
  virtual int keyCallback( int key ) { return key; };


  virtual int open( void )  = 0;
//  int reopen( void ) ;
  virtual int close( void )  = 0;

  virtual int mouseX( void )  = 0;             // Maus X-Position holen
  virtual int mouseX( int ) = 0;        // Maus X-Position setzen und holen
  virtual int mouseY( void )  = 0;             // Maus Y-Position holen
  virtual int mouseY( int ) = 0;        // Maus Y-Position setzen und holen
  virtual int mouseButton( void )  = 0;        // Maus Button abfragen
  virtual int getKey( void )  = 0;             // liefert die gedrueckte Taste
  virtual int getChar( void )  = 0;            // liefert die gedrueckte Taste

  virtual int drawPoint( int x, int y, Color color ) = 0;
  virtual int clearPoint( int x, int y ) = 0;
  virtual int getPoint( int x, int y ) = 0;
  virtual int drawLine( int x1, int y1, int x2, int y2, Color color ) = 0;
  virtual void drawCircle( int x, int y, int radius, Color c ) = 0;


  virtual int   print( int x, int y, char* text ) = 0;
  virtual int   print( int x, int y, char c ) = 0;
  virtual void  setFgc( Color c ) { fgc = c; };
  virtual Color getFgc( void ) { return fgc; };
  virtual void  setBgc( Color c ) { bgc = c; };
  virtual Color getBgc( void ) { return bgc; };
  virtual int   getFontHeight( void ) { return fontHeight; };
  virtual int   getFontWidth( void ) { return fontWidth; };
  virtual int   getXRes( void ) { return xRes; }
  virtual int   getYRes( void ) { return yRes; }

  virtual void mouseOn( void ) = 0;
  virtual void mouseOff( void ) = 0;

  virtual void clearScreen( void )  = 0;
  virtual int isError( void )  = 0;

// Farben
  virtual Color Grey()  { return grey; };
  virtual Color Red()   { return red; } ;
  virtual Color White() { return white; } ;
  virtual Color Black() { return black; } ;

  virtual AreaBuffer* getArea( int x, int y, int width, int height ) = 0;
  virtual int putArea( int x, int y, AreaBuffer* buffer ) = 0;
  virtual int setArea( int x, int y, int width, int height, Color c ) = 0;
  virtual int freeArea( AreaBuffer* buffer ) = 0;
  virtual AreaBuffer* cloneArea( AreaBuffer* ) = 0;

 protected:
  int error;
  int fontHeight;
  int fontWidth;
  int xRes, yRes;
  Color fgc;     // Foregroundcolor
  Color bgc;     // Backgroundcolor
  Color black;
  Color white;
  Color red;
  Color grey;
};

#ifdef __SVGALIB__
#include "unix/svgascreen.h"
#endif

#ifdef __TOOLLIB__
#include "dos/tscreen.h"
#endif

#endif //__SCREEN_H
