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

📄 you.cpp

📁 关于 dirve car 的VC 部分源码
💻 CPP
字号:
// You.cpp: implementation of the CYou class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "drivecar.h"
#include "You.h"

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

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

CYou::CYou()
{
	BITMAP BM;
	m_bmpYouH.LoadBitmap(IDB_YOUH);
	m_bmpYouH.GetBitmap(&BM);
	m_bmpYouL.LoadBitmap(IDB_YOUL);
	m_bmpYouL.GetBitmap(&BM);
	m_nWidth=BM.bmWidth;
	m_nHeight=BM.bmHeight;
	m_pointYou=CPoint(150,360);
	m_ndir=0;
	m_YLoop=-1;
}

CYou::~CYou()
{

}

void CYou::ShowYou(CDC *pDC,CDC *pMemDC,CRect Client)
{
	if(m_bWhich)
		pMemDC->SelectObject(&m_bmpYouL);
	else pMemDC->SelectObject(&m_bmpYouH);
		pDC->BitBlt(m_pointYou.x,m_pointYou.y,m_nWidth,m_nHeight,pMemDC,0,0,SRCAND);
}

void CYou::ChangePos()
{
		if(m_ndir==0)
		{
			m_bWhich=true;
			if(m_pointYou.x<550)
				m_pointYou.x+=15;
			else m_ndir=1;
		}
		else if(m_ndir==1)
		{
			m_bWhich=false;
			if(m_pointYou.y>110)
				m_pointYou.y-=15;
			else m_ndir=2;
		}
		else if(m_ndir==2)
		{
			m_bWhich=true;
			if(m_pointYou.x>110)
				m_pointYou.x-=15;
			else m_ndir=3;
		}
		else if(m_ndir==3)
		{
			m_bWhich=false;
			if(m_pointYou.y<350)
				m_pointYou.y+=15;
			else{m_ndir=0;}
		}
}

CRect CYou::GetYou()
{
	return CRect(m_pointYou.x,m_pointYou.y,m_pointYou.x+m_nWidth,m_pointYou.y+m_nHeight);
}

void CYou::Reset()
{
	m_pointYou=CPoint(150,360);
	m_ndir=0;
	m_bWhich=true;
	m_YLoop=-1;
}

⌨️ 快捷键说明

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