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

📄 stone.cpp

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

#include "stdafx.h"
#include "My.h"
#include "Stone.h"

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

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

// 炮弹类成员函数
// 炮弹类构造函数
CStone::CStone()
{
	m_bShot = FALSE;
	m_bmpStone.LoadBitmap(IDB_STONE);
	BITMAP BM;
	m_bmpStone.GetBitmap(&BM);
	m_nWidth	= BM.bmWidth;
	m_nHeight	= BM.bmHeight;
}
// 发射
void CStone::Shot(int x)
{
	m_bShot = TRUE;
	m_pointStone.x = x+48;
	m_pointStone.y = 440;
}
// 显示炮弹
void CStone::ShowStone(CDC *pDC, CDC *pMemDC, CRect Client)
{
	if(m_bShot)
	{
		pMemDC->SelectObject(&m_bmpStone);
		pDC->BitBlt(m_pointStone.x, m_pointStone.y,
					m_nWidth, m_nHeight, pMemDC,0,0,SRCAND);
	}
}
// 改变位置
void CStone::ChangePos()
{
	if(m_bShot)
		m_pointStone.y    -= 20;
}

⌨️ 快捷键说明

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