00001 /// \file CATOverlay.h 00002 /// \brief Base image overlay for drawing on top of games 00003 /// \ingroup CAT 00004 /// 00005 /// Copyright (c) 2007-2008 by Michael Ellison. 00006 /// See COPYING.txt for the \ref gaslicense License (MIT License). 00007 /// 00008 // $Author: mikeellison $ 00009 // $Date: 2008-01-31 21:20:49 -0600 (Thu, 31 Jan 2008) $ 00010 // $Revision: $ 00011 // $NoKeywords: $ 00012 00013 #ifndef _CATOverlay_H_ 00014 #define _CATOverlay_H_ 00015 00016 #include "CATIntercept.h" 00017 #ifdef CAT_CONFIG_WIN32 00018 #include "CATImage.h" 00019 #include "CATCritSec.h" 00020 00021 /// \class CATOverlay 00022 /// \brief OpenGL image Overlay 00023 /// \ingroup CAT 00024 class CATOverlay : public CATIntercept 00025 { 00026 public: 00027 CATOverlay(); 00028 virtual ~CATOverlay(); 00029 00030 /// Retrieve the screen rect available for the overlay. 00031 CATRect GetRect(); 00032 00033 /// Sets an image to overlay the display. 00034 /// 00035 /// OverlayRect is the position of the overlay within the display. 00036 /// refScreenWidth and refScreenHeight are the virtual size of the display 00037 /// used to position the overlayRect onto the actual screen. 00038 /// 00039 /// So, if you want, you can give it a 640x480 rect, with the ref width/height 00040 /// of 640x480, and it will fill the screen regardless of the screen's actual 00041 /// size. 00042 /// 00043 /// Note that currently the image that is provided is assumed to be persistent 00044 /// until another image is sent (or null is passed for overlay). The overlay does 00045 /// not create a copy, but will use it asynchronously during the next draw. If you 00046 /// are using for dynamic content, keep the old image around until *after* you set 00047 /// a new overlay image. 00048 /// 00049 /// \param overlay Image to overlay onto the screen, or 0 to reset to none. 00050 /// \param overlayRect Virtual position/size of the overlay to draw on the screen. 00051 /// \param refScreenWidth Virtual width of display, used to scale overlay to actual size. 00052 /// \param regScreenHeight Virtual height of the display. 00053 void SetOverlayImage( CATImage* overlay, 00054 const CATRect& overlayRect, 00055 CATInt32 refScreenWidth, 00056 CATInt32 refScreenHeight, 00057 bool keepAspect = true); 00058 00059 00060 protected: 00061 CATCritSec fLock; ///< Critical section for image/rect 00062 CATRect fRect; ///< Rect of full display area 00063 CATImage* fOverlay; ///< Overlay image 00064 CATRect fOverlayRect; ///< Virtual rect of overlay 00065 CATInt32 fRefScreenWidth; ///< Virtual width of overlay display 00066 CATInt32 fRefScreenHeight; ///< Virtual height of overlay display 00067 bool fOverlayDirty; ///< Overlay has changed since last render 00068 bool fKeepAspect; 00069 }; 00070 00071 #endif // CAT_CONFIG_WIN32 00072 #endif // _CATOverlay_H_