home *** CD-ROM | disk | FTP | other *** search
/ Stars of Shareware: Programmierung / SOURCE.mdf / programm / msdos / pascal / rehack / graphics / display.hpp < prev    next >
Encoding:
C/C++ Source or Header  |  1993-07-26  |  2.8 KB  |  90 lines

  1. //---------------------------------------------------------------------------
  2. //
  3. //      File:           DISPLAY.HPP
  4. //      Path:           ...\REHACK\graphics
  5. //      Version:                1.1
  6. //      Author:         Dave Boynton
  7. //      CIS Id:            71043,317
  8. //      Created On:     6/26/93
  9. //      Modified On:    7/25/93
  10. //      Description:    Display class
  11. //      Tabs:           4
  12. //
  13. //---------------------------------------------------------------------------
  14. // copyright (c) 1993 by the GAMERS Forum, Rehack project team.
  15. // All rights reserved.
  16. #ifndef _DISPLAY_HPP
  17. #define _DISPLAY_HPP
  18.  
  19. #include "..\general\types.hpp"
  20. #include "..\general\misc.hpp"
  21. #include "..\graphics\bitmap.hpp"
  22.  
  23. class DisplayManager {
  24.     public:
  25.         Point size;
  26.         Rect bounds;
  27.         bool retrace; // true if we should respect retraces
  28.         int videoSegment;
  29.  
  30.         DisplayManager(word Flags); // if 1, retrace=false, else retrace=true
  31.  
  32.         static const word getWidth(void) { return 320; }
  33.         static const word getHeight(void) { return 200; }
  34.         static void setMode(const int Mode=0x13);
  35.         static void setPalette(const byte *Palette);
  36.         static void blankScreen(void);
  37.         static void unblankScreen(void);
  38.         static void waitForVerticalRetrace(void);
  39.         static void waitForHorizontalRetrace(void);
  40.  
  41.         // replacement for <assert.h>'s __assertfail, to reset screen mode
  42.         // before aborting.
  43.         static void assertfail( char *__msg, char *__cond,
  44.                                 char *__file, int __line);
  45.  
  46.         // these can't be static until I figure out how to handle
  47.         // initializing videoSegment safely.
  48.         Bitmap * getDirectBitmap(void);
  49.         void putBitmap(Bitmap *); // entire viewPort, in it's ownerBounds
  50.         void putBitmap(Bitmap *,int xoff,int yoff, int xsize, int ysize);
  51.         // following untested
  52.         void putBitmap(Bitmap *, const Point &at);
  53.         void putBitmap(Bitmap *src, const Rect &destRect);
  54. };
  55.  
  56. // ---------------------------- assert -------------------------------
  57. // the following implements "assert()", which would ordinarily abort the
  58. // user while still in graphics mode, not a pretty sight. Don't include
  59. // <assert.h> if you want to use this, just use assert( <condition> ); as
  60. // you would normally.
  61. #if !defined(___DEFS_H)
  62. #include <_defs.h>
  63. #endif
  64.  
  65. #ifdef __cplusplus
  66. extern "C" {
  67. #endif
  68. // this is still used by DisplayManager::assertfail(), after resetting mode
  69. void _Cdecl _FARFUNC __assertfail( char _FAR *__msg,
  70.                                    char _FAR *__cond,
  71.                                    char _FAR *__file,
  72.                                    int __line);
  73.  
  74. #ifdef  __cplusplus
  75. }
  76. #endif
  77.  
  78. #undef assert
  79.  
  80. #ifdef NDEBUG
  81. #  define assert(p)   ((void)0)
  82. #else
  83. #  define assert(p) ((p) ? (void)0 : (void) DisplayManager::assertfail( \
  84.                     "Assertion failed: %s, file %s, line %d\n", \
  85.                     #p, __FILE__, __LINE__ ) )
  86. #endif // NDEBUG
  87.  
  88. #endif // _DISPLAY_HPP
  89.  
  90.