【VC开源代码栏目提醒】:以下是网学会员为您推荐的VC开源代码-DiamondDlg.cpp,希望本篇文章对您学习有所帮助。
// DiamondDlg.cpp : implementation file
//
#include "stdafx.h"
#include "CSDemo.h"
#include "DiamondDlg.h"
#include "DiamondShape.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CDiamondDlg dialog
CDiamondDlg::CDiamondDlg(CWnd* pParent /*=NULL*/)
: CDialog(CDiamondDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CDiamondDlg)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
void CDiamondDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CDiamondDlg)
DDX_Control(pDX, IDC_ST_DIAMOND, m_ctlDiamond);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CDiamondDlg, CDialog)
//{{AFX_MSG_MAP(CDiamondDlg)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CDiamondDlg message handlers
BOOL CDiamondDlg::PreTranslateMessage(MSG* pMsg)
{
if( pMsg->message == WM_KEYDOWN )
{
switch( pMsg->wParam )
{
case VK_LEFT:
if( m_ctlDiamond.GetState() == ST_PLAY )
m_ctlDiamond.ChangeShape( 0 );
break;
case VK_RIGHT:
if( m_ctlDiamond.GetState() == ST_PLAY )
m_ctlDiamond.ChangeShape( 1 );
break;
case VK_DOWN:
if( m_ctlDiamond.GetState() == ST_PLAY )
m_ctlDiamond.StepShape();
break;
case VK_UP:
if( m_ctlDiamond.GetState() == ST_PLAY )
m_ctlDiamond.ChangeShape( 3 );
break;
case 'A':
if( m_ctlDiamond.GetState() == ST_PRE )
m_ctlDiamond.BeginGame();
break;
case 'P':
if( m_ctlDiamond.GetState() == ST_PLAY )
m_ctlDiamond.PauseGame();
else
m_ctlDiamond.ResumeGame();
break;
case 'R':
if( m_ctlDiamond.GetState() == ST_PLAY )
m_ctlDiamond.BeginGame();
break;
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
if( m_ctlDiamond.GetState() == ST_PLAY )
m_ctlDiamond.GetCheatShape( (char)pMsg->wParam - '0' );
break;
case 'N':
m_ctlDiamond.SpeedDown();
break;
case 'M':
m_ctlDiamond.SpeedUp();
break;
}
return true;
}
return CDialog::PreTranslateMessage(pMsg);
}
上一篇:
DialupDlg.cpp
下一篇:
西班牙语医院科室名称