//---------------------------------------------------------------------------
// Double bufferering class
//---------------------------------------------------------------------------

#define  NumOT     19
#define  NumPolys  128      ////////////256
#define  NumSpr    256
#define  NumPlain   64      ////////////512
#define  NumGouraud 16
#define  NumDrMode 128      ////////////256

//-------------------------------------
// Class definition
//-------------------------------------
class DoubleBuffer
{
   private:
   u_long   OT[2][NumOT];
   int      PolyPtr[2];
   int      PlainPtr[2];
   int      SprPtr[2];
   int      GouraudPtr[2];
   int      DrModePtr[2];
   int      timecnt1, timecnt2;
   int      framecnt, framepersec;
   int      level;
   int      Index;
   POLY_FT4 Poly[2][NumPolys];
   POLY_F4  Plain[2][NumPlain];
   POLY_G4  Gouraud[2][NumGouraud];
   SPRT     Spr[2][NumSpr];
   DR_MODE  Dr_Mode[2][NumDrMode];
   DRAWENV  Draw[2];
   DISPENV  Disp[2];
   
   public:
   DoubleBuffer (int x1 = 0, int y1 = 240, int x2 = 0, int y2 = 0,
                 int w = 320, int h = 240);
   void Swap (int debug);
   void ClearDrawArea (char r, char g, char b);
   void Add_Poly (POLY_FT4 *poly, int depth);
   void Add_Plain (POLY_F4 *plain, int depth);
   void Add_Spr (SPRT *spr, int depth);
   void Add_DrMode (DR_MODE *drmode, int depth);
   SPRT *Get_Spr (void);
   POLY_FT4 *Get_Poly (void);
   POLY_F4 *Get_Plain (void);
   DR_MODE *Get_DrMode (void);
   POLY_G4 *Get_Gouraud (void);
   void Add_Gouraud (POLY_G4 *poly, int depth);
   void FlashScreen (void);
};
