📄 car.cpp
字号:
// Car.cpp: implementation of the CCar class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "Trafficlight.h"
#include "Car.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CCar::CCar()
{
m_bmpCar.LoadBitmap(IDB_CAR);
BITMAP BM;
m_bmpCar.GetBitmap(&BM);
m_nHeight=BM.bmHeight;
m_nWidth=BM.bmWidth;
}
CCar::~CCar()
{
}
CRect CCar::GetCar()
{return CRect(m_pointCar.x,m_pointCar.y,m_pointCar.x+m_nWidth,m_pointCar.y+m_nHeight);
}
void CCar::ChangePos(int tag)
{
if(m_pointCar.x<-80)
{
m_pointCar.x=700;
m_pointCar.y=400;
}
else
{
if(tag==0)
{
m_pointCar.x-=3;
}
else{m_pointCar.x-=6;}
}
}
void CCar::ResetPos(int tag)
{
if(tag==0)
{
m_pointCar.x=700;
m_pointCar.y=400;
}
if(tag==1)
{
m_pointCar.x=200;
m_pointCar.y=400;
}
}
void CCar::ShowCar(CDC *pDC, CDC *pMemDC)
{
pMemDC->SelectObject(&m_bmpCar);
pDC->BitBlt(m_pointCar.x,m_pointCar.y,m_nWidth,m_nHeight,pMemDC,0,0,SRCAND);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -