标题:DirectDraw代码在WINMAIN函数下,加到哪
只看楼主
hdshdzh
Rank: 2
等 级:论坛游民
帖 子:77
专家分:11
注 册:2010-5-13
结帖率:92.31%
 问题点数:0 回复次数:0 
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函数下加在什么地方好呢,我加在显示窗口函数后,不行,加在更新窗口函数下也不行的,
搜索更多相关主题的帖子: DirectDraw WINMAIN 代码 
2010-12-04 15:38



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-327888-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 1.132147 second(s), 7 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved