📄 controldlg.cpp
字号:
// ControlDlg.cpp : implementation file
//
#include "stdafx.h"
#include "Robocup.h"
#include "ControlDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CControlDlg dialog
CControlDlg::CControlDlg(CWnd* pParent /*=NULL*/)
: CDialog(CControlDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CControlDlg)
m_angle = 0.0;
m_distant = 0.0;
m_holes = 0;
m_robot_num = 0;
//}}AFX_DATA_INIT
}
void CControlDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CControlDlg)
DDX_Text(pDX, IDC_ANGLE, m_angle);
DDX_Text(pDX, IDC_DISTANT, m_distant);
DDX_Text(pDX, IDC_HOLES, m_holes);
DDX_Text(pDX, IDC_ROBOT_NUM, m_robot_num);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CControlDlg, CDialog)
//{{AFX_MSG_MAP(CControlDlg)
ON_BN_CLICKED(IDC_CONVERT, OnConvert)
ON_BN_CLICKED(IDC_ANGLE_CONVERT, OnAngleConvert)
ON_BN_CLICKED(IDC_UP, OnUp)
ON_BN_CLICKED(IDC_LEFT, OnLeft)
ON_BN_CLICKED(IDC_DOWN, OnDown)
ON_BN_CLICKED(IDC_RIGHT, OnRight)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CControlDlg message handlers
void CControlDlg::OnConvert()
{
// TODO: Add your control notification handler code here
UpdateData( TRUE ) ;
m_holes = (int)(m_distant / 1.15) ;
UpdateData( FALSE ) ;
}
void CControlDlg::OnAngleConvert()
{
// TODO: Add your control notification handler code here
UpdateData( TRUE ) ;
m_holes = m_angle / 8 ;
UpdateData( FALSE ) ;
}
void CControlDlg::OnUp()
{
// TODO: Add your control notification handler code here
UpdateData( TRUE ) ;
TCHAR command2 , command3 ;
int m = (int)(m_distant / 1.15) ;
command3 = (TCHAR)( m | 192 );
UpdateData( FALSE ) ;
Player::SendSingleCommand2( 1, command3, 1 );
}
void CControlDlg::OnLeft()
{
// TODO: Add your control notification handler code here
UpdateData( TRUE ) ;
TCHAR command3 ;
int m = (int)(m_angle / 8) ;
command3 = (TCHAR)( m | 64 );
UpdateData( FALSE ) ;
Player::SendSingleCommand2( 1, command3, 1 );
}
void CControlDlg::OnDown()
{
// TODO: Add your control notification handler code here
UpdateData( TRUE ) ;
TCHAR command2 ;
int m = (int)(m_distant / 1.15) ;
command2 = (TCHAR)( m | 0 );
UpdateData( FALSE ) ;
Player::SendSingleCommand2( 1, command2, 1 );
}
void CControlDlg::OnRight()
{
// TODO: Add your control notification handler code here
UpdateData( TRUE ) ;
TCHAR command2 ;
int m = (int)(m_angle / 8 ) ;
command2 = (TCHAR)( m | 128 );
UpdateData( FALSE );
Player::SendSingleCommand2( 1, command2, 1 );
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -