CDirectDraw Class Reference

CDirectDraw manages the DirectDraw stuff. More...

#include <CDirectDraw.h>

Collaboration diagram for CDirectDraw:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 CDirectDraw (void)
 ~CDirectDraw (void)
void SetWindowHandle (HWND hWnd)
bool Create (int Width, int Height, int Depth, bool FullScreen)
void Destroy (void)
 Destroys the directdraw interface.
bool SetTransparentColor (int Red, int Green, int Blue)
bool LoadSprites (int SpriteTableWidth, int SpriteTableHeight, int SpriteWidth, int SpriteHeight, bool Transparent, HBITMAP hBitmap)
void FreeSprites (void)
void OnWindowMove (void)
 Update the drawing zones in case the window moves.
void OnPaint (void)
 Update the screen.
void Clear (void)
 Makes the display black.
void UpdateAll (void)
 Processes all drawing requests and calls UpdateScreen.
void UpdateScreen (void)
 Updates the display by blitting the back buffer surface on the primary surface.
void SetOrigin (int OriginX, int OriginY)
 Set the origin of the top left position.
void DrawSprite (int PositionX, int PositionY, RECT *pZone, RECT *pClip, int SpriteTable, int Sprite, int SpriteLayer, int PriorityInLayer)
 Store a sprite in the drawing requests list.
void DrawDebugRectangle (int PositionX, int PositionY, int w, int h, BYTE r, BYTE g, BYTE b, int SpriteLayer, int PriorityInLayer)
void RemoveAllDebugRectangles ()
bool IsModeSet (int Width, int Height, int Depth, bool FullScreen)
bool IsModeAvailable (int Width, int Height, int Depth)

Private Member Functions

WORD GetNumberOfBits (DWORD dwMask)

Private Attributes

HWND m_hWnd
 Window handle.
RECT m_rcScreen
 Window rect in screen coordinates.
RECT m_rcViewport
 Window rect in client coordinates.
int m_Width
 Display width when fullscreen.
int m_Height
 Display height when fullscreen.
int m_Depth
 Display depth when fullscreen.
bool m_FullScreen
 Is it fullscreen?
LPDIRECTDRAW7 m_pDD
 Directdraw object.
LPDIRECTDRAWSURFACE7 m_pBackBuffer
 Backbuffer surface.
LPDIRECTDRAWSURFACE7 m_pPrimary
 Primary surface.
vector< SSurfacem_Surfaces
 Surfaces.
DWORD m_ColorKey
 Color key for transparent surfaces.
priority_queue< SDrawingRequestm_DrawingRequests
 Automatically sorted drawing requests queue.
vector< SDebugDrawingRequestm_DebugDrawingRequests
 vector of drawing requests for debugging purposes
vector< vector< SSprite > > m_SpriteTables
 Available sprite tables.
int m_OriginX
 Origin position where to draw from.
int m_OriginY
vector< SDisplayModem_AvailableDisplayModes


Detailed Description

CDirectDraw manages the DirectDraw stuff.

Constructor & Destructor Documentation

CDirectDraw::CDirectDraw ( void   ) 

CDirectDraw::~CDirectDraw ( void   ) 


Member Function Documentation

WORD CDirectDraw::GetNumberOfBits ( DWORD  dwMask  )  [private]

Here is the caller graph for this function:

void CDirectDraw::SetWindowHandle ( HWND  hWnd  )  [inline]

bool CDirectDraw::Create ( int  Width,
int  Height,
int  Depth,
bool  FullScreen 
)

Set the display properties

Create directdraw object

Enumerate all display modes (without taking refresh rates into account)

Here is the call graph for this function:

void CDirectDraw::Destroy ( void   ) 

Destroys the directdraw interface.

Here is the call graph for this function:

bool CDirectDraw::SetTransparentColor ( int  Red,
int  Green,
int  Blue 
)

Here is the call graph for this function:

bool CDirectDraw::LoadSprites ( int  SpriteTableWidth,
int  SpriteTableHeight,
int  SpriteWidth,
int  SpriteHeight,
bool  Transparent,
HBITMAP  hBitmap 
)

Here is the call graph for this function:

void CDirectDraw::FreeSprites ( void   ) 

Here is the caller graph for this function:

void CDirectDraw::OnWindowMove ( void   ) 

Update the drawing zones in case the window moves.

void CDirectDraw::OnPaint ( void   )  [inline]

Update the screen.

See also:
UpdateScreen()

Here is the call graph for this function:

void CDirectDraw::Clear ( void   ) 

Makes the display black.

Here is the caller graph for this function:

void CDirectDraw::UpdateAll ( void   ) 

Processes all drawing requests and calls UpdateScreen.

Blit every sprite from the drawing request list to the back buffer surface.

See also:
UpdateScreen()

Here is the call graph for this function:

void CDirectDraw::UpdateScreen ( void   ) 

Updates the display by blitting the back buffer surface on the primary surface.

TODO: Check if this should be an equal compare instead of not equal

Here is the caller graph for this function:

void CDirectDraw::SetOrigin ( int  OriginX,
int  OriginY 
) [inline]

Set the origin of the top left position.

Draw requests are relative to this position

void CDirectDraw::DrawSprite ( int  PositionX,
int  PositionY,
RECT pZone,
RECT pClip,
int  SpriteTable,
int  Sprite,
int  SpriteLayer,
int  PriorityInLayer 
)

Store a sprite in the drawing requests list.

Parameters:
PositionX the x coordinate where the upper left corner should be placed (relative to origin)
PositionY the y coordinate where the upper left corner should be placed (relative to origin)
See also:
SetOrigin()

See also:
m_DrawingRequests

void CDirectDraw::DrawDebugRectangle ( int  PositionX,
int  PositionY,
int  w,
int  h,
BYTE  r,
BYTE  g,
BYTE  b,
int  SpriteLayer,
int  PriorityInLayer 
)

void CDirectDraw::RemoveAllDebugRectangles (  ) 

bool CDirectDraw::IsModeSet ( int  Width,
int  Height,
int  Depth,
bool  FullScreen 
) [inline]

bool CDirectDraw::IsModeAvailable ( int  Width,
int  Height,
int  Depth 
)


Member Data Documentation

HWND CDirectDraw::m_hWnd [private]

Window handle.

Window rect in screen coordinates.

Window rect in client coordinates.

int CDirectDraw::m_Width [private]

Display width when fullscreen.

int CDirectDraw::m_Height [private]

Display height when fullscreen.

int CDirectDraw::m_Depth [private]

Display depth when fullscreen.

bool CDirectDraw::m_FullScreen [private]

Is it fullscreen?

LPDIRECTDRAW7 CDirectDraw::m_pDD [private]

Directdraw object.

LPDIRECTDRAWSURFACE7 CDirectDraw::m_pBackBuffer [private]

Backbuffer surface.

LPDIRECTDRAWSURFACE7 CDirectDraw::m_pPrimary [private]

Primary surface.

vector<SSurface> CDirectDraw::m_Surfaces [private]

Surfaces.

Color key for transparent surfaces.

Automatically sorted drawing requests queue.

vector of drawing requests for debugging purposes

vector<vector<SSprite> > CDirectDraw::m_SpriteTables [private]

Available sprite tables.

int CDirectDraw::m_OriginX [private]

Origin position where to draw from.

int CDirectDraw::m_OriginY [private]


The documentation for this class was generated from the following files:

Generated on Sat Oct 18 12:26:44 2008 for Bombermaaan by  doxygen 1.5.5
Visit the Bombermaaan project page
SourceForge.net Logo