#ifndef __GRAPHIC_H
#define __GRAPHIC_H

#include "screen.h"

typedef int Color;
typedef int Bool;


// class definitions

class Position
{
  public:
    Position( void );
    Position( int x0, int y0 );
    Position( Position& p );
    virtual inline int  getX();
    virtual inline int  getY();
    virtual inline void setX(int nx);
    virtual inline void setY(int ny);
    virtual inline void set(int nx, int ny);

    virtual inline Position  operator=  ( Position cp );
    virtual inline Bool      operator== ( Position& cp );
    virtual inline Bool      operator!= ( Position& cp );
    virtual inline Position  operator+  ( Position& cp );
    virtual inline Position  operator-  ( Position& cp );
    virtual inline Position& operator+= ( Position& cp );
    virtual inline Position& operator-= ( Position& cp );

  protected:
    int x, y;
};

//
// class gObject
// abstrakte Basisklasse fuer Graphicobjekte
//
class GObject: public Position
{
  public:
    GObject( Screen* newScreen, int x0, int y0 );
    virtual void drawPoint( int x, int y, Color c = -1 );
    virtual void draw( void ) = 0;
    virtual void move( int dx, int dy );
    virtual void moveTo( int newX, int newY );
    virtual void saveBackground( void ) = 0;
    virtual void restoreBackground( void ) = 0;

    virtual void setColor( Color color );
    virtual void highlight( void );

    virtual Bool isOver( int x, int y ) = 0;

    virtual int North( void ) = 0;
    virtual int South( void ) = 0;
    virtual int East( void ) = 0;
    virtual int West( void ) = 0;
  protected:
    Screen* screen;
    Color   color;
    int     cOldX, cOldY; // alte position fuer savebackground()
    int     savedBackground; // wurde der Hintergrund schon gespeichert
};

#endif //__GRAPHIC_H
