#include <afxwin.h>
class CMyWnd :public CFrameWnd
{
private:
CDC *m_pmdc;
CBitmap *m_pbitmap[5];
CRect myRect[6];
CString picPath[5];
int hit;
BOOL m_state[6];
int counter;
int num;
int hammer_x;
int hammer_y;
public:
CMyWnd()
{
Create(NULL,"Third App");
CClientDC dc(this);
picPath[0]="../image/background.bmp";
picPath[1]="../image/mouse1.bmp";
picPath[2]="../image/mouse2.bmp";
picPath[3]="../image/hammer1.bmp";
picPath[4]="../image/hammer2.bmp";
//
myRect[0].SetRect(30,10,130,110);
myRect[1].SetRect(190,10,290,110);
myRect[2].SetRect(340,10,440,110);
myRect[3].SetRect(30,140,130,240);
myRect[4].SetRect(190,140,290,240);
myRect[5].SetRect(340,140,440,240);
//
hit=0;
for(int i=0;i&

本文介绍了使用C++进行游戏设计,以打地鼠为例,详细讲解了游戏的逻辑实现、用户交互及关键算法。通过这个项目,读者可以深入理解C++编程和游戏开发的基本概念。
最低0.47元/天 解锁文章
1万+

被折叠的 条评论
为什么被折叠?



