1 #ifndef SCREENDEVICE_H 2 #define SCREENDEVICE_H 3 4 #ifdef UNIX_X 5 #include "EgCommon.h" 6 #include "PixPort.h" 7 #endif 8 9 // ### If Mac, in your global header, define USE_DRAW_SPROCKETS 1 or USE_DISP_MGR 1 if you want full screeen ability!!! 10 // ### If Win, in your global header, define USE_DIRECTX 1 if you want full screeen ability!!! 11 12 #if EG_WIN 13 14 typedef RGBQUAD PixPalEntry; 15 16 #if USE_DIRECTX 17 #include <ddraw.h> 18 #else 19 typedef long LPDIRECTDRAW; 20 typedef long LPDIRECTDRAWSURFACE; 21 #endif 22 #endif 23 24 25 26 #if EG_MAC 27 #include <QuickDraw.h> 28 #include <QDOffscreen.h> 29 #include <LowMem.h> 30 31 typedef ColorSpec PixPalEntry; 32 33 34 #if USE_DISP_MGR 35 #undef USE_DRAW_SPROCKETS 36 #include "RequestVideo.h" 37 #elif USE_DRAW_SPROCKETS 38 #include <DrawSprocket.h> 39 #else 40 typedef long DSpContextReference; 41 struct DSpContextAttributes { }; 42 #endif 43 #else 44 #endif 45 46 47 48 49 /* An instance of a ScreenDevice represents a structure that can tell 50 a screen device to go into full screen mode. */ 51 52 class ScreenDevice { 53 54 55 public: 56 57 // Returns true if EnterFullscreen() can work for any device 58 //bool FullscreenAvail() { return mCanFullscreen; } 59 60 61 ScreenDevice(); 62 ~ScreenDevice(); 63 64 // Two different ways to obtain a display ID... 65 // Use the long returned here for EnterFullscreen()... 66 // Returns the (inDeviceNum)th display ID 67 static long GetDisplayID( long inDeviceNum ); 68 // Returns a display ID that contains the given global coordinate 69 static long GetDisplayID( long inX, long inY ); 70 71 // Returns true if this ScreenDevice is currently fullscreen (ie, if EnterFullscreen has been called) IsFullscreen()72 inline bool IsFullscreen() { return mContextRef != 0; } 73 74 // Use these fcns to enter & exit fullscreen mode. ioSize contains the desired screen size 75 // on entry and contains the final fullscreen res dimentions upon return. 76 // inWin expands to fit fullscreen size if in Windows *or* we're no using mac drawsprockets 77 bool EnterFullscreen( long inDispID, Point& ioSize, int inBitDepth, WindowPtr inWin ); 78 void ExitFullscreen(); 79 80 // Encase these before using the port returned by GetPort(); 81 // Be sure this is called before and after *any* of the following calls 82 GrafPtr BeginFrame(); 83 void EndFrame(); 84 85 void SetPalette( PixPalEntry inPal[ 256 ] ); 86 87 static long sMinDepth; 88 static long sOSDepth; 89 90 91 protected: 92 93 long mDispID; 94 long mBitDepth; 95 GrafPtr mFS_DC; 96 97 #if USE_DRAW_SPROCKETS 98 DSpContextReference mContextRef; 99 DSpContextAttributes mContext; 100 #elif USE_DISP_MGR 101 GrafPtr mContextRef; 102 RgnHandle mMenuBarRgn; 103 long mMenuBarHeight; 104 #elif EG_WIN 105 LPDIRECTDRAWSURFACE mContextRef; 106 LPDIRECTDRAW mDDObj; 107 LPDIRECTDRAWPALETTE FAR mFS_Palette; 108 HWND mFS_Win; 109 #else 110 long mContextRef; 111 #endif 112 113 114 }; 115 116 #endif 117