📄 airbattleview.cpp
字号:
// airbattleView.cpp : implementation of the CAirbattleView class
//
#include "stdafx.h"
#include "airbattle.h"
#include "airbattleDoc.h"
#include "airbattleView.h"
#include "Plane.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CAirbattleView
IMPLEMENT_DYNCREATE(CAirbattleView, CFormView)
BEGIN_MESSAGE_MAP(CAirbattleView, CFormView)
//{{AFX_MSG_MAP(CAirbattleView)
ON_COMMAND(ID_HELP_USING, OnHelpUsing)
ON_COMMAND(ID_SIMULAR_END, OnSimularEnd)
ON_COMMAND(ID_SIMULAR_SET, OnSimularSet)
ON_COMMAND(ID_SIMULAR_START, OnSimularStart)
ON_WM_TIMER()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CAirbattleView construction/destruction
CAirbattleView::CAirbattleView()
: CFormView(CAirbattleView::IDD)
{
//{{AFX_DATA_INIT(CAirbattleView)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
// TODO: add construction code here
}
CAirbattleView::~CAirbattleView()
{
}
void CAirbattleView::DoDataExchange(CDataExchange* pDX)
{
CFormView::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CAirbattleView)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BOOL CAirbattleView::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return CFormView::PreCreateWindow(cs);
}
void CAirbattleView::OnInitialUpdate()
{
CFormView::OnInitialUpdate();
GetParentFrame()->RecalcLayout();
ResizeParentToFit();
}
/////////////////////////////////////////////////////////////////////////////
// CAirbattleView diagnostics
#ifdef _DEBUG
void CAirbattleView::AssertValid() const
{
CFormView::AssertValid();
}
void CAirbattleView::Dump(CDumpContext& dc) const
{
CFormView::Dump(dc);
}
CAirbattleDoc* CAirbattleView::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CAirbattleDoc)));
return (CAirbattleDoc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CAirbattleView message handlers
void CAirbattleView::OnHelpUsing()
{
// TODO: Add your command handler code here
}
void CAirbattleView::OnSimularEnd()
{
// TODO: Add your command handler code here
KillTimer(1001);
}
void CAirbattleView::OnSimularSet()
{
// TODO: Add your command handler code here
}
//Plane p1(20,20,20);
int i=1;
//CString str;
void CAirbattleView::OnSimularStart()
{
// TODO: Add your command handler code here
SetTimer(1001,1000,NULL);
}
void CAirbattleView::OnTimer(UINT nIDEvent)
{
// TODO: Add your message handler code here and/or call default
//p1.SetPost(50+i,50+i,50);
i++;
CClientDC dc(this);
point x1={1.0,1.0,0.0},x2={3.0,4.0,0.0};
double temp=distance(x1,x2);
CString strtemp;
strtemp.Format("this is my distance:%f",temp);
//str.Format("%d,%d,%d",p1.GetX(),p1.GetY(),p1.GetZ());dc.TextOut(10, 10, str);
//dc.TextOut(10, 10, str);
dc.TextOut(50, 10, strtemp);
//CPen Pen(PS_SOLID,5,RGB(255,0,0));
//CPen *OldPen=dc.SelectObject(&Pen);
//dc.Ellipse(p1.GetX()*2,p1.GetY()*2,p1.GetX()*2+50,p1.GetY()*2+50);
//dc.SelectObject(OldPen);
ReleaseDC(&dc);
CFormView::OnTimer(nIDEvent);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -