DirectDraw代码在WINMAIN函数下,加到哪
#include"CGameMain.h"extern bool g_bLDown;
CGameMain::CGameMain()
{
m_pGraph=new CGraphic;
}
CGameMain::~CGameMain()
{
delete m_pGraph;
m_pGraph=NULL;
}
void CGameMain::GameInit(HWND hWnd) //游戏初始化
{
m_pGraph->InitDirectDraw(hWnd,true,800,600,32);
m_pGraph->LoadToOffScreen(m_pBImage[0],800,600,"30.bmp",false,RGB(0,255,0));
m_pGraph->LoadToOffScreen(m_pBImage[1],0,0,"64.bmp",true,RGB(255,0,0));
::ShowCursor(FALSE);
}
void CGameMain::Render() //游戏宣染
{
::GetCursorPos(&m_MPos);
SetRect(&m_rect,0,0,800,600);
m_pGraph->BltBBuffer(m_pBImage[1],true,m_MPos.x,m_MPos.y,m_rect);
m_pGraph->Flip();
}
void CGameMain::SetMouseRect(RECT* m_rect,int scWidth,int scHeight,int msWidth,int msHeight)
{
int mouseX,mouseY;
if(m_MPos.x>scWidth-msWidth)
{
mouseX=scWidth-m_MPos.x;
}
else
{
mouseX=msWidth;
}
if(m_MPos.y>scHeight-msHeight)
{
mouseY=scHeight-m_MPos.y;
}
else
{
mouseY=msHeight;
}
SetRect(m_rect,0,0,mouseX,mouseY);
}
这是一个简单游戏开始时的图形页面,在WINMAIN函数下加在什么地方好呢,我加在显示窗口函数后,不行,加在更新窗口函数下也不行的,