#include <CDirectDraw.h>
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< SSurface > | m_Surfaces |
Surfaces. | |
DWORD | m_ColorKey |
Color key for transparent surfaces. | |
priority_queue< SDrawingRequest > | m_DrawingRequests |
Automatically sorted drawing requests queue. | |
vector< SDebugDrawingRequest > | m_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< SDisplayMode > | m_AvailableDisplayModes |
CDirectDraw::CDirectDraw | ( | void | ) |
CDirectDraw::~CDirectDraw | ( | void | ) |
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)
void CDirectDraw::Destroy | ( | void | ) |
Destroys the directdraw interface.
bool CDirectDraw::SetTransparentColor | ( | int | Red, | |
int | Green, | |||
int | Blue | |||
) |
bool CDirectDraw::LoadSprites | ( | int | SpriteTableWidth, | |
int | SpriteTableHeight, | |||
int | SpriteWidth, | |||
int | SpriteHeight, | |||
bool | Transparent, | |||
HBITMAP | hBitmap | |||
) |
void CDirectDraw::FreeSprites | ( | void | ) |
void CDirectDraw::OnWindowMove | ( | void | ) |
Update the drawing zones in case the window moves.
void CDirectDraw::OnPaint | ( | void | ) | [inline] |
void CDirectDraw::Clear | ( | void | ) |
Makes the display black.
void CDirectDraw::UpdateAll | ( | void | ) |
Processes all drawing requests and calls UpdateScreen.
Blit every sprite from the drawing request list to the back buffer surface.
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
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.
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) |
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 | |||
) |
HWND CDirectDraw::m_hWnd [private] |
Window handle.
RECT CDirectDraw::m_rcScreen [private] |
Window rect in screen coordinates.
RECT CDirectDraw::m_rcViewport [private] |
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.
DWORD CDirectDraw::m_ColorKey [private] |
Color key for transparent surfaces.
priority_queue<SDrawingRequest> CDirectDraw::m_DrawingRequests [private] |
Automatically sorted drawing requests queue.
vector<SDebugDrawingRequest> CDirectDraw::m_DebugDrawingRequests [private] |
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] |
vector<SDisplayMode> CDirectDraw::m_AvailableDisplayModes [private] |