⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 plane.cpp

📁 VC面向对象的学习教程
💻 CPP
字号:
// Plane.cpp: implementation of the CPlane class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "My.h"
#include "Plane.h"

#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

// 飞机类的成员函数
// 构造函数
CPlane::CPlane()
{
	m_pointPlane	= CPoint(0, 50);
	m_bmpPlane.LoadBitmap(IDB_PLANE);
	BITMAP BM;
	m_bmpPlane.GetBitmap(&BM);
	m_nWidth	= BM.bmWidth;
	m_nHeight	= BM.bmHeight;
}
// 显示飞机
void CPlane::ShowPlane(CDC *pDC, CDC *pMemDC, CRect Client)
{
	pMemDC->SelectObject(&m_bmpPlane);
	pDC->BitBlt(m_pointPlane.x, m_pointPlane.y,
				m_nWidth, m_nHeight, pMemDC,0,0,SRCAND);
}
// 改变飞机位置
void CPlane::ChangePos()
{
	if(m_pointPlane.x>788)
		m_pointPlane.x  = 0;
	else
		m_pointPlane.x += 10;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -