home *** CD-ROM | disk | FTP | other *** search
- //---------------------------------------------------------------------------
- //
- // File: DISPLAY.HPP
- // Path: ...\REHACK\graphics
- // Version: 1.1
- // Author: Dave Boynton
- // CIS Id: 71043,317
- // Created On: 6/26/93
- // Modified On: 7/25/93
- // Description: Display class
- // Tabs: 4
- //
- //---------------------------------------------------------------------------
- // copyright (c) 1993 by the GAMERS Forum, Rehack project team.
- // All rights reserved.
- #ifndef _DISPLAY_HPP
- #define _DISPLAY_HPP
-
- #include "..\general\types.hpp"
- #include "..\general\misc.hpp"
- #include "..\graphics\bitmap.hpp"
-
- class DisplayManager {
- public:
- Point size;
- Rect bounds;
- bool retrace; // true if we should respect retraces
- int videoSegment;
-
- DisplayManager(word Flags); // if 1, retrace=false, else retrace=true
-
- static const word getWidth(void) { return 320; }
- static const word getHeight(void) { return 200; }
- static void setMode(const int Mode=0x13);
- static void setPalette(const byte *Palette);
- static void blankScreen(void);
- static void unblankScreen(void);
- static void waitForVerticalRetrace(void);
- static void waitForHorizontalRetrace(void);
-
- // replacement for <assert.h>'s __assertfail, to reset screen mode
- // before aborting.
- static void assertfail( char *__msg, char *__cond,
- char *__file, int __line);
-
- // these can't be static until I figure out how to handle
- // initializing videoSegment safely.
- Bitmap * getDirectBitmap(void);
- void putBitmap(Bitmap *); // entire viewPort, in it's ownerBounds
- void putBitmap(Bitmap *,int xoff,int yoff, int xsize, int ysize);
- // following untested
- void putBitmap(Bitmap *, const Point &at);
- void putBitmap(Bitmap *src, const Rect &destRect);
- };
-
- // ---------------------------- assert -------------------------------
- // the following implements "assert()", which would ordinarily abort the
- // user while still in graphics mode, not a pretty sight. Don't include
- // <assert.h> if you want to use this, just use assert( <condition> ); as
- // you would normally.
- #if !defined(___DEFS_H)
- #include <_defs.h>
- #endif
-
- #ifdef __cplusplus
- extern "C" {
- #endif
- // this is still used by DisplayManager::assertfail(), after resetting mode
- void _Cdecl _FARFUNC __assertfail( char _FAR *__msg,
- char _FAR *__cond,
- char _FAR *__file,
- int __line);
-
- #ifdef __cplusplus
- }
- #endif
-
- #undef assert
-
- #ifdef NDEBUG
- # define assert(p) ((void)0)
- #else
- # define assert(p) ((p) ? (void)0 : (void) DisplayManager::assertfail( \
- "Assertion failed: %s, file %s, line %d\n", \
- #p, __FILE__, __LINE__ ) )
- #endif // NDEBUG
-
- #endif // _DISPLAY_HPP
-
-