home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c100 / 1.ddi / SNAV0111.ZIP / DEMO1.HPP < prev    next >
Encoding:
C/C++ Source or Header  |  1990-04-16  |  3.3 KB  |  101 lines

  1. //          ┌───────┐
  2. //    ─────────>│ AVNER │
  3. //    ─────────>│  BEN  │──────> Software Engineering Method
  4. //          └───────┘
  5. //    10 Dov-Hoz st. Tel-Aviv 63416 Israel tel. 972-3-221535
  6.  
  7. // The Screen NAVigator, ver 1.10 April 1990
  8. // Copyright (c) 1989 by Avner Ben
  9. // Snav is not, and never was, free software.
  10. // for conditions for use refer to file "copyrigh.txt"
  11.  
  12. // The Screen Navigator is an object-oriented device-independent
  13. // character-graphics driver package, written in the C++ language,
  14. // distributed in the form of C++ source code.
  15. // For further information refer to the documentation files.
  16.  
  17. // this simple example is intended as a template to be extended and modified
  18. // by the user, provided the above title and copyright notice are unchanged
  19. // and are not ommitted.
  20.  
  21. /***************************************************************************/
  22.  
  23. // demonstration part 1 - headers.
  24. // a simplistic screen driver for the IBM-PC/compatiable running MS-DOS,
  25. // implementing the virtual functions of the generic screen-driver supplied
  26. // in snav-2.
  27. // This simple demo is very device-specific, addressing the machine's
  28. // internal architecture (it is a "misbehaved" program). It is also
  29. // Zortech-specific, in assuming the existence of some names and include
  30. // files.
  31. // Do not compile with the /Ansi switch on, because dos.h uses far-pointers.
  32.  
  33. // 28.8.89 avner ben coded.
  34. ////// snav v1.0
  35. // 26.10.89 avner ben - adpated for snav demo.
  36. ////// snav v1.1
  37. // 13.12.89-11.4.90 avner ben:
  38. // * added class square_pos and removed to snav2 *  added  color and cursor
  39. // processing * removed some function to generic driver *
  40.  
  41. // site history (of this copy):
  42. // __.__.__: __________________
  43.  
  44. #ifndef DEMO1_H
  45.  
  46. #define DEMO1_H
  47. #ifndef SNAV2_H
  48. #include "snav2.hpp"
  49. #endif
  50.  
  51. class memory_mapped_pc_screen : public panel
  52. { // implementation of the generic class panel, assuming PC architecture
  53.  
  54.     private :
  55.         struct    vd_char {                 // video cell
  56.             char c;
  57.             unsigned char color;
  58.         } *vdc, *stvdc;
  59.         unsigned int color_code;    // internal-format color combi
  60.         struct save_screen {
  61.             char *s;
  62.             save_screen *next;
  63.             void kill(void);
  64.         } *svbuf;
  65.         color_ind decode_color(unsigned int color_code);
  66.         unsigned int encode_color(const color_ind &color);
  67.  
  68.     public :
  69.         memory_mapped_pc_screen(square_pos *window=NULL,
  70.          boolean wrap_around=FALSE);
  71.         // default size 1:1x25:80
  72.  
  73.         char get_c(point_pos *pt);
  74.         // get char displayed in specified position (no kbd input)
  75.         void put_c(char c, point_pos *pt, direction *dir);
  76.         // write a character on screen
  77.         void put_color(const color_ind &at, point_pos *pt);
  78.         // set color locally
  79.         void put_attr(vd_attr at, point_pos *pt);
  80.         // toggle attribute in specified/cursor position
  81.         void put_background(vd_clr colornum, point_pos *pt);
  82.         // set background color in specified/cursor position
  83.         void put_forground(vd_clr colornum, point_pos *pt);
  84.         // set forground color in specified/cursor position
  85.         boolean get_attr(vd_attr at, point_pos *pt);
  86.         // retrieve color locally
  87.         color_ind get_color(point_pos *pt);
  88.         // retrieve color locally
  89.         void posit(point_pos *pt);
  90.         // position cursor
  91.         void fix(void);
  92.         void save(void);
  93.         void restore(void);
  94.         unsigned int ask_cursor(void);
  95.         void set_cursor(unsigned int cursor_type);
  96.         unsigned int hide_cursor(void);
  97. };
  98.  
  99. #endif
  100.  
  101.