home *** CD-ROM | disk | FTP | other *** search
/ C!T ROM 2 / ctrom_ii_b.zip / ctrom_ii_b / PROGRAM / C / OMEGA2 / OMSCREEN.HPP < prev    next >
C/C++ Source or Header  |  1992-04-25  |  5KB  |  168 lines

  1. //
  2. // *************************************************************************
  3. // *                                                                       *
  4. // *    OMEGA C++ Windowing Class Library                                  *
  5. // *    =================================                                  *
  6. // *                                                                       *
  7. // *    Copyright 1991,92 Tom Clancy                                       *
  8. // *    Submitted to the public domain, April 1992                         *
  9. // *                                                                       *
  10. // *************************************************************************
  11. // *                                                                       *
  12. // *    Screen Class Object                                                *
  13. // *                                                                       *
  14. // *************************************************************************
  15. //
  16.  
  17.  
  18. #ifndef _OMSCREEN
  19. #define _OMSCREEN
  20. #endif
  21.  
  22. #ifndef _OMEVENT
  23. #include "omevent.hpp"
  24. #endif
  25.  
  26.  
  27. #define DOUBLEBAR    1
  28. #define SINGLEBAR    0
  29.  
  30. #define v80x25       0
  31. #define wisev80x30   1
  32. #define wisev80x43   2
  33. #define wisev80x60   3
  34.  
  35. #define wisev132x25  4
  36. #define wisev132x30  5
  37. #define wisev132x43  6
  38. #define wisev132x60  7
  39.  
  40. #define ON    1
  41. #define OFF   0
  42.  
  43. #define TRUE  1
  44. #define FALSE 0
  45.  
  46. enum boxchars {
  47.   vertbar,
  48.   horizbar,
  49.   upperleft,
  50.   upperright,
  51.   bottomleft,
  52.   bottomright,
  53.  
  54. };
  55.  
  56. enum Shdirection {
  57.   shNoshadow,
  58.   shTopleft,
  59.   shTopright,
  60.   shBottomleft,
  61.   shBottomright,
  62. };
  63.  
  64.  
  65. int  video_mode();
  66. void OMEGA_SETUP();
  67.  
  68. class oScreen : public event_handler {
  69.  
  70.   char far *vscreen;
  71.   char far *screenbuff;
  72.  
  73.   int  FGcolor, BKcolor;
  74.   int  Fillchar;
  75.   static int  vActive;
  76.  
  77.  
  78. public:
  79.  
  80.   struct image {
  81.     int len, wid;
  82.     char *i;
  83.   };
  84.  
  85.   oScreen();
  86.  
  87.   // screen setting methods
  88.  
  89.   virtual void setfgcolor(int fg) {FGcolor=fg;}
  90.   virtual void setbkcolor(int bk) {BKcolor=bk;}
  91.   void setfillchar(int c) {Fillchar=c;}
  92.   void setvidmode(int m);
  93.   void restoreoldvmode();
  94.   int  setvga43();
  95.   int  setvga50();
  96.  
  97.   virtual int  getfgcolor()       {return FGcolor;}
  98.   virtual int  getbkcolor()       {return BKcolor;}
  99.   int  getfillchar()      {return Fillchar;}
  100.   int  getscreenlen();
  101.   int  getscreenwid();
  102.   unsigned getvvseg();
  103.   unsigned getvvofs();
  104.  
  105.   // fastwrite methods
  106.  
  107.   virtual void writeat(int x, int y, int fg, int bk, char *str);
  108.   virtual void plainwriteat(int x, int y, char *str);
  109.   virtual void chwriteat(int x, int y, int fg, int bk, unsigned char c);
  110.   virtual void plainchwriteat(int x, int y, unsigned char c);
  111.   virtual void writeshadow(int x, int y);
  112.   void writecenter(int y, int fg, int bk, char *str);
  113.   void writebetween(int y, int x1, int x2, int fg, int bk, char *str);
  114.  
  115.   virtual void attribln(int y, int x1, int x2, int fg, int bk);
  116.   void fillarea(int x, int y, int x2, int y2, int fg, int bk, char c);
  117.   void fillscreen(int fg, int bk, char c);
  118.   void clearline(int y, int fg, int bk);
  119.   void clearline(int y, int x1, int x2, int fg, int bk);
  120.   void attribarea(int x, int y, int x2, int y2, int fg, int bk);
  121.   void attribscreen(int fg, int bk);
  122.   void clrscr();
  123.  
  124.   void drawline(int y, int x1, int x2, int fg, int bk, int style);
  125.   void drawbox(int x, int y, int x2, int y2, int fg, int bk, int style);
  126.   void drawhollowbox(int x, int y, int x2, int y2, int fg, int bk, int style);
  127.  
  128.   // Absolute Screen Writes (for use with things that need to be absolute!)
  129.  
  130.   void abswritecenter(int y, int fg, int bk, char *str);
  131.   void abswritebetween(int y, int x1, int x2, int fg, int bk, char *str);
  132.   void absfillarea(int x, int y, int x2, int y2, int fg, int bk, char c);
  133.   void absfillscreen(int fg, int bk, char c);
  134.   void absclearline(int y, int fg, int bk);
  135.   void absclearline(int y, int x1, int x2, int fg, int bk);
  136.   void absattribarea(int x, int y, int x2, int y2, int fg, int bk);
  137.   void absattribscreen(int fg, int bk);
  138.   void absclrscr();
  139.   void absdrawline(int y, int x1, int x2, int fg, int bk, int style);
  140.   void absdrawbox(int x, int y, int x2, int y2, int fg, int bk, int style);
  141.  
  142.   // cursor methods
  143.  
  144.   void cursoron();
  145.   void cursoroff();
  146.   void linecursor();
  147.   void blockcursor();
  148.   virtual void movexy(int x, int y);
  149.   virtual void wherexy(int &x, int &y);
  150.  
  151.   // screen and image saving methods
  152.  
  153.   void save_screen();
  154.   void show_screen();
  155.   void restore_screen();
  156.   char *save_image(int x, int y, int x2, int y2, image &im);
  157.   void show_image(int x, int y, image im);
  158.   void restore_image(int x, int y, image &im);
  159.  
  160.   // virtual screen methods
  161.  
  162.   void activate_virtual();
  163.   void deactivate_virtual();
  164.   void display_virtual();
  165.   void run(){return;}
  166. };
  167.  
  168.