第一范文网 - 专业文章范例文档资料分享平台

VC++电脑游戏飞机大战的开发与设计(含源文件)

来源:用户分享 时间:2025/8/26 10:15:02 本文由loading 分享 下载这篇文档手机版
说明:文章内容仅供预览,部分内容可能不全,需要完整文档或者需要复制内容,请下载word后使用。下载word有问题请添加微信号:xxxxxxx或QQ:xxxxxx 处理(尽可能给您提供完整文档),感谢您的支持与谅解。

学位论文

BEGIN_MESSAGE_MAP(CMyDlg, CDialog) //{{AFX_MSG_MAP(CMyDlg) ON_WM_SYSCOMMAND() ON_WM_PAINT()

ON_WM_QUERYDRAGICON() ON_WM_DESTROY() ON_WM_TIMER() ON_WM_ERASEBKGND() ON_WM_KEYDOWN() //}}AFX_MSG_MAP ON_WM_LBUTTONDOWN() ON_WM_LBUTTONUP()

END_MESSAGE_MAP()

///////////////////////////////////////////////////////////////////////////// // CMyDlg message handlers

BOOL CMyDlg::OnInitDialog() { CDialog::OnInitDialog();

// Add \

// IDM_ABOUTBOX must be in the system command range. ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX); ASSERT(IDM_ABOUTBOX < 0xF000);

CMenu* pSysMenu = GetSystemMenu(FALSE); if (pSysMenu != NULL) { CString strAboutMenu;

strAboutMenu.LoadString(IDS_ABOUTBOX);

44

学位论文

if (!strAboutMenu.IsEmpty()) { pSysMenu->AppendMenu(MF_SEPARATOR); pSysMenu->AppendMenu(MF_STRING,

IDM_ABOUTBOX,

strAboutMenu);

}

}

// Set the icon for this dialog. The framework does this automatically // when the application's main window is not a dialog SetIcon(m_hIcon, TRUE);

// Set big icon

SetIcon(m_hIcon, FALSE);

// Set small icon

// TODO: Add extra initialization here this->SetWindowText(_T(\飞机大战\ InitData();

m_uTimer = SetTimer(1,30,NULL); srand((unsigned)time(NULL)); InitUserDC(); DrawContent();

return TRUE; // return TRUE unless you set the focus to a control

}

void CMyDlg::OnSysCommand(UINT nID, LPARAM lParam) { if ((nID & 0xFFF0) == IDM_ABOUTBOX) { CAboutDlg dlgAbout; dlgAbout.DoModal();

}

45

学位论文

}

else { }

CDialog::OnSysCommand(nID, lParam);

// If you add a minimize button to your dialog, you will need the code below // to draw the icon. For MFC applications using the document/view model, // this is automatically done for you by the framework.

void CMyDlg::OnPaint() {

/* if (IsIconic()) 0);

} else {

CDialog::OnPaint();

46

{

CPaintDC dc(this); // device context for painting

SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(),

// Center icon in client rectangle

int cxIcon = GetSystemMetrics(SM_CXICON); int cyIcon = GetSystemMetrics(SM_CYICON); CRect rect;

GetClientRect(&rect);

int x = (rect.Width() - cxIcon + 1) / 2; int y = (rect.Height() - cyIcon + 1) / 2; // Draw the icon

dc.DrawIcon(x, y, m_hIcon);

学位论文

}*/

CPaintDC dc(this); CRect rc; GetClientRect(rc);

dc.BitBlt(0,0,rc.Width(),rc.Height(),&m_dcMem,0,0,SRCCOPY);

}

// The system calls this to obtain the cursor to display while the user drags // the minimized window.

HCURSOR CMyDlg::OnQueryDragIcon() { return (HCURSOR) m_hIcon;

}

void CMyDlg::OnDestroy() { CDialog::OnDestroy();

// TODO: Add your message handler code here KillTimer(m_uTimer); DeleteUserDC(); delete[] pMEPOINT; delete[] pFLIVVERPOINT; delete[] pFLIVVER2POINT; delete[] pFLIVVER3POINT;

}

void CMyDlg::OnTimer(UINT nIDEvent) {

m_bgPlace = ++m_bgPlace % 601;

47

VC++电脑游戏飞机大战的开发与设计(含源文件).doc 将本文的Word文档下载到电脑,方便复制、编辑、收藏和打印
本文链接:https://www.diyifanwen.net/c5jk659cocl6zh7t4fk25_13.html(转载请注明文章来源)
热门推荐
Copyright © 2012-2023 第一范文网 版权所有 免责声明 | 联系我们
声明 :本网站尊重并保护知识产权,根据《信息网络传播权保护条例》,如果我们转载的作品侵犯了您的权利,请在一个月内通知我们,我们会及时删除。
客服QQ:xxxxxx 邮箱:xxxxxx@qq.com
渝ICP备2023013149号
Top