📄 45mapmakerdoc.cpp
字号:
// 45MapMakerDoc.cpp : implementation of the CMy45MapMakerDoc class
//
#include "stdafx.h"
#include "45MapMaker.h"
#include "CreateMapDlg.h"
#include "45MapMakerDoc.h"
#include ".\45mapmakerdoc.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CMy45MapMakerDoc
IMPLEMENT_DYNCREATE(CMy45MapMakerDoc, CDocument)
BEGIN_MESSAGE_MAP(CMy45MapMakerDoc, CDocument)
//{{AFX_MSG_MAP(CMy45MapMakerDoc)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code!
//}}AFX_MSG_MAP
// ON_COMMAND(ID_FILE_NEW, OnFileNew)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CMy45MapMakerDoc construction/destruction
CMy45MapMakerDoc::CMy45MapMakerDoc()
{
// TODO: add one-time construction code here
}
CMy45MapMakerDoc::~CMy45MapMakerDoc()
{
}
BOOL CMy45MapMakerDoc::OnNewDocument() //新建文档的操作
{
CMy45MapMakerApp* theApp = (CMy45MapMakerApp*)AfxGetApp();
if (!CDocument::OnNewDocument())
return FALSE;
SetTitle("new");
//theApp->m_myWall.SaveFile();
theApp->m_myWall.LoadFile();
CCreateMapDlg dlg;
dlg.m_MapHeight = 100;
dlg.m_MapWidth = 100;
if(dlg.DoModal()==IDOK)
{
m_myMap.set(dlg.m_MapWidth,dlg.m_MapHeight,dlg.m_TileWidth,dlg.m_TileHeight);
this->UpdateAllViews(NULL);
return true;
}
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// CMy45MapMakerDoc serialization
void CMy45MapMakerDoc::Serialize(CArchive& ar)
{
if (ar.IsStoring())
{
// TODO: add storing code here
}
else
{
// TODO: add loading code here
}
}
/////////////////////////////////////////////////////////////////////////////
// CMy45MapMakerDoc diagnostics
#ifdef _DEBUG
void CMy45MapMakerDoc::AssertValid() const
{
CDocument::AssertValid();
}
void CMy45MapMakerDoc::Dump(CDumpContext& dc) const
{
CDocument::Dump(dc);
}
#endif //_DEBUG
BOOL CMy45MapMakerDoc::OnOpenDocument(LPCTSTR lpszPathName)
{
//CMy45MapMakerApp* theApp = (CMy45MapMakerApp*)AfxGetApp();
if (!CDocument::OnOpenDocument(lpszPathName))
return FALSE;
this->m_myMap.LoadMap(lpszPathName);
// TODO: 在此添加您专用的创建代码
return TRUE;
}
BOOL CMy45MapMakerDoc::OnSaveDocument(LPCTSTR lpszPathName)
{
CMy45MapMakerApp* theApp = (CMy45MapMakerApp*)AfxGetApp();
// TODO: 在此添加专用代码和/或调用基类
m_myMap.SaveMap(lpszPathName);
theApp->m_myWall.SaveFile("..\\config\\map\\wall.config");
return true;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -