/*=========================================================================== * * DDSurfMode.H - Dave Humphrey (uesp@m0use.net) - 12 November 2000 * *=========================================================================*/ #ifndef __DDSURFMODE_H #define __DDSURFMODE_H /* Required Includes */ #include "d3dcom.h" /*=========================================================================== * * Class CDDSurfaceMode Definition * *=========================================================================*/ class CD3DApp; class CDDSurfaceMode { /*---------- Begin Protected Class Members --------------------------*/ protected: CDirectDraw* pDirectDraw; /* Main DirectDraw object */ CDDSurface* pPrimarySurface; /* Main device surface */ CDDClipper* pClipper; /* Clipper for primary surface */ CDDPalette* pDDPalette; /* DirectDraw palette */ HWND hMainWindow; /* The main output window handle */ CD3DApp* pParentApp; /* Pointer to the parent application object */ boolean Initialized; /* Flag indicating the object status */ boolean Active; /* Is the mode the active display? */ boolean ReferencedDDraw; boolean ReferencedDDSurface; /*---------- Begin Protected Class Methods --------------------------*/ protected: /* Create the required DirectDraw objects */ boolean CreateDirectDraw (void); boolean CreateSurface (void); boolean CreateClipper (void); /* Event handlers */ virtual boolean OnActivate (LRESULT& Result, WPARAM wParam) { return (FALSE); } virtual boolean OnDisplayChange (LRESULT& Result, HWND hWindow) { return (FALSE); } virtual boolean OnKeyDown (LRESULT& Result, int KeyCode) { return (FALSE); } virtual boolean OnKeyUp (LRESULT& Result, int KeyCode) { return (FALSE); } virtual boolean OnLButtonDown (LRESULT& Result, int KeyFlags, int XPos, int YPos) { return (FALSE); } virtual boolean OnPaint (LRESULT& Result, HWND hWindow) { return (FALSE); } virtual boolean OnSize (LRESULT& Result, int Width, int Height) { return (FALSE); } /*---------- Begin Public Class Methods ----------------------------*/ public: /* Class Constructor/Destructor */ CDDSurfaceMode(); virtual ~CDDSurfaceMode() { Destroy(); } virtual void Destroy (void); /* Attempts to clear the primary surface */ virtual boolean ClearPrimary (void); /* Attempt to retrieve the device context of the display */ virtual boolean GetDisplayDC (HDC& hDC); /* Return the position/size rectangle of the main window */ virtual boolean GetDisplayRect (RECT& Rect); /* Handles window messages as per WindowProc() */ virtual boolean HandleMessages (LRESULT& lResult, HWND hWindow, UINT Message, WPARAM wParam, LPARAM lParam); /* Initializes the DirectDraw mode */ virtual boolean InitSurfaceMode (HWND hWindow, CD3DApp* pApp); /* Check initialized status of object */ virtual boolean IsInitialized (void) { return (Initialized); } virtual boolean IsActive (void) { return (Initialized && Active); } /* Attempt to release a device context of the display */ virtual boolean ReleaseDisplayDC (HDC hDC); /* Set class members */ virtual void SetActive (const boolean Value = TRUE) { Active = Value; } virtual void SetParent (CD3DApp* pApp) { pParentApp = pApp; } /* Update the display */ virtual void Update (void) { if (IsActive()) ClearPrimary(); } }; /*=========================================================================== * End of Class CDDSurfaceMode Definition *=========================================================================*/ #endif /*=========================================================================== * End of File DDSurfMode.H *=========================================================================*/